From d5e6f1b80ba1b183d6ee50b2b7a11f0152ac0463 Mon Sep 17 00:00:00 2001 From: drochner Date: Thu, 4 Dec 2003 16:23:34 +0000 Subject: [PATCH] resolve conflicts (in this case, throw away all local modifications; I'll start patching from scratch) --- dist/ntp/ElectricFence/efence.c | 2 +- dist/ntp/ElectricFence/efence.h | 2 +- dist/ntp/ElectricFence/eftest.c | 2 +- dist/ntp/ElectricFence/page.c | 2 +- dist/ntp/ElectricFence/print.c | 2 +- dist/ntp/ElectricFence/tstheap.c | 2 +- dist/ntp/README.cvs | 24 - dist/ntp/README.des | 16 - dist/ntp/README.rsa | 62 - dist/ntp/acconfig.h | 476 - dist/ntp/adjtimed/adjtimed.c | 2 +- dist/ntp/arlib/arlib.c | 2 +- dist/ntp/arlib/arlib.h | 2 +- dist/ntp/arlib/arplib.h | 2 +- dist/ntp/arlib/sample.c | 2 +- dist/ntp/clockstuff/chutest.c | 2 +- dist/ntp/clockstuff/clktest.c | 2 +- dist/ntp/clockstuff/propdelay.c | 2 +- dist/ntp/conf/dewey.conf | 42 - dist/ntp/config.h.in | 1163 +- dist/ntp/configure | 25434 +++++++++++++----- dist/ntp/configure.in | 2010 +- dist/ntp/html/Oncore-SHMEM.htm | 257 - dist/ntp/html/accopt.htm | 144 - dist/ntp/html/assoc.htm | 170 - dist/ntp/html/audio.htm | 153 - dist/ntp/html/authopt.htm | 278 - dist/ntp/html/biblio.htm | 253 - dist/ntp/html/build.htm | 180 - dist/ntp/html/clockopt.htm | 193 - dist/ntp/html/config.htm | 288 - dist/ntp/html/confopt.htm | 215 - dist/ntp/html/copyright.htm | 209 - dist/ntp/html/debug.htm | 284 - dist/ntp/html/driver1.htm | 157 - dist/ntp/html/driver10.htm | 114 - dist/ntp/html/driver11.htm | 150 - dist/ntp/html/driver12.htm | 98 - dist/ntp/html/driver16.htm | 43 - dist/ntp/html/driver18.htm | 235 - dist/ntp/html/driver19.htm | 124 - dist/ntp/html/driver2.htm | 137 - dist/ntp/html/driver20.htm | 131 - dist/ntp/html/driver22.htm | 129 - dist/ntp/html/driver23.htm | 178 - dist/ntp/html/driver24.htm | 85 - dist/ntp/html/driver26.htm | 109 - dist/ntp/html/driver27.htm | 634 - dist/ntp/html/driver28.htm | 133 - dist/ntp/html/driver29.htm | 1251 - dist/ntp/html/driver3.htm | 131 - dist/ntp/html/driver30.htm | 158 - dist/ntp/html/driver32.htm | 42 - dist/ntp/html/driver33.htm | 38 - dist/ntp/html/driver34.htm | 54 - dist/ntp/html/driver35.htm | 82 - dist/ntp/html/driver36.htm | 844 - dist/ntp/html/driver37.htm | 75 - dist/ntp/html/driver4.htm | 126 - dist/ntp/html/driver5.htm | 159 - dist/ntp/html/driver6.htm | 242 - dist/ntp/html/driver7.htm | 596 - dist/ntp/html/driver8.htm | 334 - dist/ntp/html/driver9.htm | 123 - dist/ntp/html/exec.htm | 284 - dist/ntp/html/extern.htm | 40 - dist/ntp/html/gadget.htm | 107 - dist/ntp/html/genkeys.htm | 152 - dist/ntp/html/hints.htm | 26 - dist/ntp/html/hints/a-ux | 195 - dist/ntp/html/hints/aix | 76 - dist/ntp/html/hints/bsdi | 65 - dist/ntp/html/hints/changes | 13 - dist/ntp/html/hints/decosf1 | 40 - dist/ntp/html/hints/decosf2 | 54 - dist/ntp/html/hints/freebsd | 15 - dist/ntp/html/hints/hpux | 158 - dist/ntp/html/hints/linux | 5 - dist/ntp/html/hints/notes-xntp-v3 | 119 - dist/ntp/html/hints/parse | 105 - dist/ntp/html/hints/refclocks | 35 - dist/ntp/html/hints/rs6000 | 56 - dist/ntp/html/hints/sco.htm | 39 - dist/ntp/html/hints/sgi | 74 - dist/ntp/html/hints/solaris-dosynctodr.html | 320 - dist/ntp/html/hints/solaris.html | 143 - dist/ntp/html/hints/solaris.xtra.4023118 | 36 - dist/ntp/html/hints/solaris.xtra.4095849 | 74 - dist/ntp/html/hints/solaris.xtra.S99ntpd | 21 - dist/ntp/html/hints/solaris.xtra.patchfreq | 85 - dist/ntp/html/hints/sun4 | 15 - dist/ntp/html/hints/svr4-dell | 8 - dist/ntp/html/hints/svr4_package | 33 - dist/ntp/html/hints/todo | 4 - dist/ntp/html/hints/vxworks.html | 18 - dist/ntp/html/hints/winnt.htm | 322 - dist/ntp/html/howto.htm | 315 - dist/ntp/html/htmlprimer.htm | 1198 - dist/ntp/html/index.htm | 197 - dist/ntp/html/kern.htm | 51 - dist/ntp/html/kernpps.htm | 26 - dist/ntp/html/ldisc.htm | 161 - dist/ntp/html/measure.htm | 50 - dist/ntp/html/miscopt.htm | 167 - dist/ntp/html/monopt.htm | 250 - dist/ntp/html/mx4200data.htm | 443 - dist/ntp/html/notes.htm | 1543 -- dist/ntp/html/ntpd.htm | 190 - dist/ntp/html/ntpdate.htm | 185 - dist/ntp/html/ntpdc.htm | 620 - dist/ntp/html/ntpq.htm | 747 - dist/ntp/html/ntptime.htm | 96 - dist/ntp/html/ntptrace.htm | 82 - dist/ntp/html/parsedata.htm | 407 - dist/ntp/html/parsenew.htm | 237 - dist/ntp/html/patches.htm | 67 - dist/ntp/html/porting.htm | 78 - dist/ntp/html/pps.htm | 84 - dist/ntp/html/prefer.htm | 332 - dist/ntp/html/qth.htm | 64 - dist/ntp/html/quick.htm | 86 - dist/ntp/html/rdebug.htm | 67 - dist/ntp/html/refclock.htm | 142 - dist/ntp/html/release.htm | 200 - dist/ntp/html/tickadj.htm | 90 - dist/ntp/html/vxworks.htm | 153 - dist/ntp/html/y2k.htm | 132 - dist/ntp/include/adjtime.h | 2 +- dist/ntp/include/ascii.h | 2 +- dist/ntp/include/audio.h | 2 +- dist/ntp/include/binio.h | 2 +- dist/ntp/include/global.h | 2 +- dist/ntp/include/gps.h | 2 +- dist/ntp/include/hopf6039.h | 2 +- dist/ntp/include/icom.h | 2 +- dist/ntp/include/ieee754io.h | 2 +- dist/ntp/include/iosignal.h | 2 +- dist/ntp/include/isc/app.h | 2 +- dist/ntp/include/isc/assertions.h | 2 +- dist/ntp/include/isc/boolean.h | 2 +- dist/ntp/include/isc/error.h | 2 +- dist/ntp/include/isc/formatcheck.h | 2 +- dist/ntp/include/isc/int.h | 2 +- dist/ntp/include/isc/interfaceiter.h | 2 +- dist/ntp/include/isc/ipv6.h | 2 +- dist/ntp/include/isc/lang.h | 2 +- dist/ntp/include/isc/lib.h | 2 +- dist/ntp/include/isc/list.h | 2 +- dist/ntp/include/isc/magic.h | 2 +- dist/ntp/include/isc/mem.h | 2 +- dist/ntp/include/isc/msgcat.h | 2 +- dist/ntp/include/isc/msgs.h | 2 +- dist/ntp/include/isc/mutex.h | 2 +- dist/ntp/include/isc/net.h | 2 +- dist/ntp/include/isc/netaddr.h | 2 +- dist/ntp/include/isc/offset.h | 2 +- dist/ntp/include/isc/once.h | 2 +- dist/ntp/include/isc/platform.h | 2 +- dist/ntp/include/isc/print.h | 2 +- dist/ntp/include/isc/result.h | 2 +- dist/ntp/include/isc/sockaddr.h | 2 +- dist/ntp/include/isc/strerror.h | 2 +- dist/ntp/include/isc/string.h | 2 +- dist/ntp/include/isc/types.h | 2 +- dist/ntp/include/isc/util.h | 2 +- dist/ntp/include/l_stdlib.h | 2 +- dist/ntp/include/mbg_gps166.h | 2 +- dist/ntp/include/md5.h | 53 - dist/ntp/include/mx4200.h | 2 +- dist/ntp/include/ntif.h | 2 +- dist/ntp/include/ntp.h | 2 +- dist/ntp/include/ntp_calendar.h | 2 +- dist/ntp/include/ntp_cmdargs.h | 2 +- dist/ntp/include/ntp_config.h | 2 +- dist/ntp/include/ntp_control.h | 2 +- dist/ntp/include/ntp_crypto.h | 2 +- dist/ntp/include/ntp_datum.h | 2 +- dist/ntp/include/ntp_filegen.h | 2 +- dist/ntp/include/ntp_fp.h | 2 +- dist/ntp/include/ntp_if.h | 2 +- dist/ntp/include/ntp_io.h | 2 +- dist/ntp/include/ntp_machine.h | 2 +- dist/ntp/include/ntp_malloc.h | 2 +- dist/ntp/include/ntp_md5.h | 2 +- dist/ntp/include/ntp_proto.h | 2 +- dist/ntp/include/ntp_refclock.h | 2 +- dist/ntp/include/ntp_request.h | 2 +- dist/ntp/include/ntp_rfc2553.h | 2 +- dist/ntp/include/ntp_select.h | 2 +- dist/ntp/include/ntp_sprintf.h | 2 +- dist/ntp/include/ntp_stdlib.h | 2 +- dist/ntp/include/ntp_string.h | 2 +- dist/ntp/include/ntp_syscall.h | 2 +- dist/ntp/include/ntp_syslog.h | 2 +- dist/ntp/include/ntp_tty.h | 2 +- dist/ntp/include/ntp_types.h | 2 +- dist/ntp/include/ntp_unixtime.h | 2 +- dist/ntp/include/ntpd.h | 156 +- dist/ntp/include/ntpsim.h | 2 +- dist/ntp/include/parse.h | 2 +- dist/ntp/include/parse_conf.h | 2 +- dist/ntp/include/recvbuff.h | 2 +- dist/ntp/include/rsa_md5.h | 2 +- dist/ntp/include/trimble.h | 2 +- dist/ntp/kernel/chuinit.c | 2 +- dist/ntp/kernel/clkinit.c | 2 +- dist/ntp/kernel/sys/bsd_audioirig.h | 2 +- dist/ntp/kernel/sys/chudefs.h | 2 +- dist/ntp/kernel/sys/clkdefs.h | 2 +- dist/ntp/kernel/sys/i8253.h | 2 +- dist/ntp/kernel/sys/parsestreams.h | 2 +- dist/ntp/kernel/sys/pcl720.h | 2 +- dist/ntp/kernel/sys/ppsclock.h | 2 +- dist/ntp/kernel/sys/timex.h | 2 +- dist/ntp/kernel/sys/tpro.h | 2 +- dist/ntp/kernel/sys/tt560_api.h | 2 +- dist/ntp/kernel/tty_chu.c | 4 +- dist/ntp/kernel/tty_chu_STREAMS.c | 2 +- dist/ntp/kernel/tty_clk.c | 4 +- dist/ntp/kernel/tty_clk_STREAMS.c | 2 +- dist/ntp/libisc/assertions.c | 2 +- dist/ntp/libisc/error.c | 2 +- dist/ntp/libisc/ifiter_ioctl.c | 2 +- dist/ntp/libisc/ifiter_sysctl.c | 2 +- dist/ntp/libisc/inet_ntop.c | 2 +- dist/ntp/libisc/interfaceiter.c | 2 +- dist/ntp/libisc/isc_strerror.c | 2 +- dist/ntp/libisc/lib.c | 2 +- dist/ntp/libisc/mem.c | 2 +- dist/ntp/libisc/msgcat.c | 2 +- dist/ntp/libisc/net.c | 2 +- dist/ntp/libisc/strerror.c | 2 +- dist/ntp/libntp/a_md5encrypt.c | 2 +- dist/ntp/libntp/adjtime.c | 2 +- dist/ntp/libntp/adjtimex.c | 4 +- dist/ntp/libntp/atoint.c | 2 +- dist/ntp/libntp/atolfp.c | 2 +- dist/ntp/libntp/atouint.c | 2 +- dist/ntp/libntp/audio.c | 477 +- dist/ntp/libntp/authencrypt.c | 99 - dist/ntp/libntp/authkeys.c | 2 +- dist/ntp/libntp/authparity.c | 66 - dist/ntp/libntp/authreadkeys.c | 2 +- dist/ntp/libntp/authusekey.c | 2 +- dist/ntp/libntp/binio.c | 2 +- dist/ntp/libntp/buftvtots.c | 2 +- dist/ntp/libntp/caljulian.c | 2 +- dist/ntp/libntp/calleapwhen.c | 2 +- dist/ntp/libntp/caltontp.c | 2 +- dist/ntp/libntp/calyearstart.c | 2 +- dist/ntp/libntp/clocktime.c | 2 +- dist/ntp/libntp/clocktypes.c | 2 +- dist/ntp/libntp/decodenetnum.c | 2 +- dist/ntp/libntp/dofptoa.c | 2 +- dist/ntp/libntp/dolfptoa.c | 2 +- dist/ntp/libntp/emalloc.c | 2 +- dist/ntp/libntp/findconfig.c | 2 +- dist/ntp/libntp/fptoa.c | 2 +- dist/ntp/libntp/fptoms.c | 2 +- dist/ntp/libntp/getopt.c | 2 +- dist/ntp/libntp/gpstolfp.c | 4 +- dist/ntp/libntp/hextoint.c | 2 +- dist/ntp/libntp/hextolfp.c | 2 +- dist/ntp/libntp/humandate.c | 2 +- dist/ntp/libntp/icom.c | 2 +- dist/ntp/libntp/ieee754io.c | 2 +- dist/ntp/libntp/inttoa.c | 2 +- dist/ntp/libntp/iosignal.c | 2 +- dist/ntp/libntp/lib_strbuf.c | 2 +- dist/ntp/libntp/lib_strbuf.h | 2 +- dist/ntp/libntp/log.c | 2 +- dist/ntp/libntp/log.h | 2 +- dist/ntp/libntp/machines.c | 2 +- dist/ntp/libntp/md5c.c | 2 +- dist/ntp/libntp/memmove.c | 16 +- dist/ntp/libntp/mfp_mul.c | 2 +- dist/ntp/libntp/mfptoa.c | 2 +- dist/ntp/libntp/mfptoms.c | 2 +- dist/ntp/libntp/mktime.c | 60 +- dist/ntp/libntp/modetoa.c | 2 +- dist/ntp/libntp/mstolfp.c | 2 +- dist/ntp/libntp/msutotsf.c | 2 +- dist/ntp/libntp/msyslog.c | 246 +- dist/ntp/libntp/netof.c | 2 +- dist/ntp/libntp/ntp_rfc2553.c | 2 +- dist/ntp/libntp/numtoa.c | 2 +- dist/ntp/libntp/numtohost.c | 2 +- dist/ntp/libntp/octtoint.c | 2 +- dist/ntp/libntp/prettydate.c | 2 +- dist/ntp/libntp/random.c | 8 +- dist/ntp/libntp/ranny.c | 2 +- dist/ntp/libntp/recvbuff.c | 2 +- dist/ntp/libntp/refnumtoa.c | 2 +- dist/ntp/libntp/snprintf.c | 2 +- dist/ntp/libntp/socktoa.c | 2 +- dist/ntp/libntp/socktohost.c | 2 +- dist/ntp/libntp/statestr.c | 2 +- dist/ntp/libntp/strdup.c | 2 +- dist/ntp/libntp/strerror.c | 2 +- dist/ntp/libntp/strstr.c | 4 +- dist/ntp/libntp/syssignal.c | 2 +- dist/ntp/libntp/systime.c | 402 +- dist/ntp/libntp/systime_s.c | 2 +- dist/ntp/libntp/tsftomsu.c | 2 +- dist/ntp/libntp/tstotv.c | 2 +- dist/ntp/libntp/tvtoa.c | 2 +- dist/ntp/libntp/tvtots.c | 2 +- dist/ntp/libntp/uglydate.c | 2 +- dist/ntp/libntp/uinttoa.c | 2 +- dist/ntp/libntp/utvtoa.c | 2 +- dist/ntp/libntp/ymd2yd.c | 2 +- dist/ntp/libparse/clk_computime.c | 8 +- dist/ntp/libparse/clk_dcf7000.c | 7 +- dist/ntp/libparse/clk_hopf6021.c | 7 +- dist/ntp/libparse/clk_meinberg.c | 9 +- dist/ntp/libparse/clk_rawdcf.c | 7 +- dist/ntp/libparse/clk_rcc8000.c | 7 +- dist/ntp/libparse/clk_schmid.c | 7 +- dist/ntp/libparse/clk_trimtaip.c | 6 +- dist/ntp/libparse/clk_trimtsip.c | 2 +- dist/ntp/libparse/clk_varitext.c | 29 +- dist/ntp/libparse/clk_wharton.c | 4 +- dist/ntp/libparse/data_mbg.c | 2 +- dist/ntp/libparse/info_trimble.c | 2 +- dist/ntp/libparse/parse.c | 2 +- dist/ntp/libparse/parse_conf.c | 2 +- dist/ntp/libparse/parsesolaris.c | 2 +- dist/ntp/libparse/parsestreams.c | 2 +- dist/ntp/libparse/trim_info.c | 2 +- dist/ntp/librsaref/Makefile.am | 57 - dist/ntp/librsaref/Makefile.in | 389 - dist/ntp/ntp_update | 68 - dist/ntp/ntpd/check_y2k.c | 2 +- dist/ntp/ntpd/cmd_args.c | 2 +- dist/ntp/ntpd/jupiter.h | 4 +- dist/ntp/ntpd/map_vme.c | 2 +- dist/ntp/ntpd/ntp_config.c | 1469 +- dist/ntp/ntpd/ntp_control.c | 526 +- dist/ntp/ntpd/ntp_crypto.c | 4538 +++- dist/ntp/ntpd/ntp_filegen.c | 2 +- dist/ntp/ntpd/ntp_intres.c | 158 +- dist/ntp/ntpd/ntp_io.c | 2090 +- dist/ntp/ntpd/ntp_loopfilter.c | 828 +- dist/ntp/ntpd/ntp_monitor.c | 2 +- dist/ntp/ntpd/ntp_peer.c | 2 +- dist/ntp/ntpd/ntp_proto.c | 2 +- dist/ntp/ntpd/ntp_refclock.c | 2 +- dist/ntp/ntpd/ntp_request.c | 1203 +- dist/ntp/ntpd/ntp_resolver.c | 991 - dist/ntp/ntpd/ntp_restrict.c | 2 +- dist/ntp/ntpd/ntp_timer.c | 2 +- dist/ntp/ntpd/ntp_util.c | 435 +- dist/ntp/ntpd/ntpd.c | 293 +- dist/ntp/ntpd/ntpsim.c | 2 +- dist/ntp/ntpd/refclock_acts.c | 2 +- dist/ntp/ntpd/refclock_arbiter.c | 2 +- dist/ntp/ntpd/refclock_arc.c | 2 +- dist/ntp/ntpd/refclock_as2201.c | 2 +- dist/ntp/ntpd/refclock_atom.c | 2 +- dist/ntp/ntpd/refclock_bancomm.c | 2 +- dist/ntp/ntpd/refclock_chronolog.c | 2 +- dist/ntp/ntpd/refclock_chu.c | 663 +- dist/ntp/ntpd/refclock_conf.c | 2 +- dist/ntp/ntpd/refclock_datum.c | 2 +- dist/ntp/ntpd/refclock_dumbclock.c | 2 +- dist/ntp/ntpd/refclock_fg.c | 14 +- dist/ntp/ntpd/refclock_gpsvme.c | 2 +- dist/ntp/ntpd/refclock_heath.c | 2 +- dist/ntp/ntpd/refclock_hopfpci.c | 2 +- dist/ntp/ntpd/refclock_hopfser.c | 2 +- dist/ntp/ntpd/refclock_hpgps.c | 2 +- dist/ntp/ntpd/refclock_irig.c | 2 +- dist/ntp/ntpd/refclock_jjy.c | 2 +- dist/ntp/ntpd/refclock_jupiter.c | 2 +- dist/ntp/ntpd/refclock_leitch.c | 2 +- dist/ntp/ntpd/refclock_local.c | 2 +- dist/ntp/ntpd/refclock_msfees.c | 2 +- dist/ntp/ntpd/refclock_mx4200.c | 2 +- dist/ntp/ntpd/refclock_neoclock4x.c | 2 +- dist/ntp/ntpd/refclock_nmea.c | 2 +- dist/ntp/ntpd/refclock_oncore.c | 3874 ++- dist/ntp/ntpd/refclock_palisade.c | 2 +- dist/ntp/ntpd/refclock_palisade.h | 2 +- dist/ntp/ntpd/refclock_parse.c | 74 +- dist/ntp/ntpd/refclock_pcf.c | 2 +- dist/ntp/ntpd/refclock_pst.c | 2 +- dist/ntp/ntpd/refclock_ptbacts.c | 2 +- dist/ntp/ntpd/refclock_ripencc.c | 2 +- dist/ntp/ntpd/refclock_shm.c | 2 +- dist/ntp/ntpd/refclock_tpro.c | 2 +- dist/ntp/ntpd/refclock_trak.c | 2 +- dist/ntp/ntpd/refclock_true.c | 81 +- dist/ntp/ntpd/refclock_tt560.c | 2 +- dist/ntp/ntpd/refclock_ulink.c | 2 +- dist/ntp/ntpd/refclock_usno.c | 2 +- dist/ntp/ntpd/refclock_wwv.c | 2166 +- dist/ntp/ntpd/refclock_wwvb.c | 2 +- dist/ntp/ntpd/refclock_zyfer.c | 2 +- dist/ntp/ntpdate/ntpdate.c | 452 +- dist/ntp/ntpdate/ntpdate.h | 11 +- dist/ntp/ntpdate/ntptime_config.c | 2 +- dist/ntp/ntpdate/ntptimeset.c | 66 +- dist/ntp/ntpdc/nl_in.c | 2 +- dist/ntp/ntpdc/ntpdc-layout.c | 2 +- dist/ntp/ntpdc/ntpdc.c | 532 +- dist/ntp/ntpdc/ntpdc.h | 2 +- dist/ntp/ntpdc/ntpdc_ops.c | 1021 +- dist/ntp/ntpq/ntpq.c | 518 +- dist/ntp/ntpq/ntpq.h | 2 +- dist/ntp/ntpq/ntpq_ops.c | 221 +- dist/ntp/ntptrace/Makefile.am | 19 - dist/ntp/ntptrace/Makefile.in | 374 - dist/ntp/ntptrace/README | 7 - dist/ntp/ntptrace/ntptrace.c | 796 - dist/ntp/ntptrace/ntptrace.h | 38 - dist/ntp/parseutil/dcfd.c | 2 +- dist/ntp/parseutil/testdcf.c | 2 +- dist/ntp/scripts/ntpsweep.in | 2 +- dist/ntp/scripts/plot_summary.in | 2 +- dist/ntp/scripts/summary.in | 2 +- dist/ntp/sntp/header.h | 2 +- dist/ntp/sntp/internet.c | 2 +- dist/ntp/sntp/internet.h | 2 +- dist/ntp/sntp/kludges.h | 2 +- dist/ntp/sntp/main.c | 2 +- dist/ntp/sntp/socket.c | 2 +- dist/ntp/sntp/timing.c | 2 +- dist/ntp/sntp/unix.c | 2 +- dist/ntp/stamp-h.in | 1 - dist/ntp/util/ansi2knr.c | 2 +- dist/ntp/util/audio-pcm.c | 2 +- dist/ntp/util/byteorder.c | 2 +- dist/ntp/util/hist.c | 2 +- dist/ntp/util/jitter.c | 2 +- dist/ntp/util/kern.c | 2 +- dist/ntp/util/longsize.c | 2 +- dist/ntp/util/ntp-keygen.c | 2 +- dist/ntp/util/ntp_genkeys.c | 240 - dist/ntp/util/ntptime.c | 2 +- dist/ntp/util/pps-api.c | 2 +- dist/ntp/util/precision.c | 2 +- dist/ntp/util/sht.c | 2 +- dist/ntp/util/testrs6000.c | 2 +- dist/ntp/util/tickadj.c | 18 +- dist/ntp/util/timetrim.c | 2 +- 445 files changed, 36833 insertions(+), 39400 deletions(-) delete mode 100644 dist/ntp/README.cvs delete mode 100644 dist/ntp/README.des delete mode 100644 dist/ntp/README.rsa delete mode 100644 dist/ntp/acconfig.h delete mode 100644 dist/ntp/conf/dewey.conf delete mode 100644 dist/ntp/html/Oncore-SHMEM.htm delete mode 100644 dist/ntp/html/accopt.htm delete mode 100644 dist/ntp/html/assoc.htm delete mode 100644 dist/ntp/html/audio.htm delete mode 100644 dist/ntp/html/authopt.htm delete mode 100644 dist/ntp/html/biblio.htm delete mode 100644 dist/ntp/html/build.htm delete mode 100644 dist/ntp/html/clockopt.htm delete mode 100644 dist/ntp/html/config.htm delete mode 100644 dist/ntp/html/confopt.htm delete mode 100644 dist/ntp/html/copyright.htm delete mode 100644 dist/ntp/html/debug.htm delete mode 100644 dist/ntp/html/driver1.htm delete mode 100644 dist/ntp/html/driver10.htm delete mode 100644 dist/ntp/html/driver11.htm delete mode 100644 dist/ntp/html/driver12.htm delete mode 100644 dist/ntp/html/driver16.htm delete mode 100644 dist/ntp/html/driver18.htm delete mode 100644 dist/ntp/html/driver19.htm delete mode 100644 dist/ntp/html/driver2.htm delete mode 100644 dist/ntp/html/driver20.htm delete mode 100644 dist/ntp/html/driver22.htm delete mode 100644 dist/ntp/html/driver23.htm delete mode 100644 dist/ntp/html/driver24.htm delete mode 100644 dist/ntp/html/driver26.htm delete mode 100644 dist/ntp/html/driver27.htm delete mode 100644 dist/ntp/html/driver28.htm delete mode 100644 dist/ntp/html/driver29.htm delete mode 100644 dist/ntp/html/driver3.htm delete mode 100644 dist/ntp/html/driver30.htm delete mode 100644 dist/ntp/html/driver32.htm delete mode 100644 dist/ntp/html/driver33.htm delete mode 100644 dist/ntp/html/driver34.htm delete mode 100644 dist/ntp/html/driver35.htm delete mode 100644 dist/ntp/html/driver36.htm delete mode 100644 dist/ntp/html/driver37.htm delete mode 100644 dist/ntp/html/driver4.htm delete mode 100644 dist/ntp/html/driver5.htm delete mode 100644 dist/ntp/html/driver6.htm delete mode 100644 dist/ntp/html/driver7.htm delete mode 100644 dist/ntp/html/driver8.htm delete mode 100644 dist/ntp/html/driver9.htm delete mode 100644 dist/ntp/html/exec.htm delete mode 100644 dist/ntp/html/extern.htm delete mode 100644 dist/ntp/html/gadget.htm delete mode 100644 dist/ntp/html/genkeys.htm delete mode 100644 dist/ntp/html/hints.htm delete mode 100644 dist/ntp/html/hints/a-ux delete mode 100644 dist/ntp/html/hints/aix delete mode 100644 dist/ntp/html/hints/bsdi delete mode 100644 dist/ntp/html/hints/changes delete mode 100644 dist/ntp/html/hints/decosf1 delete mode 100644 dist/ntp/html/hints/decosf2 delete mode 100644 dist/ntp/html/hints/freebsd delete mode 100644 dist/ntp/html/hints/hpux delete mode 100644 dist/ntp/html/hints/linux delete mode 100644 dist/ntp/html/hints/notes-xntp-v3 delete mode 100644 dist/ntp/html/hints/parse delete mode 100644 dist/ntp/html/hints/refclocks delete mode 100644 dist/ntp/html/hints/rs6000 delete mode 100644 dist/ntp/html/hints/sco.htm delete mode 100644 dist/ntp/html/hints/sgi delete mode 100644 dist/ntp/html/hints/solaris-dosynctodr.html delete mode 100644 dist/ntp/html/hints/solaris.html delete mode 100644 dist/ntp/html/hints/solaris.xtra.4023118 delete mode 100644 dist/ntp/html/hints/solaris.xtra.4095849 delete mode 100644 dist/ntp/html/hints/solaris.xtra.S99ntpd delete mode 100644 dist/ntp/html/hints/solaris.xtra.patchfreq delete mode 100644 dist/ntp/html/hints/sun4 delete mode 100644 dist/ntp/html/hints/svr4-dell delete mode 100644 dist/ntp/html/hints/svr4_package delete mode 100644 dist/ntp/html/hints/todo delete mode 100644 dist/ntp/html/hints/vxworks.html delete mode 100644 dist/ntp/html/hints/winnt.htm delete mode 100644 dist/ntp/html/howto.htm delete mode 100644 dist/ntp/html/htmlprimer.htm delete mode 100644 dist/ntp/html/index.htm delete mode 100644 dist/ntp/html/kern.htm delete mode 100644 dist/ntp/html/kernpps.htm delete mode 100644 dist/ntp/html/ldisc.htm delete mode 100644 dist/ntp/html/measure.htm delete mode 100644 dist/ntp/html/miscopt.htm delete mode 100644 dist/ntp/html/monopt.htm delete mode 100644 dist/ntp/html/mx4200data.htm delete mode 100644 dist/ntp/html/notes.htm delete mode 100644 dist/ntp/html/ntpd.htm delete mode 100644 dist/ntp/html/ntpdate.htm delete mode 100644 dist/ntp/html/ntpdc.htm delete mode 100644 dist/ntp/html/ntpq.htm delete mode 100644 dist/ntp/html/ntptime.htm delete mode 100644 dist/ntp/html/ntptrace.htm delete mode 100644 dist/ntp/html/parsedata.htm delete mode 100644 dist/ntp/html/parsenew.htm delete mode 100644 dist/ntp/html/patches.htm delete mode 100644 dist/ntp/html/porting.htm delete mode 100644 dist/ntp/html/pps.htm delete mode 100644 dist/ntp/html/prefer.htm delete mode 100644 dist/ntp/html/qth.htm delete mode 100644 dist/ntp/html/quick.htm delete mode 100644 dist/ntp/html/rdebug.htm delete mode 100644 dist/ntp/html/refclock.htm delete mode 100644 dist/ntp/html/release.htm delete mode 100644 dist/ntp/html/tickadj.htm delete mode 100644 dist/ntp/html/vxworks.htm delete mode 100644 dist/ntp/html/y2k.htm delete mode 100644 dist/ntp/include/md5.h delete mode 100644 dist/ntp/libntp/authencrypt.c delete mode 100644 dist/ntp/libntp/authparity.c delete mode 100644 dist/ntp/librsaref/Makefile.am delete mode 100644 dist/ntp/librsaref/Makefile.in delete mode 100755 dist/ntp/ntp_update delete mode 100644 dist/ntp/ntpd/ntp_resolver.c delete mode 100644 dist/ntp/ntptrace/Makefile.am delete mode 100644 dist/ntp/ntptrace/Makefile.in delete mode 100644 dist/ntp/ntptrace/README delete mode 100644 dist/ntp/ntptrace/ntptrace.c delete mode 100644 dist/ntp/ntptrace/ntptrace.h delete mode 100644 dist/ntp/stamp-h.in delete mode 100644 dist/ntp/util/ntp_genkeys.c diff --git a/dist/ntp/ElectricFence/efence.c b/dist/ntp/ElectricFence/efence.c index 17367224dcc2..2c2999287c8f 100644 --- a/dist/ntp/ElectricFence/efence.c +++ b/dist/ntp/ElectricFence/efence.c @@ -1,4 +1,4 @@ -/* $NetBSD: efence.c,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: efence.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* * Electric Fence - Red-Zone memory allocator. diff --git a/dist/ntp/ElectricFence/efence.h b/dist/ntp/ElectricFence/efence.h index c063d279fc76..d8156aeeda15 100644 --- a/dist/ntp/ElectricFence/efence.h +++ b/dist/ntp/ElectricFence/efence.h @@ -1,4 +1,4 @@ -/* $NetBSD: efence.h,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: efence.h,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ #include #include diff --git a/dist/ntp/ElectricFence/eftest.c b/dist/ntp/ElectricFence/eftest.c index c84dc27f454b..474c868c9487 100644 --- a/dist/ntp/ElectricFence/eftest.c +++ b/dist/ntp/ElectricFence/eftest.c @@ -1,4 +1,4 @@ -/* $NetBSD: eftest.c,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: eftest.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ #include #include diff --git a/dist/ntp/ElectricFence/page.c b/dist/ntp/ElectricFence/page.c index b5e13f558f3f..adcb5e5f12fe 100644 --- a/dist/ntp/ElectricFence/page.c +++ b/dist/ntp/ElectricFence/page.c @@ -1,4 +1,4 @@ -/* $NetBSD: page.c,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: page.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ #ifdef HAVE_CONFIG_H # include diff --git a/dist/ntp/ElectricFence/print.c b/dist/ntp/ElectricFence/print.c index 0513db816329..fbfaa76d8ff6 100644 --- a/dist/ntp/ElectricFence/print.c +++ b/dist/ntp/ElectricFence/print.c @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: print.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ #include "efence.h" #include diff --git a/dist/ntp/ElectricFence/tstheap.c b/dist/ntp/ElectricFence/tstheap.c index 684ffba5d563..47688b072ffe 100644 --- a/dist/ntp/ElectricFence/tstheap.c +++ b/dist/ntp/ElectricFence/tstheap.c @@ -1,4 +1,4 @@ -/* $NetBSD: tstheap.c,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: tstheap.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ #include #include diff --git a/dist/ntp/README.cvs b/dist/ntp/README.cvs deleted file mode 100644 index b9f352a7179b..000000000000 --- a/dist/ntp/README.cvs +++ /dev/null @@ -1,24 +0,0 @@ -To get the NTP distribution via anonymous CVS: - - 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 - -after which the "ntp_update" script in the top-level of the tree should -keep things in synch and properly timestamped. - -There are some mailing lists for the NTP CVS distribution. For more -information, send a message to with the "lists" in -the body of the message. - -If you get NTP via CVS, you will 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. diff --git a/dist/ntp/README.des b/dist/ntp/README.des deleted file mode 100644 index 88f0aea0667b..000000000000 --- a/dist/ntp/README.des +++ /dev/null @@ -1,16 +0,0 @@ -If you want DES support in ntp: - -- Use MD5 instead: -- - convert your DES keys to MD5 by changing the 'A', 'N' or 'S' to 'M' - -If you *need* DES support: - -- first see if you can simply "want" DES support instead -- Follow the instructions in README.rsa - -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". - -Dave would prefer that new/alternative encryption schemes follow the -RSA API. diff --git a/dist/ntp/README.rsa b/dist/ntp/README.rsa deleted file mode 100644 index 54613602b57d..000000000000 --- a/dist/ntp/README.rsa +++ /dev/null @@ -1,62 +0,0 @@ -If you want to use the RSA stuff for crypto keys: - -- 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) - -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); diff --git a/dist/ntp/acconfig.h b/dist/ntp/acconfig.h deleted file mode 100644 index 29a6360458c8..000000000000 --- a/dist/ntp/acconfig.h +++ /dev/null @@ -1,476 +0,0 @@ -/* $NetBSD: acconfig.h,v 1.1.1.1 2000/03/29 12:38:44 simonb Exp $ */ - -/* Package */ -#undef PACKAGE - -/* Version */ -#undef VERSION - -/* debugging code */ -#undef DEBUG - -/* Minutes per DST adjustment */ -#undef DSTMINUTES - -/* MD5 authentication */ -#undef MD5 - -/* DES authentication (COCOM only) */ -#undef DES - -/* time_t */ -#undef time_t - -/* reference clock interface */ -#undef REFCLOCK - -/* Audio CHU? */ -#undef AUDIO_CHU - -/* PARSE kernel PLL PPS support */ -#undef PPS_SYNC - -/* ACTS modem service */ -#undef CLOCK_ACTS - -/* Arbiter 1088A/B GPS receiver */ -#undef CLOCK_ARBITER - -/* DHD19970505: ARCRON support. */ -#undef CLOCK_ARCRON_MSF - -/* Austron 2200A/2201A GPS receiver */ -#undef CLOCK_AS2201 - -/* PPS interface */ -#undef CLOCK_ATOM - -/* PPS auxiliary interface for ATOM */ -#undef PPS_SAMPLE - -/* Datum/Bancomm bc635/VME interface */ -#undef CLOCK_BANC - -/* Diems Computime Radio Clock */ -#undef CLOCK_COMPUTIME - -/* Chronolog K-series WWVB receiver */ -#undef CLOCK_CHRONOLOG - -/* Datum Programmable Time System */ -#undef CLOCK_DATUM - -/* ELV/DCF7000 clock */ -#undef CLOCK_DCF7000 - -/* Dumb generic hh:mm:ss local clock */ -#undef CLOCK_DUMBCLOCK - -/* Forum Graphic GPS datating station driver */ -#undef CLOCK_FG - -/* TrueTime GPS receiver/VME interface */ -#undef CLOCK_GPSVME - -/* Heath GC-1000 WWV/WWVH receiver */ -#undef CLOCK_HEATH - -/* HOPF 6021 clock */ -#undef CLOCK_HOPF6021 - -/* HP 58503A GPS receiver */ -#undef CLOCK_HPGPS - -/* Sun IRIG audio decoder */ -#undef CLOCK_IRIG - -/* Rockwell Jupiter GPS clock */ -#undef CLOCK_JUPITER - -/* Leitch CSD 5300 Master Clock System Driver */ -#undef CLOCK_LEITCH - -/* local clock reference */ -#undef CLOCK_LOCAL - -/* Meinberg clocks */ -#undef CLOCK_MEINBERG - -/* EES M201 MSF receiver */ -#undef CLOCK_MSFEES - -/* Magnavox MX4200 GPS receiver */ -#undef CLOCK_MX4200 - -/* NMEA GPS receiver */ -#undef CLOCK_NMEA - -/* Motorola UT Oncore GPS */ -#undef CLOCK_ONCORE - -/* Palisade clock */ -#undef CLOCK_PALISADE - -/* PARSE driver interface */ -#undef CLOCK_PARSE - -/* Conrad parallel port radio clock */ -#undef CLOCK_PCF - -/* PCL 720 clock support */ -#undef CLOCK_PPS720 - -/* PST/Traconex 1020 WWV/WWVH receiver */ -#undef CLOCK_PST - -/* PTB modem service */ -#undef CLOCK_PTBACTS - -/* DCF77 raw time code */ -#undef CLOCK_RAWDCF - -/* RCC 8000 clock */ -#undef CLOCK_RCC8000 - -/* Schmid DCF77 clock */ -#undef CLOCK_SCHMID - -/* clock thru shared memory */ -#undef CLOCK_SHM - -/* Spectracom 8170/Netclock/2 WWVB receiver */ -#undef CLOCK_SPECTRACOM - -/* KSI/Odetics TPRO/S GPS receiver/IRIG interface */ -#undef CLOCK_TPRO - -/* TRAK 8810 GPS receiver */ -#undef CLOCK_TRAK - -/* Trimble GPS receiver/TAIP protocol */ -#undef CLOCK_TRIMTAIP - -/* Trimble GPS receiver/TSIP protocol */ -#undef CLOCK_TRIMTSIP - -/* Kinemetrics/TrueTime receivers */ -#undef CLOCK_TRUETIME - -/* Ultralink M320 WWVB receiver */ -#undef CLOCK_ULINK - -/* USNO modem service */ -#undef CLOCK_USNO - -/* WHARTON 400A Series protocol */ -#undef CLOCK_WHARTON_400A - -/* WWV audio driver */ -#undef CLOCK_WWV - -/* VARITEXT protocol */ -#undef CLOCK_VARITEXT - -/* define if we need to declare int errno; */ -#undef DECL_ERRNO - -/* define if we may declare int h_errno; */ -#undef DECL_H_ERRNO - -/* define if it's OK to declare char *sys_errlist[]; */ -#undef CHAR_SYS_ERRLIST - -/* define if it's OK to declare int syscall P((int, struct timeval *, struct timeval *)); */ -#undef DECL_SYSCALL - -/* define if we have syscall is buggy (Solaris 2.4) */ -#undef SYSCALL_BUG - -/* Do we need extra room for SO_RCVBUF? (HPUX <8) */ -#undef NEED_RCVBUF_SLOP - -/* Should we open the broadcast socket? */ -#undef OPEN_BCAST_SOCKET - -/* Do we want the HPUX FindConfig()? */ -#undef NEED_HPUX_FINDCONFIG - -/* canonical system (cpu-vendor-os) string */ -#undef STR_SYSTEM - -/* define if NetInfo support is available */ -#undef HAVE_NETINFO - -/* define if [gs]ettimeofday() only takes 1 argument */ -#undef SYSV_TIMEOFDAY - -/* define if struct sockaddr has sa_len */ -#undef HAVE_SA_LEN_IN_STRUCT_SOCKADDR - -/* define if struct clockinfo has hz */ -#undef HAVE_HZ_IN_STRUCT_CLOCKINFO - -/* define if struct sigaction has sa_sigaction */ -#undef HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION - -/* define if struct clockinfo has tickadj */ -#undef HAVE_TICKADJ_IN_STRUCT_CLOCKINFO - -/* define if struct ntptimeval uses time.tv_nsec instead of time.tv_usec */ -#undef HAVE_TV_NSEC_IN_NTPTIMEVAL - -/* Does a system header defind struct ppsclockev? */ -#undef HAVE_STRUCT_PPSCLOCKEV - -/* define if function prototypes are OK */ -#undef HAVE_PROTOTYPES - -/* define if setpgrp takes 0 arguments */ -#undef HAVE_SETPGRP_0 - -/* hardwire a value for tick? */ -#undef PRESET_TICK - -/* hardwire a value for tickadj? */ -#undef PRESET_TICKADJ - -/* is adjtime() accurate? */ -#undef ADJTIME_IS_ACCURATE - -/* should we NOT read /dev/kmem? */ -#undef NOKMEM - -/* use UDP Wildcard Delivery? */ -#undef UDP_WILDCARD_DELIVERY - -/* always slew the clock? */ -#undef SLEWALWAYS - -/* step, then slew the clock? */ -#undef STEP_SLEW - -/* force ntpdate to step the clock if !defined(STEP_SLEW) ? */ -#undef FORCE_NTPDATE_STEP - -/* synch TODR hourly? */ -#undef DOSYNCTODR - -/* do we set process groups with -pid? */ -#undef UDP_BACKWARDS_SETOWN - -/* must we have a CTTY for fsetown? */ -#undef USE_FSETOWNCTTY - -/* can we use SIGIO for tcp and udp IO? */ -#undef HAVE_SIGNALED_IO - -/* can we use SIGPOLL for UDP? */ -#undef USE_UDP_SIGPOLL - -/* 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 - -/* do we have the ppsclock streams module? */ -#undef PPS - -/* do we have the tty_clk line discipline/streams module? */ -#undef TTYCLK - -/* does the kernel support precision time discipline? */ -#undef KERNEL_PLL - -/* does the kernel support multicasting IP? */ -#undef MCAST - -/* do we have ntp_{adj,get}time in libc? */ -#undef NTP_SYSCALLS_LIBC - -/* do we have ntp_{adj,get}time in the kernel? */ -#undef NTP_SYSCALLS_STD - -/* do we have STREAMS/TLI? (Can we replace this with HAVE_SYS_STROPTS_H? */ -#undef STREAMS_TLI - -/* 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 - -/* what is the name of TICK in the kernel? */ -#undef K_TICK_NAME - -/* Is K_TICK_NAME (nsec_per_tick, for example) in nanoseconds? */ -#undef TICK_NANO - -/* what is the name of TICKADJ in the kernel? */ -#undef K_TICKADJ_NAME - -/* Is K_TICKADJ_NAME (hrestime_adj, for example) in nanoseconds? */ -#undef TICKADJ_NANO - -/* what is (probably) the name of DOSYNCTODR in the kernel? */ -#undef K_DOSYNCTODR_NAME - -/* what is (probably) the name of NOPRINTF in the kernel? */ -#undef K_NOPRINTF_NAME - -/* do we need HPUX adjtime() library support? */ -#undef NEED_HPUX_ADJTIME - -/* Might nlist() values require an extra level of indirection (AIX)? */ -#undef NLIST_EXTRA_INDIRECTION - -/* Other needed NLIST stuff */ -#undef NLIST_STRUCT -#undef NLIST_NAME_UNION - -/* Should we recommend a minimum value for tickadj? */ -#undef MIN_REC_TICKADJ - -/* Is there a problem using PARENB and IGNPAR (IRIX)? */ -#undef NO_PARENB_IGNPAR - -/* Should we not IGNPAR (Linux)? */ -#undef RAWDCF_NO_IGNPAR - -/* Does the compiler like "volatile"? */ -#undef volatile - -/* Does qsort expect to work on "void *" stuff? */ -#undef QSORT_USES_VOID_P - -/* What is the fallback value for HZ? */ -#undef DEFAULT_HZ - -/* Do we need to override the system's idea of HZ? */ -#undef OVERRIDE_HZ - -/* Do we want the SCO clock hacks? */ -#undef SCO5_CLOCK - -/* Do we want the ReliantUNIX clock hacks? */ -#undef RELIANTUNIX_CLOCK - -/* Does the kernel have an FLL bug? */ -#undef KERNEL_FLL_BUG - -/* Define if you have the TIOCGPPSEV ioctl (Solaris) */ -#undef HAVE_TIOCGPPSEV - -/* Define if you have the TIOCSPPS ioctl (Solaris) */ -#undef HAVE_TIOCSPPS - -/* Define if you have the CIOGETEV ioctl (SunOS, Linux) */ -#undef HAVE_CIOGETEV - -/* 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 - -/* Do we need to #define _SVID3 when we #include ? */ -#undef TERMIOS_NEEDS__SVID3 - -/* Do we have support for SHMEM_STATUS? */ -#undef ONCORE_SHMEM_STATUS - -/***/ - -/* Which way should we declare... */ - -/* adjtime()? */ -#undef DECL_ADJTIME_0 - -/* bcopy()? */ -#undef DECL_BCOPY_0 - -/* bzero()? */ -#undef DECL_BZERO_0 - -/* cfset[io]speed()? */ -#undef DECL_CFSETISPEED_0 - -/* ioctl()? */ -#undef DECL_IOCTL_0 - -/* IPC? (bind, connect, recvfrom, sendto, setsockopt, socket) */ -#undef DECL_IPC_0 - -/* memmove()? */ -#undef DECL_MEMMOVE_0 - -/* memset()? */ -#undef DECL_MEMSET_0 - -/* mkstemp()? */ -#undef DECL_MKSTEMP_0 - -/* mktemp()? */ -#undef DECL_MKTEMP_0 - -/* mrand48()? */ -#undef DECL_MRAND48_0 - -/* nlist()? */ -#undef DECL_NLIST_0 - -/* plock()? */ -#undef DECL_PLOCK_0 - -/* rename()? */ -#undef DECL_RENAME_0 - -/* select()? */ -#undef DECL_SELECT_0 - -/* setitimer()? */ -#undef DECL_SETITIMER_0 - -/* setpriority()? */ -#undef DECL_SETPRIORITY_0 -#undef DECL_SETPRIORITY_1 - -/* sigvec()? */ -#undef DECL_SIGVEC_0 - -/* srand48()? */ -#undef DECL_SRAND48_0 - -/* stdio stuff? */ -#undef DECL_STDIO_0 - -/* stime()? */ -#undef DECL_STIME_0 -#undef DECL_STIME_1 - -/* strtol()? */ -#undef DECL_STRTOL_0 - -/* syslog() stuff? */ -#undef DECL_SYSLOG_0 - -/* time()? */ -#undef DECL_TIME_0 - -/* [gs]ettimeofday()? */ -#undef DECL_TIMEOFDAY_0 - -/* tolower()? */ -#undef DECL_TOLOWER_0 - -/* toupper()? */ -#undef DECL_TOUPPER_0 diff --git a/dist/ntp/adjtimed/adjtimed.c b/dist/ntp/adjtimed/adjtimed.c index ee0b54414c59..e2f21bc9e374 100644 --- a/dist/ntp/adjtimed/adjtimed.c +++ b/dist/ntp/adjtimed/adjtimed.c @@ -1,4 +1,4 @@ -/* $NetBSD: adjtimed.c,v 1.1.1.1 2000/03/29 12:38:45 simonb Exp $ */ +/* $NetBSD: adjtimed.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /*************************************************************************/ /* (c) Copyright Tai Jin, 1988. All Rights Reserved. */ diff --git a/dist/ntp/arlib/arlib.c b/dist/ntp/arlib/arlib.c index 8190a6e2e78c..f04257562bf3 100644 --- a/dist/ntp/arlib/arlib.c +++ b/dist/ntp/arlib/arlib.c @@ -1,4 +1,4 @@ -/* $NetBSD: arlib.c,v 1.1.1.1 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: arlib.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* * arlib.c (C)opyright 1993 Darren Reed. All rights reserved. diff --git a/dist/ntp/arlib/arlib.h b/dist/ntp/arlib/arlib.h index 0e5d75c00a69..61850e50c081 100644 --- a/dist/ntp/arlib/arlib.h +++ b/dist/ntp/arlib/arlib.h @@ -1,4 +1,4 @@ -/* $NetBSD: arlib.h,v 1.1.1.1 2003/12/04 16:05:20 drochner Exp $ */ +/* $NetBSD: arlib.h,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* * arlib.h (C)opyright 1992 Darren Reed. diff --git a/dist/ntp/arlib/arplib.h b/dist/ntp/arlib/arplib.h index d5f717542f8e..9788a5700c4c 100644 --- a/dist/ntp/arlib/arplib.h +++ b/dist/ntp/arlib/arplib.h @@ -1,4 +1,4 @@ -/* $NetBSD: arplib.h,v 1.1.1.1 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: arplib.h,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* * arplib.h (C)opyright 1992 Darren Reed. diff --git a/dist/ntp/arlib/sample.c b/dist/ntp/arlib/sample.c index 9ea2ec2cc8a3..b10cfb289db7 100644 --- a/dist/ntp/arlib/sample.c +++ b/dist/ntp/arlib/sample.c @@ -1,4 +1,4 @@ -/* $NetBSD: sample.c,v 1.1.1.1 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: sample.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ #include #include diff --git a/dist/ntp/clockstuff/chutest.c b/dist/ntp/clockstuff/chutest.c index b41c527682ff..df449a7ba659 100644 --- a/dist/ntp/clockstuff/chutest.c +++ b/dist/ntp/clockstuff/chutest.c @@ -1,4 +1,4 @@ -/* $NetBSD: chutest.c,v 1.1.1.1 2000/03/29 12:38:45 simonb Exp $ */ +/* $NetBSD: chutest.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* chutest.c,v 3.1 1993/07/06 01:05:21 jbj Exp * chutest - test the CHU clock diff --git a/dist/ntp/clockstuff/clktest.c b/dist/ntp/clockstuff/clktest.c index 18453e650572..e388cb73a1a7 100644 --- a/dist/ntp/clockstuff/clktest.c +++ b/dist/ntp/clockstuff/clktest.c @@ -1,4 +1,4 @@ -/* $NetBSD: clktest.c,v 1.1.1.1 2000/03/29 12:38:45 simonb Exp $ */ +/* $NetBSD: clktest.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* clktest.c,v 3.1 1993/07/06 01:05:23 jbj Exp * clktest - test the clock line discipline diff --git a/dist/ntp/clockstuff/propdelay.c b/dist/ntp/clockstuff/propdelay.c index 071088585089..d90116175caa 100644 --- a/dist/ntp/clockstuff/propdelay.c +++ b/dist/ntp/clockstuff/propdelay.c @@ -1,4 +1,4 @@ -/* $NetBSD: propdelay.c,v 1.1.1.1 2000/03/29 12:38:45 simonb Exp $ */ +/* $NetBSD: propdelay.c,v 1.2 2003/12/04 16:23:34 drochner Exp $ */ /* propdelay.c,v 3.1 1993/07/06 01:05:24 jbj Exp * propdelay - compute propagation delays diff --git a/dist/ntp/conf/dewey.conf b/dist/ntp/conf/dewey.conf deleted file mode 100644 index ea4f3d4f4844..000000000000 --- a/dist/ntp/conf/dewey.conf +++ /dev/null @@ -1,42 +0,0 @@ -# -# NTP configuration file (ntp.conf) -# -# Generic configuration file for UDel NTP stratum-2 time servers. Don't -# forget each server should have a /etc/ntp.drift and /etc/ntp.keys file. -# -# Stratum-1 peers. Each server should chime two different stratum-1 -# servers from the following list. Each stratum-1 server should be used -# only once. -# -#peer 128.8.10.1 # umd1.umd.edu -#peer 18.72.0.3 version 2 # bitsy.mit.edu -peer 132.249.16.1 # fuzz.sdsc.edu -peer 128.118.46.3 version 2 # otc1.psu.edu -#peer 128.9.2.129 # wwvb.isi.edu -#peer 130.43.2.2 version 2 # apple.com -#peer 16.1.0.22 # clepsydra.dec.com -#peer 130.105.1.156 version 2 # clock.osf.orga -#peer 128.96.60.5 version 2 # pi.bellcore.com -#peer 128.4.1.1 # rackety.udel.edu -#peer 129.116.3.5 # shorty.chpc.utexas.edu -# -# Stratum-2 peers. Each server should chime all of the others in this -# list except itself. -# -peer 128.175.1.1 # huey.udel.edu (VAX) -#peer 128.175.1.2 # dewey.udel.edu (VAX) -peer 128.175.1.3 # louie.udel.edu (SPARC) -peer 128.175.2.15 # snow-white.ee.udel.edu (SPARC) -peer 128.175.7.4 # sol.cis.udel.edu (SPARC) -# -# Miscellaneous stuff -# -driftfile /etc/ntp.drift # path for drift file -# -# Authentication stuff. Note the different authentication delay on -# VAX and SPARC. -# -keys /usr/local/etc/ntp.keys # path for key file -trustedkey 1 2 15 # define trusted keys -requestkey 15 # key (7) for accessing server variables -controlkey 15 # key (6) for accessing server variables diff --git a/dist/ntp/config.h.in b/dist/ntp/config.h.in index 50e181a18f0f..b7f95a4c1de0 100644 --- a/dist/ntp/config.h.in +++ b/dist/ntp/config.h.in @@ -1,28 +1,13 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* config.h.in. Generated from configure.in by autoheader. */ -/* debugging code */ -#undef DEBUG +/* Is adjtime() accurate? */ +#undef ADJTIME_IS_ACCURATE -/* Minutes per DST adjustment */ -#undef DSTMINUTES - -/* MD5 authentication */ -#undef MD5 - -/* DES authentication (COCOM only) */ -#undef DES - -/* time_t */ -#undef time_t - -/* reference clock interface */ -#undef REFCLOCK - -/* Audio CHU? */ +/* CHU audio/decoder? */ #undef AUDIO_CHU -/* PARSE kernel PLL PPS support */ -#undef PPS_SYNC +/* Declare char *sys_errlist array */ +#undef CHAR_SYS_ERRLIST /* ACTS modem service */ #undef CLOCK_ACTS @@ -30,61 +15,70 @@ /* Arbiter 1088A/B GPS receiver */ #undef CLOCK_ARBITER -/* DHD19970505: ARCRON support. */ +/* ARCRON support? */ #undef CLOCK_ARCRON_MSF -/* Austron 2200A/2201A GPS receiver */ +/* Austron 2200A/2201A GPS receiver? */ #undef CLOCK_AS2201 -/* PPS interface */ +/* PPS interface? */ #undef CLOCK_ATOM -/* PPS auxiliary interface for ATOM */ -#undef PPS_SAMPLE - -/* Datum/Bancomm bc635/VME interface */ +/* Datum/Bancomm bc635/VME interface? */ #undef CLOCK_BANC -/* Diems Computime Radio Clock */ -#undef CLOCK_COMPUTIME - -/* Chronolog K-series WWVB receiver */ +/* Chronolog K-series WWVB receiver? */ #undef CLOCK_CHRONOLOG -/* Datum Programmable Time System */ +/* CHU modem/decoder */ +#undef CLOCK_CHU + +/* Diems Computime Radio Clock? */ +#undef CLOCK_COMPUTIME + +/* Datum Programmable Time System? */ #undef CLOCK_DATUM -/* ELV/DCF7000 clock */ +/* ELV/DCF7000 clock? */ #undef CLOCK_DCF7000 -/* Dumb generic hh:mm:ss local clock */ +/* Dumb generic hh:mm:ss local clock? */ #undef CLOCK_DUMBCLOCK -/* Forum Graphic GPS datating station driver */ +/* Forum Graphic GPS datating station driver? */ #undef CLOCK_FG -/* TrueTime GPS receiver/VME interface */ +/* TrueTime GPS receiver/VME interface? */ #undef CLOCK_GPSVME -/* Heath GC-1000 WWV/WWVH receiver */ +/* Heath GC-1000 WWV/WWVH receiver? */ #undef CLOCK_HEATH -/* HOPF 6021 clock */ +/* HOPF 6021 clock? */ #undef CLOCK_HOPF6021 -/* HP 58503A GPS receiver */ +/* HOPF PCI clock device? */ +#undef CLOCK_HOPF_PCI + +/* HOPF serial clock device? */ +#undef CLOCK_HOPF_SERIAL + +/* HP 58503A GPS receiver? */ #undef CLOCK_HPGPS -/* Sun IRIG audio decoder */ +/* IRIG audio decoder? */ #undef CLOCK_IRIG -/* Rockwell Jupiter GPS clock */ +/* JJY receiver? */ +#undef CLOCK_JJY + +/* Rockwell Jupiter GPS clock? */ #undef CLOCK_JUPITER -/* Leitch CSD 5300 Master Clock System Driver */ +/* Leitch CSD 5300 Master Clock System Driver? */ #undef CLOCK_LEITCH -/* local clock reference */ +/* local clock reference? */ #undef CLOCK_LOCAL /* Meinberg clocks */ @@ -96,6 +90,9 @@ /* Magnavox MX4200 GPS receiver */ #undef CLOCK_MX4200 +/* NeoClock4X */ +#undef CLOCK_NEOCLOCK4X + /* NMEA GPS receiver */ #undef CLOCK_NMEA @@ -126,6 +123,9 @@ /* RCC 8000 clock */ #undef CLOCK_RCC8000 +/* RIPE NCC Trimble clock */ +#undef CLOCK_RIPENCC + /* Schmid DCF77 clock */ #undef CLOCK_SCHMID @@ -150,768 +150,960 @@ /* Kinemetrics/TrueTime receivers */ #undef CLOCK_TRUETIME -/* Ultralink M320 WWVB receiver */ +/* TrueTime 560 IRIG-B decoder? */ +#undef CLOCK_TT560 + +/* Ultralink M320 WWVB receiver? */ #undef CLOCK_ULINK /* USNO modem service */ #undef CLOCK_USNO +/* VARITEXT protocol */ +#undef CLOCK_VARITEXT + /* WHARTON 400A Series protocol */ #undef CLOCK_WHARTON_400A /* WWV audio driver */ #undef CLOCK_WWV -/* VARITEXT protocol */ -#undef CLOCK_VARITEXT +/* Zyfer GPStarplus */ +#undef CLOCK_ZYFER -/* define if we need to declare int errno; */ +/* Enable debugging? */ +#undef DEBUG + +/* Declaration style */ +#undef DECL_ADJTIME_0 + +/* Declaration style */ +#undef DECL_BCOPY_0 + +/* Declaration style */ +#undef DECL_BZERO_0 + +/* Declaration style */ +#undef DECL_CFSETISPEED_0 + +/* Declare errno? */ #undef DECL_ERRNO -/* define if we may declare int h_errno; */ +/* Declaration style */ +#undef DECL_HSTRERROR_0 + +/* Declare h_errno? */ #undef DECL_H_ERRNO -/* define if it's OK to declare char *sys_errlist[]; */ -#undef CHAR_SYS_ERRLIST +/* Declaration style */ +#undef DECL_INET_NTOA_0 -/* define if it's OK to declare int syscall P((int, struct timeval *, struct timeval *)); */ +/* Declaration style */ +#undef DECL_IOCTL_0 + +/* Declaration style */ +#undef DECL_IPC_0 + +/* Declaration style */ +#undef DECL_MEMMOVE_0 + +/* Declaration style */ +#undef DECL_MKSTEMP_0 + +/* Declaration style */ +#undef DECL_MKTEMP_0 + +/* Declaration style */ +#undef DECL_MRAND48_0 + +/* Declaration style */ +#undef DECL_NLIST_0 + +/* Declaration style */ +#undef DECL_PLOCK_0 + +/* Declaration style */ +#undef DECL_RENAME_0 + +/* Declaration style */ +#undef DECL_SELECT_0 + +/* Declaration style */ +#undef DECL_SETITIMER_0 + +/* Declaration style */ +#undef DECL_SETPRIORITY_0 + +/* Declaration style */ +#undef DECL_SETPRIORITY_1 + +/* Declaration style */ +#undef DECL_SIGVEC_0 + +/* Declaration style */ +#undef DECL_SRAND48_0 + +/* Declaration style */ +#undef DECL_STDIO_0 + +/* Declaration style */ +#undef DECL_STIME_0 + +/* Declaration style */ +#undef DECL_STIME_1 + +/* Declaration style */ +#undef DECL_STRERROR_0 + +/* Declaration style */ +#undef DECL_STRTOL_0 + +/* Declare syscall()? */ #undef DECL_SYSCALL -/* define if we have syscall is buggy (Solaris 2.4) */ -#undef SYSCALL_BUG +/* Declaration style */ +#undef DECL_SYSLOG_0 -/* Do we need extra room for SO_RCVBUF? (HPUX <8) */ -#undef NEED_RCVBUF_SLOP +/* Declaration style */ +#undef DECL_TIMEOFDAY_0 -/* Should we open the broadcast socket? */ -#undef OPEN_BCAST_SOCKET +/* Declaration style */ +#undef DECL_TIME_0 -/* Do we want the HPUX FindConfig()? */ -#undef NEED_HPUX_FINDCONFIG +/* Declaration style */ +#undef DECL_TOLOWER_0 -/* canonical system (cpu-vendor-os) string */ -#undef STR_SYSTEM - -/* define if NetInfo support is available */ -#undef HAVE_NETINFO - -/* define if [gs]ettimeofday() only takes 1 argument */ -#undef SYSV_TIMEOFDAY - -/* define if struct sockaddr has sa_len */ -#undef HAVE_SA_LEN_IN_STRUCT_SOCKADDR - -/* define if struct clockinfo has hz */ -#undef HAVE_HZ_IN_STRUCT_CLOCKINFO - -/* define if struct sigaction has sa_sigaction */ -#undef HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION - -/* define if struct clockinfo has tickadj */ -#undef HAVE_TICKADJ_IN_STRUCT_CLOCKINFO - -/* define if struct ntptimeval uses time.tv_nsec instead of time.tv_usec */ -#undef HAVE_TV_NSEC_IN_NTPTIMEVAL - -/* Does a system header defind struct ppsclockev? */ -#undef HAVE_STRUCT_PPSCLOCKEV - -/* define if function prototypes are OK */ -#undef HAVE_PROTOTYPES - -/* define if setpgrp takes 0 arguments */ -#undef HAVE_SETPGRP_0 - -/* hardwire a value for tick? */ -#undef PRESET_TICK - -/* hardwire a value for tickadj? */ -#undef PRESET_TICKADJ - -/* is adjtime() accurate? */ -#undef ADJTIME_IS_ACCURATE - -/* should we NOT read /dev/kmem? */ -#undef NOKMEM - -/* use UDP Wildcard Delivery? */ -#undef UDP_WILDCARD_DELIVERY - -/* always slew the clock? */ -#undef SLEWALWAYS - -/* step, then slew the clock? */ -#undef STEP_SLEW - -/* force ntpdate to step the clock if !defined(STEP_SLEW) ? */ -#undef FORCE_NTPDATE_STEP - -/* synch TODR hourly? */ -#undef DOSYNCTODR - -/* do we set process groups with -pid? */ -#undef UDP_BACKWARDS_SETOWN - -/* must we have a CTTY for fsetown? */ -#undef USE_FSETOWNCTTY - -/* can we use SIGIO for tcp and udp IO? */ -#undef HAVE_SIGNALED_IO - -/* can we use SIGPOLL for UDP? */ -#undef USE_UDP_SIGPOLL - -/* can we use SIGPOLL for tty IO? */ -#undef USE_TTY_SIGPOLL - -/* do we want the CHU driver? */ -#undef CLOCK_CHU - -/* do we have the ppsclock streams module? */ -#undef PPS - -/* do we have the tty_clk line discipline/streams module? */ -#undef TTYCLK - -/* does the kernel support precision time discipline? */ -#undef KERNEL_PLL - -/* does the kernel support multicasting IP? */ -#undef MCAST - -/* do we have ntp_{adj,get}time in libc? */ -#undef NTP_SYSCALLS_LIBC - -/* do we have ntp_{adj,get}time in the kernel? */ -#undef NTP_SYSCALLS_STD - -/* do we have STREAMS/TLI? (Can we replace this with HAVE_SYS_STROPTS_H? */ -#undef STREAMS_TLI - -/* do we need an s_char typedef? */ -#undef NEED_S_CHAR_TYPEDEF - -/* does SIOCGIFCONF return size in the buffer? */ -#undef SIZE_RETURNED_IN_BUFFER - -/* what is the name of TICK in the kernel? */ -#undef K_TICK_NAME - -/* Is K_TICK_NAME (nsec_per_tick, for example) in nanoseconds? */ -#undef TICK_NANO - -/* what is the name of TICKADJ in the kernel? */ -#undef K_TICKADJ_NAME - -/* Is K_TICKADJ_NAME (hrestime_adj, for example) in nanoseconds? */ -#undef TICKADJ_NANO - -/* what is (probably) the name of DOSYNCTODR in the kernel? */ -#undef K_DOSYNCTODR_NAME - -/* what is (probably) the name of NOPRINTF in the kernel? */ -#undef K_NOPRINTF_NAME - -/* do we need HPUX adjtime() library support? */ -#undef NEED_HPUX_ADJTIME - -/* Might nlist() values require an extra level of indirection (AIX)? */ -#undef NLIST_EXTRA_INDIRECTION - -/* Other needed NLIST stuff */ -#undef NLIST_STRUCT -#undef NLIST_NAME_UNION - -/* Should we recommend a minimum value for tickadj? */ -#undef MIN_REC_TICKADJ - -/* Is there a problem using PARENB and IGNPAR (IRIX)? */ -#undef NO_PARENB_IGNPAR - -/* Should we not IGNPAR (Linux)? */ -#undef RAWDCF_NO_IGNPAR - -/* Does the compiler like "volatile"? */ -#undef volatile - -/* Does qsort expect to work on "void *" stuff? */ -#undef QSORT_USES_VOID_P +/* Declaration style */ +#undef DECL_TOUPPER_0 /* What is the fallback value for HZ? */ #undef DEFAULT_HZ -/* Do we need to override the system's idea of HZ? */ -#undef OVERRIDE_HZ +/* synch TODR hourly? */ +#undef DOSYNCTODR -/* Do we want the SCO clock hacks? */ -#undef SCO5_CLOCK +/* The number of minutes in a DST adjustment */ +#undef DSTMINUTES -/* Do we want the ReliantUNIX clock hacks? */ -#undef RELIANTUNIX_CLOCK +/* force ntpdate to step the clock if !defined(STEP_SLEW) ? */ +#undef FORCE_NTPDATE_STEP -/* Does the kernel have an FLL bug? */ -#undef KERNEL_FLL_BUG - -/* Define if you have the TIOCGPPSEV ioctl (Solaris) */ -#undef HAVE_TIOCGPPSEV - -/* Define if you have the TIOCSPPS ioctl (Solaris) */ -#undef HAVE_TIOCSPPS - -/* Define if you have the CIOGETEV ioctl (SunOS, Linux) */ -#undef HAVE_CIOGETEV - -/* 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 - -/* Do we need to #define _SVID3 when we #include ? */ -#undef TERMIOS_NEEDS__SVID3 - -/* Do we have support for SHMEM_STATUS? */ -#undef ONCORE_SHMEM_STATUS - -/* adjtime()? */ -#undef DECL_ADJTIME_0 - -/* bcopy()? */ -#undef DECL_BCOPY_0 - -/* bzero()? */ -#undef DECL_BZERO_0 - -/* cfset[io]speed()? */ -#undef DECL_CFSETISPEED_0 - -/* ioctl()? */ -#undef DECL_IOCTL_0 - -/* IPC? (bind, connect, recvfrom, sendto, setsockopt, socket) */ -#undef DECL_IPC_0 - -/* memmove()? */ -#undef DECL_MEMMOVE_0 - -/* mkstemp()? */ -#undef DECL_MKSTEMP_0 - -/* mktemp()? */ -#undef DECL_MKTEMP_0 - -/* mrand48()? */ -#undef DECL_MRAND48_0 - -/* nlist()? */ -#undef DECL_NLIST_0 - -/* plock()? */ -#undef DECL_PLOCK_0 - -/* rename()? */ -#undef DECL_RENAME_0 - -/* select()? */ -#undef DECL_SELECT_0 - -/* setitimer()? */ -#undef DECL_SETITIMER_0 - -/* setpriority()? */ -#undef DECL_SETPRIORITY_0 -#undef DECL_SETPRIORITY_1 - -/* sigvec()? */ -#undef DECL_SIGVEC_0 - -/* srand48()? */ -#undef DECL_SRAND48_0 - -/* stdio stuff? */ -#undef DECL_STDIO_0 - -/* stime()? */ -#undef DECL_STIME_0 -#undef DECL_STIME_1 - -/* strtol()? */ -#undef DECL_STRTOL_0 - -/* syslog() stuff? */ -#undef DECL_SYSLOG_0 - -/* time()? */ -#undef DECL_TIME_0 - -/* [gs]ettimeofday()? */ -#undef DECL_TIMEOFDAY_0 - -/* tolower()? */ -#undef DECL_TOLOWER_0 - -/* toupper()? */ -#undef DECL_TOUPPER_0 - -/* Autokey? */ -#undef AUTOKEY - -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_ARPA_NAMESER_H -/* Define if you have the header file. */ +/* Do we have audio support? */ +#undef HAVE_AUDIO + +/* Define to 1 if you have the header file. */ #undef HAVE_BSTRING_H -/* Define if you have the `clock_settime' function. */ +/* Do we have the CIOGETEV ioctl (SunOS, Linux)? */ +#undef HAVE_CIOGETEV + +/* [Use], [/dev/clockctl?] */ +#undef HAVE_CLOCKCTL + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the `clock_settime' function. */ #undef HAVE_CLOCK_SETTIME -/* Define if you have the `daemon' function. */ +/* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `EVP_md2' function. */ +#undef HAVE_EVP_MD2 + +/* Define to 1 if you have the `EVP_mdc2' function. */ +#undef HAVE_EVP_MDC2 + +/* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* Define if you have the `getbootfile' function. */ +/* Define to 1 if you have the `finite' function. */ +#undef HAVE_FINITE + +/* Define to 1 if you have the `getbootfile' function. */ #undef HAVE_GETBOOTFILE -/* Define if you have the `getdtablesize' function. */ +/* Define to 1 if you have the `getclock' function. */ +#undef HAVE_GETCLOCK + +/* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE -/* Define if you have the `getrusage' function. */ +/* Define to 1 if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE -/* Define if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the `getuid' function. */ +/* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID -/* Define if you have the `hstrerror' function. */ +/* Define to 1 if you have the `hstrerror' function. */ #undef HAVE_HSTRERROR -/* Define if you have the `kvm_open' function. */ +/* Obvious... */ +#undef HAVE_HZ_IN_STRUCT_CLOCKINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_IEEEFP_H + +/* ISC: Use iflist_sysctl? */ +#undef HAVE_IFLIST_SYSCTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isfinite' function. */ +#undef HAVE_ISFINITE + +/* Define to 1 if you have the `kvm_open' function. */ #undef HAVE_KVM_OPEN -/* Define if you have the `K_open' function. */ +/* Define to 1 if you have the `K_open' function. */ #undef HAVE_K_OPEN -/* Define if you have the `advapi32' library (-ladvapi32). */ +/* Define to 1 if you have the `advapi32' library (-ladvapi32). */ #undef HAVE_LIBADVAPI32 -/* Define if you have the `elf' library (-lelf). */ +/* Do we have the curses library? */ +#undef HAVE_LIBCURSES + +/* Do we have the edit library? */ +#undef HAVE_LIBEDIT + +/* Define to 1 if you have the `elf' library (-lelf). */ #undef HAVE_LIBELF -/* Define if you have the `gen' library (-lgen). */ +/* Define to 1 if you have the `gen' library (-lgen). */ #undef HAVE_LIBGEN -/* Define if you have the `kvm' library (-lkvm). */ +/* Define to 1 if you have the `kvm' library (-lkvm). */ #undef HAVE_LIBKVM -/* Define if you have the `ld' library (-lld). */ +/* Define to 1 if you have the `ld' library (-lld). */ #undef HAVE_LIBLD -/* Define if you have the `mld' library (-lmld). */ +/* Define to 1 if you have the `md' library (-lmd). */ +#undef HAVE_LIBMD + +/* Define to 1 if you have the `md5' library (-lmd5). */ +#undef HAVE_LIBMD5 + +/* Define to 1 if you have the `mld' library (-lmld). */ #undef HAVE_LIBMLD -/* Define if you have the `nsl' library (-lnsl). */ +/* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL -/* Define if you have the `posix4' library (-lposix4). */ +/* Define to 1 if you have the `posix4' library (-lposix4). */ #undef HAVE_LIBPOSIX4 -/* Define if you have the `rt' library (-lrt). */ +/* Define to 1 if you have the `readline' library (-lreadline). */ +#undef HAVE_LIBREADLINE + +/* Define to 1 if you have the `rt' library (-lrt). */ #undef HAVE_LIBRT -/* Define if you have the `socket' library (-lsocket). */ +/* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET -/* Define if you have the header file. */ +/* Define to 1 if you have the `syslog' library (-lsyslog). */ +#undef HAVE_LIBSYSLOG + +/* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_INLINE_H -/* Define if you have the `memcpy' function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_SOUNDCARD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H + +/* Define to 1 if you have the `MD5Init' function. */ +#undef HAVE_MD5INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MD5_H + +/* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY -/* Define if you have the `memlk' function. */ +/* Define to 1 if you have the `memlk' function. */ #undef HAVE_MEMLK -/* Define if you have the `memmove' function. */ +/* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Define if you have the `memset' function. */ +/* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET -/* Define if you have the `mkstemp' function. */ +/* Define to 1 if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP -/* Define if you have the `mktime' function. */ +/* Define to 1 if you have the `mktime' function. */ #undef HAVE_MKTIME -/* Define if you have the `mlockall' function. */ +/* Define to 1 if you have the `mlockall' function. */ #undef HAVE_MLOCKALL -/* Define if you have the `mrand48' function. */ +/* Define to 1 if you have the `mrand48' function. */ #undef HAVE_MRAND48 -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTEM_H + +/* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_SYSTM_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* NetInfo support? */ +#undef HAVE_NETINFO + +/* Define to 1 if you have the header file. */ #undef HAVE_NETINFO_NI_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF6_H + +/* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_H -/* Define if you have the `nice' function. */ +/* Define to 1 if you have the `nice' function. */ #undef HAVE_NICE -/* Define if you have the `nlist' function. */ +/* Define to 1 if you have the `nlist' function. */ #undef HAVE_NLIST -/* Define if you have the `ntp_adjtime' function. */ +/* Define to 1 if you have the `ntp_adjtime' function. */ #undef HAVE_NTP_ADJTIME -/* Define if you have the `ntp_gettime' function. */ +/* Define to 1 if you have the `ntp_gettime' function. */ #undef HAVE_NTP_GETTIME -/* Define if you have the `plock' function. */ +/* Define to 1 if you have the `plock' function. */ #undef HAVE_PLOCK -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_POLL_H -/* Define if you have the `pututline' function. */ +/* Do we have the PPS API per the Draft RFC? */ +#undef HAVE_PPSAPI + +/* Are function prototypes OK? */ +#undef HAVE_PROTOTYPES + +/* Define to 1 if you have the `pututline' function. */ #undef HAVE_PUTUTLINE -/* Define if you have the `pututxline' function. */ +/* Define to 1 if you have the `pututxline' function. */ #undef HAVE_PUTUTXLINE -/* Define if you have the `random' function. */ +/* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_HISTORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_READLINE_H + +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define to 1 if you have the header file. */ #undef HAVE_RESOLV_H -/* Define if you have the `rtprio' function. */ +/* Define to 1 if you have the `rtprio' function. */ #undef HAVE_RTPRIO -/* Define if you have the header file. */ +/* Should be obvious... */ +#undef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + +/* Obvious... */ +#undef HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION + +/* Define to 1 if you have the header file. */ #undef HAVE_SCHED_H -/* Define if you have the `sched_setscheduler' function. */ +/* Define to 1 if you have the `sched_setscheduler' function. */ #undef HAVE_SCHED_SETSCHEDULER -/* Define if you have the `setlinebuf' function. */ +/* Define to 1 if you have the `setlinebuf' function. */ #undef HAVE_SETLINEBUF -/* Define if you have the `setpgid' function. */ +/* Define to 1 if you have the `setpgid' function. */ #undef HAVE_SETPGID -/* Define if you have the `setpriority' function. */ +/* define if setpgrp takes 0 arguments */ +#undef HAVE_SETPGRP_0 + +/* Define to 1 if you have the `setpriority' function. */ #undef HAVE_SETPRIORITY -/* Define if you have the `setsid' function. */ +/* Define to 1 if you have the `setrlimit' function. */ +#undef HAVE_SETRLIMIT + +/* Define to 1 if you have the `setsid' function. */ #undef HAVE_SETSID -/* Define if you have the `settimeofday' function. */ +/* Define to 1 if you have the `settimeofday' function. */ #undef HAVE_SETTIMEOFDAY -/* Define if you have the `setvbuf' function. */ +/* Define to 1 if you have the `setvbuf' function. */ #undef HAVE_SETVBUF -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H -/* Define if you have the `sigaction' function. */ +/* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION -/* Define if you have the `sigset' function. */ +/* Can we use SIGIO for tcp and udp IO? */ +#undef HAVE_SIGNALED_IO + +/* Define to 1 if you have the `sigset' function. */ #undef HAVE_SIGSET -/* Define if you have the `sigsuspend' function. */ +/* Define to 1 if you have the `sigsuspend' function. */ #undef HAVE_SIGSUSPEND -/* Define if you have the `sigvec' function. */ +/* Define to 1 if you have the `sigvec' function. */ #undef HAVE_SIGVEC -/* Define if you have the `snprintf' function. */ +/* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF -/* Define if you have the `srand48' function. */ +/* Define to 1 if you have the `srand48' function. */ #undef HAVE_SRAND48 -/* Define if you have the header file. */ +/* Does struct sockaddr_storage have ss_family? */ +#undef HAVE_SS_FAMILY_IN_SS + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* Define if you have the `stime' function. */ +/* Define to 1 if you have the `stime' function. */ #undef HAVE_STIME -/* Define if you have the `strchr' function. */ +/* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR -/* Define if you have the `strerror' function. */ +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ #undef HAVE_STRING_H -/* Define if `blocksize' is member of `struct audio_info'. */ -#undef HAVE_STRUCT_AUDIO_INFO_BLOCKSIZE - -/* Define if `hiwat' is member of `struct audio_info'. */ -#undef HAVE_STRUCT_AUDIO_INFO_HIWAT - -/* Define if `lowat' is member of `struct audio_info'. */ -#undef HAVE_STRUCT_AUDIO_INFO_LOWAT - -/* Define if `mode' is member of `struct audio_info'. */ -#undef HAVE_STRUCT_AUDIO_INFO_MODE - -/* Define if `monitor_gain' is member of `struct audio_info'. */ -#undef HAVE_STRUCT_AUDIO_INFO_MONITOR_GAIN - -/* Define if `output_muted' is member of `struct audio_info'. */ -#undef HAVE_STRUCT_AUDIO_INFO_OUTPUT_MUTED +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR /* Do we have struct ntptimeval? */ #undef HAVE_STRUCT_NTPTIMEVAL -/* Define if you have the header file. */ +/* Define to 1 if `time.tv_nsec' is member of `struct ntptimeval'. */ +#undef HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC + +/* Does a system header define struct ppsclockev? */ +#undef HAVE_STRUCT_PPSCLOCKEV + +/* Do we have struct snd_size? */ +#undef HAVE_STRUCT_SND_SIZE + +/* Do we have struct timespec? */ +#undef HAVE_STRUCT_TIMESPEC + +/* Define to 1 if you have the header file. */ #undef HAVE_SUN_AUDIOIO_H -/* Define if you have the `sysconf' function. */ +/* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF -/* Define if you have the `sysctl' function. */ +/* Define to 1 if you have the `sysctl' function. */ #undef HAVE_SYSCTL -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_CLKDEFS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_CLOCKCTL_H + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_I8253_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IPC_H + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_LOCK_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_MODEM_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PCL720_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PPSCLOCK_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PPSTIME_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PROC_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SCHED_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SHM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNAL_H + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SIO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKIO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOUNDCARD_H + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_STREAM_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_STROPTS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSCTL_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSSGI_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSTUNE_H + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TERMIOS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMEPPS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMERS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMEX_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TPRO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_WAIT_H -/* Define if the system has the type `s_char'. */ +/* Define to 1 if the system has the type `s_char'. */ #undef HAVE_S_CHAR -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H -/* Define if you have the header file. */ +/* Obvious... */ +#undef HAVE_TICKADJ_IN_STRUCT_CLOCKINFO + +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + +/* Define to 1 if you have the header file. */ #undef HAVE_TIMEPPS_H -/* Define if you have the `timer_create' function. */ +/* Define to 1 if you have the `timer_create' function. */ #undef HAVE_TIMER_CREATE -/* Define if you have the `timer_settime' function. */ +/* Define to 1 if you have the `timer_settime' function. */ #undef HAVE_TIMER_SETTIME -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_TIMEX_H -/* Define if you have the `umask' function. */ +/* Do we have the TIOCGPPSEV ioctl (Solaris)? */ +#undef HAVE_TIOCGPPSEV + +/* Do we have the TIOCSPPS ioctl (Solaris)? */ +#undef HAVE_TIOCSPPS + +/* Do we have the TIO serial stuff? */ +#undef HAVE_TIO_SERIAL_STUFF + +/* Does u_int64_t exist */ +#undef HAVE_TYPE_U_INT64_T + +/* Does u_int8_t exist */ +#undef HAVE_TYPE_U_INT8_T + +/* Define to 1 if you have the `umask' function. */ #undef HAVE_UMASK -/* Define if you have the `uname' function. */ +/* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if you have the `updwtmp' function. */ +/* Define to 1 if you have the `updwtmp' function. */ #undef HAVE_UPDWTMP -/* Define if you have the `updwtmpx' function. */ +/* Define to 1 if you have the `updwtmpx' function. */ #undef HAVE_UPDWTMPX -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_UTMPX_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_UTMP_H -/* Define if you have the `vsprintf' function. */ +/* Define to 1 if you have the `vsprintf' function. */ #undef HAVE_VSPRINTF -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE__SYS_SYNC_QUEUE_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE__SYS_SYNC_SEMA_H -/* Define if you have the `__adjtimex' function. */ +/* Define to 1 if you have the `__adjtimex' function. */ #undef HAVE___ADJTIMEX -/* Define if you have the `__ntp_gettime' function. */ +/* Define to 1 if you have the `__ntp_gettime' function. */ #undef HAVE___NTP_GETTIME +/* Does struct sockaddr_storage have __ss_family? */ +#undef HAVE___SS_FAMILY_IN_SS + +/* Should we use the IRIG sawtooth filter? */ +#undef IRIG_SUCKS + +/* ISC: have struct if_laddrconf? */ +#undef ISC_PLATFORM_HAVEIF_LADDRCONF + +/* ISC: have struct if_laddrreq? */ +#undef ISC_PLATFORM_HAVEIF_LADDRREQ + +/* ISC: Have struct in6_pktinfo? */ +#undef ISC_PLATFORM_HAVEIN6PKTINFO + +/* ISC: Have IPv6? */ +#undef ISC_PLATFORM_HAVEIPV6 + +/* ISC: struct sockaddr as sa_len? */ +#undef ISC_PLATFORM_HAVESALEN + +/* ISC: Need in6addr_any? */ +#undef ISC_PLATFORM_NEEDIN6ADDRANY + +/* ISC: provide inet_ntop() */ +#undef ISC_PLATFORM_NEEDNTOP + +/* Does the kernel have an FLL bug? */ +#undef KERNEL_FLL_BUG + +/* Does the kernel support precision time discipline? */ +#undef KERNEL_PLL + +/* What is (probably) the name of DOSYNCTODR in the kernel? */ +#undef K_DOSYNCTODR_NAME + +/* What is (probably) the name of NOPRINTF in the kernel? */ +#undef K_NOPRINTF_NAME + +/* What is the name of TICKADJ in the kernel? */ +#undef K_TICKADJ_NAME + +/* What is the name of TICK in the kernel? */ +#undef K_TICK_NAME + +/* Should we align with the NIST lockclock scheme? */ +#undef LOCKCLOCK + +/* Does the kernel support multicasting IP? */ +#undef MCAST + +/* Should we recommend a minimum value for tickadj? */ +#undef MIN_REC_TICKADJ + +/* Do we need HPUX adjtime() library support? */ +#undef NEED_HPUX_ADJTIME + +/* Do we want the HPUX FindConfig()? */ +#undef NEED_HPUX_FINDCONFIG + +/* Do we need the qnx adjtime call? */ +#undef NEED_QNX_ADJTIME + +/* Do we need extra room for SO_RCVBUF? (HPUX <8) */ +#undef NEED_RCVBUF_SLOP + +/* Do we need an s_char typedef? */ +#undef NEED_S_CHAR_TYPEDEF + +/* Might nlist() values require an extra level of indirection (AIX)? */ +#undef NLIST_EXTRA_INDIRECTION + +/* does struct nlist use a name union? */ +#undef NLIST_NAME_UNION + +/* nlist stuff */ +#undef NLIST_STRUCT + +/* Should we NOT read /dev/kmem? */ +#undef NOKMEM + +/* Is there a problem using PARENB and IGNPAR (IRIX)? */ +#undef NO_PARENB_IGNPAR + +/* Default location of crypto key info */ +#undef NTP_KEYSDIR + +/* Do we have ntp_{adj,get}time in libc? */ +#undef NTP_SYSCALLS_LIBC + +/* Do we have ntp_{adj,get}time in the kernel? */ +#undef NTP_SYSCALLS_STD + +/* Do we have support for SHMEM_STATUS? */ +#undef ONCORE_SHMEM_STATUS + +/* Use OpenSSL? */ +#undef OPENSSL + +/* Should we open the broadcast socket? */ +#undef OPEN_BCAST_SOCKET + +/* Do we need to override the system's idea of HZ? */ +#undef OVERRIDE_HZ + /* Name of package */ #undef PACKAGE +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Do we have the ppsclock streams module? */ +#undef PPS + +/* PPS auxiliary interface for ATOM? */ +#undef PPS_SAMPLE + +/* PARSE kernel PLL PPS support */ +#undef PPS_SYNC + +/* Preset a value for 'tick'? */ +#undef PRESET_TICK + +/* Preset a value for 'tickadj'? */ +#undef PRESET_TICKADJ + /* Define if compiler has function prototypes */ #undef PROTOTYPES -/* Public key? */ -#undef PUBKEY +/* Does qsort expect to work on "void *" stuff? */ +#undef QSORT_USES_VOID_P + +/* Should we not IGNPAR (Linux)? */ +#undef RAWDCF_NO_IGNPAR + +/* Basic refclock support? */ +#undef REFCLOCK + +/* Do we want the ReliantUNIX clock hacks? */ +#undef RELIANTUNIX_CLOCK /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE -/* The number of bytes in a `int'. */ +/* Do we want the SCO clock hacks? */ +#undef SCO5_CLOCK + +/* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The number of bytes in a `long'. */ +/* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The number of bytes in a `signed char'. */ +/* The size of a `signed char', as computed by sizeof. */ #undef SIZEOF_SIGNED_CHAR -/* Define if you have the ANSI C header files. */ +/* Does SIOCGIFCONF return size in the buffer? */ +#undef SIZE_RETURNED_IN_BUFFER + +/* Slew always? */ +#undef SLEWALWAYS + +/* *s*printf() functions are char* */ +#undef SPRINTF_CHAR + +/* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Does ntptimeval use struct timespec? */ -#undef TIMESPEC_IN_NTPTIMEVAL +/* Step, then slew the clock? */ +#undef STEP_SLEW -/* Define if you can safely include both and . */ +/* Do we have STREAMS/TLI? (Can we replace this with HAVE_SYS_STROPTS_H?) */ +#undef STREAMS_TLI + +/* canonical system (cpu-vendor-os) string */ +#undef STR_SYSTEM + +/* Buggy syscall() (Solaris2.4)? */ +#undef SYSCALL_BUG + +/* Does Xettimeofday take 1 arg? */ +#undef SYSV_TIMEOFDAY + +/* Do we need to #define _SVID3 when we #include ? */ +#undef TERMIOS_NEEDS__SVID3 + +/* Is K_TICKADJ_NAME in nanoseconds? */ +#undef TICKADJ_NANO + +/* Is K_TICK_NAME in nanoseconds? */ +#undef TICK_NANO + +/* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME -/* Define if your declares `struct tm'. */ +/* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* Do we have the tty_clk line discipline/streams module? */ +#undef TTYCLK + +/* Do we set process groups with -pid? */ +#undef UDP_BACKWARDS_SETOWN + +/* use UDP Wildcard Delivery? */ +#undef UDP_WILDCARD_DELIVERY + +/* How do we create unsigned long constants? */ +#undef ULONG_CONST + +/* Must we have a CTTY for fsetown? */ +#undef USE_FSETOWNCTTY + +/* Can we use SIGPOLL for tty IO? */ +#undef USE_TTY_SIGPOLL + +/* Can we use SIGPOLL for UDP? */ +#undef USE_UDP_SIGPOLL + /* Version number of package */ #undef VERSION -/* Define if your processor stores words with the most significant byte first - (like Motorola and SPARC, unlike Intel and VAX). */ +/* ISC: Want IPv6? */ +#undef WANT_IPV6 + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN -/* Define if on AIX 3. +/* Handle ss_family */ +#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS) +# define ss_family __ss_family +# define ss_len __ss_len +#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */ + +/* Define to 1 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. */ +/* Define to 1 if on MINIX. */ #undef _MINIX -/* Define if the system does not provide POSIX.1 features except with this - defined. */ +/* Define to 2 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. */ +/* Define to 1 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. */ +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ #endif -/* Define to empty if the keyword `const' is not conform to ANSI C. */ +/* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ @@ -932,3 +1124,6 @@ /* Define to `int' if doesn't define. */ #undef uid_t + +/* Does the compiler like "volatile"? */ +#undef volatile diff --git a/dist/ntp/configure b/dist/ntp/configure index c948b5e9f622..64f6df86149b 100755 --- a/dist/ntp/configure +++ b/dist/ntp/configure @@ -1,20 +1,285 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using Autoconf version 2.14a -# Copyright (C) 1992, 93, 94, 95, 96, 98, 1999 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.57. # +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -# Defaults: -ac_arg_with_help= -ac_arg_enable_help= -ac_arg_var_help= +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +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 + +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 + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset 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 -# Factorizing default headers for most tests. +ac_config_libobj_dir=. +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} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="ntpd/ntp_refclock.c" +# Factoring default headers for most tests. ac_includes_default="\ #include -#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif #if STDC_HEADERS # include # include @@ -28,156 +293,34 @@ ac_includes_default="\ # include # endif # include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include #else -# if HAVE_STRINGS_H -# include +# if HAVE_STDINT_H +# include # endif #endif #if HAVE_UNISTD_H # include #endif" -# Any additions from configure.in: -ac_arg_enable_help="$ac_arg_enable_help - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors" -ac_arg_var_help="$ac_arg_var_help - CFLAGS Extra flags for the C compiler" -ac_arg_enable_help="$ac_arg_enable_help - --enable-debugging + include debugging code" -ac_arg_enable_help="$ac_arg_enable_help - --enable-dst-minutes=60 + minutes per DST adjustment" -ac_arg_enable_help="$ac_arg_enable_help - --enable-md5 + include support for MD5 keys" -ac_arg_enable_help="$ac_arg_enable_help - --enable-BANCOMM - Datum/Bancomm bc635/VME interface" -ac_arg_enable_help="$ac_arg_enable_help - --enable-GPSVME - TrueTime GPS receiver/VME interface" -ac_arg_enable_help="$ac_arg_enable_help - --enable-SHM - SHM clock attached thru shared memory" -ac_arg_enable_help="$ac_arg_enable_help - --enable-all-clocks + include all suitable non-PARSE clocks:" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ACTS + ACTS modem service" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ARBITER + Arbiter 1088A/B GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ARCRON-MSF + Arcron MSF receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-AS2201 + Austron 2200A/2201A GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ATOM + PPS interface" -ac_arg_enable_help="$ac_arg_enable_help - --enable-CHU - CHU modem/decoder" -ac_arg_enable_help="$ac_arg_enable_help - --enable-AUDIO-CHU s CHU audio/decoder" -ac_arg_enable_help="$ac_arg_enable_help - --enable-DATUM s Datum Programmable Time System" -ac_arg_enable_help="$ac_arg_enable_help - --enable-FG + Forum Graphic GPS" -ac_arg_enable_help="$ac_arg_enable_help - --enable-HEATH s Heath GC-1000 WWV/WWVH receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-HPGPS + HP 58503A GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-IRIG s Sun IRIG audio decoder" -ac_arg_enable_help="$ac_arg_enable_help - --enable-LEITCH + Leitch CSD 5300 Master Clock System Driver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-LOCAL-CLOCK + local clock reference" -ac_arg_enable_help="$ac_arg_enable_help - --enable-MSFEES + EES M201 MSF receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-MX4200 s Magnavox MX4200 GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-NMEA + NMEA GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ONCORE + Motorola VP/UT Oncore GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-PALISADE + Palisade clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-PST + PST/Traconex 1020 WWV/WWVH receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-JUPITER s Rockwell Jupiter GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-PTBACTS s PTB modem service" -ac_arg_enable_help="$ac_arg_enable_help - --enable-TPRO s KSI/Odetics TPRO/S GPS receiver/IRIG interface" -ac_arg_enable_help="$ac_arg_enable_help - --enable-TRAK + TRAK 8810 GPS receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-CHRONOLOG + Chrono-log K-series WWVB receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-DUMBCLOCK + Dumb generic hh:mm:ss local clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-PCF + Conrad parallel port radio clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-SPECTRACOM + Spectracom 8170/Netclock/2 WWVB receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-TRUETIME s Kinemetrics/TrueTime receivers" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ULINK + Ultralink WWVB receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-WWV + WWV Audio receiver" -ac_arg_enable_help="$ac_arg_enable_help - --enable-USNO s USNO modem service" -ac_arg_enable_help="$ac_arg_enable_help - --enable-parse-clocks - include all suitable PARSE clocks:" -ac_arg_enable_help="$ac_arg_enable_help - --enable-COMPUTIME s Diem Computime Radio Clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-DCF7000 s ELV/DCF7000 clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-HOPF6021 s HOPF 6021 clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-MEINBERG s Meinberg clocks" -ac_arg_enable_help="$ac_arg_enable_help - --enable-RAWDCF s DCF77 raw time code" -ac_arg_enable_help="$ac_arg_enable_help - --enable-RCC8000 s RCC 8000 clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-SCHMID s Schmid DCF77 clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-TRIMTAIP s Trimble GPS receiver/TAIP protocol" -ac_arg_enable_help="$ac_arg_enable_help - --enable-TRIMTSIP s Trimble GPS receiver/TSIP protocol" -ac_arg_enable_help="$ac_arg_enable_help - --enable-WHARTON s WHARTON 400A Series clock" -ac_arg_enable_help="$ac_arg_enable_help - --enable-VARITEXT s VARITEXT clock" -ac_arg_with_help="$ac_arg_with_help - --with-rsaref + Use rsaref if possible" -ac_arg_enable_help="$ac_arg_enable_help - --enable-kmem s read /dev/kmem for tick and/or tickadj" -ac_arg_enable_help="$ac_arg_enable_help - --enable-accurate-adjtime - s the adjtime() call is accurate" -ac_arg_enable_help="$ac_arg_enable_help - --enable-tick=VALUE s force a value for 'tick'" -ac_arg_enable_help="$ac_arg_enable_help - --enable-tickadj=VALUE s force a value for 'tickadj'" -ac_arg_enable_help="$ac_arg_enable_help - --enable-udp-wildcard s use UDP wildcard delivery" -ac_arg_enable_help="$ac_arg_enable_help - --enable-slew-always s always slew the time" -ac_arg_enable_help="$ac_arg_enable_help - --enable-step-slew s step and slew the time" -ac_arg_enable_help="$ac_arg_enable_help - --enable-ntpdate-step s if ntpdate should step the time" -ac_arg_enable_help="$ac_arg_enable_help - --enable-hourly-todr-sync - s if we should sync TODR hourly" -ac_arg_enable_help="$ac_arg_enable_help - --enable-kernel-fll-bug s if we should avoid a kernel FLL bug" + +ac_subdirs_all="$ac_subdirs_all arlib" +ac_subdirs_all="$ac_subdirs_all sntp" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP LN_S RANLIB ac_ct_RANLIB PATH_SH PATH_PERL READLINE_LIBS U ANSI2KNR LIBOBJS LIBPARSE MAKE_LIBPARSE MAKE_LIBPARSE_KERNEL MAKE_CHECK_Y2K OPENSSL OPENSSL_INC OPENSSL_LIB MAKE_NTP_KEYGEN LCRYPTO EF_PROGS EF_LIBS MAKE_SNTP TESTDCF DCFD MAKE_PARSEKMODULE PROPDELAY CHUTEST CLKTEST MAKE_ADJTIMED MAKE_NTPTIME MAKE_TICKADJ MAKE_TIMETRIM MAKE_LIBNTPSIM MAKE_NTPDSIM ARLIB_DIR subdirs LTLIBOBJS' +ac_subst_files='' # 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 @@ -186,10 +329,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' @@ -203,16 +351,6 @@ 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} -# Sed expression to map a string onto a valid sh and CPP variable names. -ac_tr_sh='sed -e y%*+%pp%;s%[^a-zA-Z0-9_]%_%g' -ac_tr_cpp='sed -e y%*abcdefghijklmnopqrstuvwxyz%PABCDEFGHIJKLMNOPQRSTUVWXYZ%;s%[^A-Z0-9_]%_%g' - ac_prev= for ac_option do @@ -223,56 +361,59 @@ do continue fi - ac_optarg=`echo "$ac_option" | sed -n 's/^[^=]*=//p'` + 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 echo "$ac_feature" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1; 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" : ".*[^-_$as_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 echo "$ac_feature" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1; 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" : ".*[^-_$as_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- \ @@ -281,113 +422,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 | -h) - # 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 software source code packages to adapt to many kinds -of systems. - -Usage: configure [OPTION]... [VAR=VALUE]... [HOST] - -To safely assign special values to environment variables (e.g., CC, -CFLAGS...), give to `configure' the definition as VAR=VALUE. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help print this message - --version print the version of autoconf that created configure - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE - -n, --no-create do not create output files - -Directories: - --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 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 - -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] - -X features: - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - test -n "$ac_arg_enable_help" && echo " -Optional features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes]\ -$ac_arg_enable_help" - test -n "$ac_arg_with_help" && echo " -Optional packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)\ -$ac_arg_with_help" - test -n "$ac_arg_var_help" && echo " -Some influent environment variables:$ac_arg_var_help" - exit 0 ;; + 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 \ @@ -396,19 +471,19 @@ Some influent environment variables:$ac_arg_var_help" -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. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -422,26 +497,26 @@ Some influent environment variables:$ac_arg_var_help" -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 \ @@ -458,7 +533,7 @@ Some influent environment variables:$ac_arg_var_help" | --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) @@ -468,7 +543,7 @@ Some influent environment variables:$ac_arg_var_help" ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -479,58 +554,57 @@ Some influent environment variables:$ac_arg_var_help" | --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.14a" - 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 echo "$ac_feature" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_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 echo "$ac_feature" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1; 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" : ".*[^-_$as_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. @@ -541,110 +615,110 @@ Some influent environment variables:$ac_arg_var_help" 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=`echo "$ac_option" | sed -e 's/=.*//'` + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - if echo "$ac_envvar" | grep '[^a-zA-Z0-9_]' >/dev/null 2>&1; then - { echo "configure: error: $ac_envvar: invalid variable name" 1>&2; exit 1; } - fi + expr "x$ac_envvar" : ".*[^_$as_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 echo "$ac_feature" | grep '[^-a-zA-Z0-9.]' >/dev/null 2>&1; 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" : ".*[^-._$as_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 meta-characters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in 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_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` - 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 directory name 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 +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# 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 +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +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 + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# 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 # 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%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -654,13 +728,521 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: cannot find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: cannot find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 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 <<_ACEOF +\`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 \`..'] + +_ACEOF + + cat <<_ACEOF +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] +_ACEOF + + cat <<\_ACEOF + +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 cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +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-clockctl Use /dev/clockctl for non-root time control + --enable-debugging + include debugging code + --enable-dst-minutes=60 + minutes per DST adjustment + --enable-BANCOMM - Datum/Bancomm bc635/VME interface + --enable-GPSVME - TrueTime GPS receiver/VME interface + --enable-all-clocks + include all suitable non-PARSE clocks: + --enable-ACTS s ACTS modem service + --enable-ARBITER + Arbiter 1088A/B GPS receiver + --enable-ARCRON-MSF + Arcron MSF receiver + --enable-AS2201 + Austron 2200A/2201A GPS receiver + --enable-ATOM s ATOM PPS interface + --enable-CHRONOLOG + Chrono-log K-series WWVB receiver + --enable-CHU + CHU modem/decoder + --enable-AUDIO-CHU s CHU audio/decoder + --enable-DATUM s Datum Programmable Time System + --enable-DUMBCLOCK + Dumb generic hh:mm:ss local clock + --enable-FG + Forum Graphic GPS + --enable-HEATH s Heath GC-1000 WWV/WWVH receiver + --enable-HOPFSERIAL + hopf serial clock device + --enable-HOPFPCI + hopf 6039 PCI board + --enable-HPGPS + HP 58503A GPS receiver + --enable-IRIG s IRIG audio decoder + --enable-JJY + JJY receiver + --enable-JUPITER s Rockwell Jupiter GPS receiver + --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-NEOCLOCK4X + NeoClock4X DCF77 / TDF receiver + --enable-NMEA + NMEA GPS receiver + --enable-ONCORE s Motorola VP/UT Oncore GPS receiver + --enable-PALISADE s Palisade clock + --enable-PCF + Conrad parallel port radio clock + --enable-PST + PST/Traconex 1020 WWV/WWVH receiver + --enable-PTBACTS s PTB modem service + --enable-RIPENCC - RIPENCC specific Trimble driver + --enable-SHM s SHM clock attached thru shared memory + --enable-SPECTRACOM + Spectracom 8170/Netclock/2 WWVB receiver + --enable-TPRO s KSI/Odetics TPRO/S GPS receiver/IRIG interface + --enable-TRAK + TRAK 8810 GPS receiver + --enable-TRUETIME s Kinemetrics/TrueTime receivers + --enable-TT560 - TrueTime 560 IRIG-B decoder + --enable-ULINK + Ultralink WWVB receiver + --enable-USNO s USNO modem service + --enable-WWV s WWV Audio receiver + --enable-ZYFER + Zyfer GPStarplus receiver + --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-simulator - build/install the NTPD simulator? + --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 + --enable-irig-sawtooth s if we should enable the IRIG sawtooth filter + --enable-nist - if we should enable the NIST lockclock scheme + +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 + =openssl + --with-electricfence - compile with ElectricFence malloc debugger + --with-sntp - Build SNTP? + --with-arlib - Compile the async resolver library? + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +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.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +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` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# 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. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # 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/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $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 + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# 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 @@ -671,40 +1253,105 @@ 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:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - test -f "$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:$LINENO: 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" + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} >$cache_file 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 Kaveh Ghazi - 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= +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=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:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac fi -else - ac_n= ac_c='\c' ac_t= +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&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 + + + + + + + + + + + + + + + + + + + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -722,166 +1369,117 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: 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="$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. -echo $ac_n "checking host system type... $ac_c" 1>&6 -echo "configure:733: checking host system type" 1>&5 -if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } - # Make sure we can run config.sub. - if $ac_config_sub sun4 >/dev/null 2>&1; then :; else - { echo "configure: error: cannot run $ac_config_sub" 1>&2; exit 1; } - fi - - ac_cv_host_alias=$host - case "$ac_cv_host_alias" in - NONE) - case $nonopt in - NONE) - if ac_cv_host_alias=`$ac_config_guess`; then : - else { echo "configure: error: cannot guess host type; you must specify one" 1>&2; exit 1; } - fi ;; *) ac_cv_host_alias=$nonopt ;; - esac ;; - esac - - ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || exit 1 - ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$as_me:$LINENO: 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 - echo $ac_n "(cached) $ac_c" 1>&6 + 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:$LINENO: 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:$LINENO: 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 "$ac_t""$ac_cv_host" 1>&6 - -host=$ac_cv_host -host_alias=$ac_cv_host_alias -host_cpu=$ac_cv_host_cpu -host_vendor=$ac_cv_host_vendor -host_os=$ac_cv_host_os - -echo $ac_n "checking target system type... $ac_c" 1>&6 -echo "configure:769: checking target system type" 1>&5 -if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then - - # Make sure we can run config.sub. - if $ac_config_sub sun4 >/dev/null 2>&1; then :; else - { echo "configure: error: cannot run $ac_config_sub" 1>&2; exit 1; } - fi - - ac_cv_target_alias=$target - case "$ac_cv_target_alias" in - NONE) - case $nonopt in - NONE) - ac_cv_target_alias=$host_alias ;; - *) ac_cv_target_alias=$nonopt ;; - esac ;; - esac - - ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || exit 1 - ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -else - echo $ac_n "(cached) $ac_c" 1>&6 -fi - -echo "$ac_t""$ac_cv_target" 1>&6 - -target=$ac_cv_target -target_alias=$ac_cv_target_alias -target_cpu=$ac_cv_target_cpu -target_vendor=$ac_cv_target_vendor -target_os=$ac_cv_target_os - -echo $ac_n "checking build system type... $ac_c" 1>&6 -echo "configure:804: checking build system type" 1>&5 -if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then - - # Make sure we can run config.sub. - if $ac_config_sub sun4 >/dev/null 2>&1; then :; else - { echo "configure: error: cannot run $ac_config_sub" 1>&2; exit 1; } - fi - - ac_cv_build_alias=$build - case "$ac_cv_build_alias" in - NONE) - case $nonopt in - NONE) - ac_cv_build_alias=$host_alias ;; - *) ac_cv_build_alias=$nonopt ;; - esac ;; - esac - - ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || exit 1 - ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -else - echo $ac_n "(cached) $ac_c" 1>&6 -fi - -echo "$ac_t""$ac_cv_build" 1>&6 - +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build -build_alias=$ac_cv_build_alias -build_cpu=$ac_cv_build_cpu -build_vendor=$ac_cv_build_vendor -build_os=$ac_cv_build_os +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:$LINENO: 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:$LINENO: 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:$LINENO: 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:$LINENO: 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:$LINENO: 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:$LINENO: 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/'` -# 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. # 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 - -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 <>confdefs.h <<_ACEOF +#define STR_SYSTEM "$host" +_ACEOF + + ac_config_headers="$ac_config_headers config.h" -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED >conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name=`echo $program_transform_name|sed -f conftestsed` - rm -f conftestsed -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" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed +am__api_version="1.7" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -889,58 +1487,67 @@ 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:898: checking for a BSD compatible install" 1>&5 +echo "$as_me:$LINENO: 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 test "${ac_cv_path_install+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # 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/*) ;; - *) - # 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 test $ac_prog = install && - 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 - fi - fi + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + 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:$LINENO: 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. @@ -950,401 +1557,1000 @@ 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:955: checking whether build environment is sane" 1>&5 +echo "$as_me:$LINENO: 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 + rm -f conftest.file + 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:$LINENO: 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:$LINENO: 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 +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -test x"${MISSING+set}" = xset || \ - MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing" -if eval "$MISSING --run :"; then +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= - echo "configure: warning: \`missing' script is too old or missing" 1>&2 + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk 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:1007: checking for $ac_word" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}... $ac_c" 1>&6 -echo "configure:1037: checking whether ${MAKE-make} sets \${MAKE}" 1>&5 -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 $ac_n "(cached) $ac_c" 1>&6 +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 else - cat >conftestmake <<\EOF + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: 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 >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # 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:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: 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 + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=ntp + VERSION=4.2.0 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + + +ac_cv_var_atom_ok=no +ac_cv_var_oncore_ok=no +ac_cv_var_ripe_ncc_ok=no +ac_cv_var_jupiter_ok=no + +iCFLAGS="$CFLAGS" + +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: 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="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" - : -fi -if test "x$enable_dependency_tracking" = xno; then - AMDEP="#" -else +fi; +if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" - if test ! -f "$am_depcomp"; then - AMDEP="#" - else - AMDEP= - fi -fi - -if test -z "$AMDEP"; then AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' else - AMDEPBACKSLASH= + AMDEP_TRUE='#' + AMDEP_FALSE= fi -if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then - DEPDIR=.deps + + +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:$LINENO: 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 - DEPDIR=_deps + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -PACKAGE=ntp - -VERSION=4.0.99i - -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 <>confdefs.h <&6 -echo "configure:1143: checking for $ac_word" 1>&5 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: 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 "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_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" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 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:1173: checking for $ac_word" 1>&5 + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +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:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: 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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: 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 "$as_me:$LINENO: 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" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +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" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" 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:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - 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 $ac_n "checking for $ac_word... $ac_c" 1>&6 -echo "configure:1224: checking for $ac_word" 1>&5 +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:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CC" && break +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + 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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: 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:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: 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:$LINENO: 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:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi fi - -test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works... $ac_c" 1>&6 -echo "configure:1259: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" 1>&5 - -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 - -cat >conftest.$ac_ext <&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 - else - ac_cv_prog_cc_cross=yes - 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 "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -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 77; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler... $ac_c" 1>&6 -echo "configure:1301: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" 1>&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross +rm -f a.out a.exe conftest$ac_cv_exeext b.out +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:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 -echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 -echo "configure:1306: checking whether we are using GNU C" 1>&5 -if test "${ac_cv_prog_gcc+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done else - cat >conftest.c <&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: 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 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me #endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - GCC= -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -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:1333: checking whether ${CC-cc} accepts -g" 1>&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:$LINENO: 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:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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" @@ -1358,102 +2564,270 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo $ac_n "checking how to run the C preprocessor... $ac_c" 1>&6 -echo "configure:1364: checking how to run the C preprocessor" 1>&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= fi -if test -z "$CPP"; then -if test "${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" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat >conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1385: \"$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 - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat >conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1402: \"$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 - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat >conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1419: \"$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 - : -else - echo "$ac_err" >&5 - echo "configure: 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" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC -depcc="$CC" -depcpp="$CPP" -echo $ac_n "checking dependency style of $depcc... $ac_c" 1>&6 -echo "configure:1446: checking dependency style of $depcc" 1>&5 +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + '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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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 + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - -if test -z "$AMDEP"; then - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; 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 conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub am_cv_CC_dependencies_compiler_type=none - for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do - case "$depmode" in + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # 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. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested @@ -1465,134 +2839,1920 @@ if test -z "$AMDEP"; then ;; none) break ;; esac - 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 && - grep conftest.h conftest.Po > /dev/null 2>&1; then - am_cv_CC_dependencies_compiler_type="$depmode" - break + # 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=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi fi done - rm -f conftest.* + cd .. + rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi +echo "$as_me:$LINENO: 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 "$ac_t""$am_cv_CC_dependencies_compiler_type" 1>&6 -CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" -echo $ac_n "checking how to run the C preprocessor... $ac_c" 1>&6 -echo "configure:1490: checking how to run the C preprocessor" 1>&5 + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +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 +echo "$as_me:$LINENO: 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 test "${ac_cv_prog_CPP+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + 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. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat >conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1511: \"$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 + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat >conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1528: \"$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 - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat >conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1545: \"$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 - : -else - echo "$ac_err" >&5 - echo "configure: 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" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -case "$target" in + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: 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. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&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 + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + + +echo "$as_me:$LINENO: checking for AIX" >&5 +echo $ECHO_N "checking for AIX... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef _AIX + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define _ALL_SOURCE 1 +_ACEOF + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest* + + +echo "$as_me:$LINENO: 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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 + +#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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: 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 <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo "$as_me:$LINENO: 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 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking minix/config.h usability" >&5 +echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking minix/config.h presence" >&5 +echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: 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 + ac_cv_header_minix_config_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 + +fi +if test $ac_cv_header_minix_config_h = yes; then + MINIX=yes +else + MINIX= +fi + + +if test "$MINIX" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_SOURCE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_1_SOURCE 2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _MINIX 1 +_ACEOF + +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 +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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: 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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: 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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: 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 "$as_me:$LINENO: 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_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + 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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: 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 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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:$LINENO: 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:$LINENO: 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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 +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + '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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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 + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: 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_TRUE" && test -f "$am_depcomp"; 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 conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # 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. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + 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=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: 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 + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +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 +echo "$as_me:$LINENO: 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 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 + 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. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: 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. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # 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 + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&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 + + +case "$host" in + *-*-amigaos) + CFLAGS="$CFLAGS -Dfork=vfork -DSYS_AMIGA" + ;; *-pc-cygwin*) CFLAGS="$CFLAGS -DSYS_CYGWIN32" ;; i386-sequent-sysv4) case "$CC" in cc) - CFLAGS="$CFLAGS -Wc,+Abi-socket" + CFLAGS="$CFLAGS -Wc,+abi-socket" ;; esac ;; - alpha*-dec-osf*) - case "$CC" in - cc) - CFLAGS="$CFLAGS -std1" - ;; - esac + *-*-mpeix*) + CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB" + LDFLAGS="$LDFLAGS -L/SYSLOG/PUB" + LIBS="$LIBS -lcurses" ;; esac -case "$host" in - $target) +echo "$as_me:$LINENO: checking if we should use /dev/clockctl" >&5 +echo $ECHO_N "checking if we should use /dev/clockctl... $ECHO_C" >&6 +if test "${ac_clockctl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Check whether --enable-clockctl or --disable-clockctl was given. +if test "${enable_clockctl+set}" = set; then + enableval="$enable_clockctl" + ans=$enableval +else + case "$target" in + *-*-netbsd*) + ans=yes + ;; + *) ans=no + ;; + esac + +fi; +ac_clockctl=$ans +fi +echo "$as_me:$LINENO: result: $ac_clockctl" >&5 +echo "${ECHO_T}$ac_clockctl" >&6 +# End of AC_CACHE_CHECK for clockctl + +for ac_header in sys/clockctl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 ;; - *) case "$target" in + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +case "$ac_clockctl$ac_cv_header_sys_clockctl_h" in + yesyes) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CLOCKCTL +_ACEOF + + ;; +esac + +case "$build" in + $host) + ;; + *) 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:$LINENO: 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" @@ -1601,108 +4761,98 @@ case "$host" in ;; esac -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk 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:1610: checking for $ac_word" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}... $ac_c" 1>&6 -echo "configure:1640: checking whether ${MAKE-make} sets \${MAKE}" 1>&5 -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 $ac_n "(cached) $ac_c" 1>&6 +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 else - cat >conftestmake <<\EOF + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: 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 >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # 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:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: 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:1681: checking whether ${CC-cc} -pipe works" 1>&5 -if test "${ac_cv_prog_cc_pipe+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -pipe -c conftest.c 2>&1`" -a -s conftest.o; then - ac_cv_prog_cc_pipe=yes - else - ac_cv_prog_cc_pipe=no - fi - rm -f conftest* - -fi -echo "$ac_t""$ac_cv_prog_cc_pipe" 1>&6 - - case "$ac_cv_prog_cc_pipe" in - yes) - CFLAGS="$CFLAGS -pipe" - ;; - esac ;; esac ac_busted_vpath_in_make=no -case "$target" in +case "$host" in *-next-nextstep3) CFLAGS="$CFLAGS -posix" ;; @@ -1716,6 +4866,7 @@ case "$target" in case "$CFLAGS" in *-n32*) ;; *-n64*) ;; + *-64*) ;; *) case "$iCFLAGS" in '') CFLAGS="-O2 -g3 -n32" ;; *) CFLAGS="$CFLAGS -n32" ;; @@ -1725,6 +4876,7 @@ case "$target" in case "$LDFLAGS" in *-n32*) ;; *-n64*) ;; + *-64*) ;; *) LDFLAGS="$LDFLAGS -n32" ;; esac fi @@ -1732,6 +4884,9 @@ case "$target" in *-*-solaris2.5.1) ac_busted_vpath_in_make=yes ;; + *-*-unicosmp*) + ac_busted_vpath_in_make=yes + ;; esac case "$ac_busted_vpath_in_make$srcdir" in @@ -1739,267 +4894,447 @@ 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:$LINENO: 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:1751: checking whether ln -s works" 1>&5 -if test "${ac_cv_prog_LN_S+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: 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:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&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 -else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: 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:1773: checking whether ${CC-cc} needs -traditional" 1>&5 +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TIOCGETP -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "$ac_pattern" >/dev/null 2>&1; then 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TCGETA -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "$ac_pattern" >/dev/null 2>&1; then 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:$LINENO: 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:1817: checking for AIX" 1>&5 -cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking for working volatile... $ECHO_C" >&6 +if test "${ac_cv_c_volatile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + +volatile int x; +int * volatile y; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_volatile=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_volatile=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 +echo "${ECHO_T}$ac_cv_c_volatile" >&6 +if test $ac_cv_c_volatile = no; then + +cat >>confdefs.h <<\_ACEOF +#define volatile +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" #endif - -EOF -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 -#define _ALL_SOURCE 1 -EOF - +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" else - rm -rf conftest* - echo "$ac_t""no" 1>&6 -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo $ac_n "checking for minix/config.h... $ac_c" 1>&6 -echo "configure:1841: checking for minix/config.h" 1>&5 -if test "${ac_cv_header_minix_config_h+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break else - cat >conftest.$ac_ext < + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1852: \"$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* - ac_cv_header_minix_config_h=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_minix_config_h=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done fi -echo "$ac_t""$ac_cv_header_minix_config_h" 1>&6 -if test $ac_cv_header_minix_config_h = yes; then - MINIX=yes -else - MINIX= +LIBS=$ac_func_search_save_LIBS fi - -if test "$MINIX" = yes; then - cat >>confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - cat >>confdefs.h <<\EOF -#define _POSIX_1_SOURCE 2 -EOF - - cat >>confdefs.h <<\EOF -#define _MINIX 1 -EOF +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" fi -echo $ac_n "checking for POSIXized ISC... $ac_c" 1>&6 -echo "configure:1889: checking for POSIXized ISC" 1>&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >>confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi -else - echo "$ac_t""no" 1>&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:1912: checking for $ac_word" 1>&5 +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:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +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:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: 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:$LINENO: 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 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +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:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: 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:1942: checking for $ac_word" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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. ;; *) - 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" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PATH_SH="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +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:$LINENO: result: $PATH_SH" >&5 +echo "${ECHO_T}$PATH_SH" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: 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 $ac_n "checking for $ac_word... $ac_c" 1>&6 -echo "configure:1974: checking for $ac_word" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$PATH_PERL" in - /* | ?:/*) + case $PATH_PERL in + [\\/]* | ?:[\\/]*) ac_cv_path_PATH_PERL="$PATH_PERL" # Let the user override the test with a 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_PERL="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PATH_PERL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + ;; esac fi -PATH_PERL="$ac_cv_path_PATH_PERL" +PATH_PERL=$ac_cv_path_PATH_PERL + if test -n "$PATH_PERL"; then - echo "$ac_t""$PATH_PERL" 1>&6 + echo "$as_me:$LINENO: result: $PATH_PERL" >&5 +echo "${ECHO_T}$PATH_PERL" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -case "$target" in + + + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 <<\_ACEOF +#define ULONG_CONST(a) a ## UL +_ACEOF + +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 <<\_ACEOF +#define ULONG_CONST(a) a/**/L +_ACEOF + +else + { { echo "$as_me:$LINENO: 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 "$host" in *-*-vxworks*) ac_link="$ac_link $VX_KERNEL" ;; @@ -2012,58 +5347,67 @@ 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:2021: checking for a BSD compatible install" 1>&5 +echo "$as_me:$LINENO: 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 test "${ac_cv_path_install+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # 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/*) ;; - *) - # 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 test $ac_prog = install && - 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 - fi - fi + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + 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:$LINENO: 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. @@ -2073,45 +5417,62 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -case "$target" in + +case "$host" in *-pc-cygwin*) - echo $ac_n "checking for main in -ladvapi32... $ac_c" 1>&6 -echo "configure:2080: checking for main in -ladvapi32" 1>&5 + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + int -main() +main () { -main() +main (); ; return 0; } -EOF -if { (eval echo configure:2098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_advapi32_main=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_advapi32_main=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_advapi32_main=no fi -echo "$ac_t""$ac_cv_lib_advapi32_main" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBADVAPI32 1 -EOF +_ACEOF LIBS="-ladvapi32 $LIBS" @@ -2119,276 +5480,388 @@ fi ;; esac -echo $ac_n "checking for nlist in -lelf... $ac_c" 1>&6 -echo "configure:2124: checking for nlist in -lelf" 1>&5 -if test "${ac_cv_lib_elf_nlist+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lelf $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lelf $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -nlist() +nlist (); ; return 0; } -EOF -if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_elf_nlist=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_elf_nlist=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_elf_nlist=no fi -echo "$ac_t""$ac_cv_lib_elf_nlist" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBELF 1 -EOF +_ACEOF LIBS="-lelf $LIBS" fi -echo $ac_n "checking for main in -lkvm... $ac_c" 1>&6 -echo "configure:2170: checking for main in -lkvm" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + int -main() +main () { -main() +main (); ; return 0; } -EOF -if { (eval echo configure:2188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_kvm_main=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_kvm_main=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_kvm_main=no fi -echo "$ac_t""$ac_cv_lib_kvm_main" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 -EOF +_ACEOF LIBS="-lkvm $LIBS" fi - echo $ac_n "checking for nlist in -lld... $ac_c" 1>&6 -echo "configure:2211: checking for nlist in -lld" 1>&5 -if test "${ac_cv_lib_ld_nlist+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lld $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -nlist() +nlist (); ; return 0; } -EOF -if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_ld_nlist=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_ld_nlist=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_ld_nlist=no fi -echo "$ac_t""$ac_cv_lib_ld_nlist" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBLD 1 -EOF +_ACEOF LIBS="-lld $LIBS" fi -echo $ac_n "checking for nlist in -lmld... $ac_c" 1>&6 -echo "configure:2257: checking for nlist in -lmld" 1>&5 -if test "${ac_cv_lib_mld_nlist+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lmld $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lmld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -nlist() +nlist (); ; return 0; } -EOF -if { (eval echo configure:2279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_mld_nlist=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_mld_nlist=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_mld_nlist=no fi -echo "$ac_t""$ac_cv_lib_mld_nlist" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBMLD 1 -EOF +_ACEOF LIBS="-lmld $LIBS" fi -echo $ac_n "checking for gethostent... $ac_c" 1>&6 -echo "configure:2303: checking for gethostent" 1>&5 +echo "$as_me:$LINENO: checking for gethostent" >&5 +echo $ECHO_N "checking for gethostent... $ECHO_C" >&6 if test "${ac_cv_func_gethostent+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostent(); below. */ -#include + which can conflict with char gethostent (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostent(); -char (*f)(); - -int -main() +#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 (); /* 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 -f = gethostent; +char (*f) () = gethostent; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != gethostent; ; return 0; } -EOF -if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_gethostent=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_gethostent=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_gethostent=no fi -echo "$ac_t""$ac_cv_func_gethostent" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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_n "checking for gethostent in -lnsl... $ac_c" 1>&6 -echo "configure:2353: checking for gethostent in -lnsl" 1>&5 -if test "${ac_cv_lib_nsl_gethostent+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lnsl -lsocket $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lnsl -lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -gethostent() +gethostent (); ; return 0; } -EOF -if { (eval echo configure:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostent=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_nsl_gethostent=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_nsl_gethostent=no fi -echo "$ac_t""$ac_cv_lib_nsl_gethostent" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 -EOF +_ACEOF LIBS="-lnsl $LIBS" @@ -2396,190 +5869,910 @@ fi fi -echo $ac_n "checking for openlog... $ac_c" 1>&6 -echo "configure:2401: checking for openlog" 1>&5 +echo "$as_me:$LINENO: checking for openlog" >&5 +echo $ECHO_N "checking for openlog... $ECHO_C" >&6 if test "${ac_cv_func_openlog+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char openlog(); below. */ -#include + which can conflict with char openlog (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char openlog(); -char (*f)(); - -int -main() +#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 (); /* 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 -f = openlog; +char (*f) () = openlog; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != openlog; ; return 0; } -EOF -if { (eval echo configure:2434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_openlog=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_openlog=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_openlog=no fi -echo "$ac_t""$ac_cv_func_openlog" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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_n "checking for openlog in -lgen... $ac_c" 1>&6 -echo "configure:2451: checking for openlog in -lgen" 1>&5 -if test "${ac_cv_lib_gen_openlog+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lgen $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lgen $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -openlog() +openlog (); ; return 0; } -EOF -if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_gen_openlog=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_gen_openlog=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_gen_openlog=no fi -echo "$ac_t""$ac_cv_lib_gen_openlog" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBGEN 1 -EOF +_ACEOF LIBS="-lgen $LIBS" -fi - -fi - -echo $ac_n "checking for sched_setscheduler in -lrt... $ac_c" 1>&6 -echo "configure:2499: checking for sched_setscheduler in -lrt" 1>&5 -if test "${ac_cv_lib_rt_sched_setscheduler+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lrt $LIBS" -cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking for openlog in -lsyslog... $ECHO_C" >&6 +if test "${ac_cv_lib_syslog_openlog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsyslog -lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -sched_setscheduler() +openlog (); ; return 0; } -EOF -if { (eval echo configure:2521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_syslog_openlog=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_syslog_openlog=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_syslog_openlog" >&5 +echo "${ECHO_T}$ac_cv_lib_syslog_openlog" >&6 +if test $ac_cv_lib_syslog_openlog = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSYSLOG 1 +_ACEOF + + LIBS="-lsyslog $LIBS" + +fi + +fi + +fi + + +echo "$as_me:$LINENO: checking for MD5Init in -lmd5" >&5 +echo $ECHO_N "checking for MD5Init in -lmd5... $ECHO_C" >&6 +if test "${ac_cv_lib_md5_MD5Init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmd5 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 MD5Init (); +int +main () +{ +MD5Init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_md5_MD5Init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_md5_MD5Init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_md5_MD5Init" >&5 +echo "${ECHO_T}$ac_cv_lib_md5_MD5Init" >&6 +if test $ac_cv_lib_md5_MD5Init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMD5 1 +_ACEOF + + LIBS="-lmd5 $LIBS" + +else + +echo "$as_me:$LINENO: checking for MD5Init in -lmd" >&5 +echo $ECHO_N "checking for MD5Init in -lmd... $ECHO_C" >&6 +if test "${ac_cv_lib_md_MD5Init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 MD5Init (); +int +main () +{ +MD5Init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_md_MD5Init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_md_MD5Init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_md_MD5Init" >&5 +echo "${ECHO_T}$ac_cv_lib_md_MD5Init" >&6 +if test $ac_cv_lib_md_MD5Init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMD 1 +_ACEOF + + LIBS="-lmd $LIBS" + +fi + +fi + + +for ac_func in MD5Init +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +for ac_header in readline/history.h readline/readline.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in + *no*) ;; + *) save_LIBS=$LIBS + LIBS= + +echo "$as_me:$LINENO: 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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_readline_readline=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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:$LINENO: 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 <<_ACEOF +#define HAVE_LIBREADLINE 1 +_ACEOF + + LIBS="-lreadline $LIBS" + +else + { echo "$as_me:$LINENO: Trying again with -lcurses" >&5 +echo "$as_me: Trying again with -lcurses" >&6;} + unset ac_cv_lib_readline_readline + echo "$as_me:$LINENO: 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 -lcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_readline_readline=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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:$LINENO: 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 + LIBS="-lreadline -lcurses $LIBS" + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBREADLINE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBCURSES +_ACEOF + +else + echo "$as_me:$LINENO: checking for readline in -ledit" >&5 +echo $ECHO_N "checking for readline in -ledit... $ECHO_C" >&6 +if test "${ac_cv_lib_edit_readline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ledit -lcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_edit_readline=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_edit_readline=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_edit_readline" >&5 +echo "${ECHO_T}$ac_cv_lib_edit_readline" >&6 +if test $ac_cv_lib_edit_readline = yes; then + LIBS="-ledit -lcurses" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBEDIT +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBCURSES +_ACEOF + + +fi + + +fi + +fi + + READLINE_LIBS=$LIBS + + LIBS=$save_LIBS + ;; +esac + + +case "$host" in + *-*-linux*) ;; + *) + +echo "$as_me:$LINENO: 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_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_rt_sched_setscheduler=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_rt_sched_setscheduler=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_rt_sched_setscheduler=no fi -echo "$ac_t""$ac_cv_lib_rt_sched_setscheduler" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBRT 1 -EOF +_ACEOF LIBS="-lrt $LIBS" else - echo $ac_n "checking for sched_setscheduler in -lposix4... $ac_c" 1>&6 -echo "configure:2544: checking for sched_setscheduler in -lposix4" 1>&5 -if test "${ac_cv_lib_posix4_sched_setscheduler+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lposix4 $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -sched_setscheduler() +sched_setscheduler (); ; return 0; } -EOF -if { (eval echo configure:2566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_posix4_sched_setscheduler=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_posix4_sched_setscheduler=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_posix4_sched_setscheduler=no fi -echo "$ac_t""$ac_cv_lib_posix4_sched_setscheduler" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBPOSIX4 1 -EOF +_ACEOF LIBS="-lposix4 $LIBS" @@ -2587,97 +6780,143 @@ fi fi -echo $ac_n "checking for setsockopt... $ac_c" 1>&6 -echo "configure:2592: checking for setsockopt" 1>&5 + ;; +esac + +echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 if test "${ac_cv_func_setsockopt+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char setsockopt(); below. */ -#include + which can conflict with char setsockopt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char setsockopt(); -char (*f)(); - -int -main() +#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 (); /* 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 -f = setsockopt; +char (*f) () = setsockopt; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != setsockopt; ; return 0; } -EOF -if { (eval echo configure:2625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_setsockopt=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_setsockopt=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_setsockopt=no fi -echo "$ac_t""$ac_cv_func_setsockopt" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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_n "checking for setsockopt in -lsocket... $ac_c" 1>&6 -echo "configure:2642: checking for setsockopt in -lsocket" 1>&5 -if test "${ac_cv_lib_socket_setsockopt+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <&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_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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() +main () { -setsockopt() +setsockopt (); ; return 0; } -EOF -if { (eval echo configure:2664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_lib_socket_setsockopt=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_lib_socket_setsockopt=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -LIBS="$ac_save_LIBS" +ac_cv_lib_socket_setsockopt=no fi -echo "$ac_t""$ac_cv_lib_socket_setsockopt" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 -EOF +_ACEOF LIBS="-lsocket $LIBS" @@ -2685,48 +6924,69 @@ fi fi -echo $ac_n "checking for ANSI C header files... $ac_c" 1>&6 -echo "configure:2690: checking for ANSI C header files" 1>&5 + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2704: \"$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* +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.$ac_objext 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2735,17 +6995,20 @@ 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2754,18 +7017,23 @@ 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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') \ +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) @@ -2782,672 +7050,4084 @@ main () exit(2); exit (0); } -EOF -if { (eval echo configure:2787: \"$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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 -fi -rm -fr conftest* + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no fi - +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +fi +echo "$as_me:$LINENO: 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 <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -for ac_header in bstring.h errno.h fcntl.h memory.h netdb.h poll.h + + + + + +for ac_header in bstring.h errno.h fcntl.h ieeefp.h math.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:2814: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2825: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -for ac_header in resolv.h sched.h sgtty.h stdlib.h string.h termio.h termios.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:2852: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# HMS: Lame, but fast. +if test -f /etc/redhat-release +then + : else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2863: \"$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_ac_Header=yes" +for ac_header in md5.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -for ac_header in timepps.h timex.h unistd.h utmp.h utmpx.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:2890: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < +fi -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2901: \"$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_ac_Header=yes" + + +for ac_header in memory.h netdb.h poll.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -for ac_header in arpa/nameser.h net/if.h netinet/in_systm.h netinet/in.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:2928: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2939: \"$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_ac_Header=yes" + + + + +for ac_header in sched.h sgtty.h stdlib.h string.h termio.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done + + + + +for ac_header in termios.h timepps.h timex.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +case "$host" in + *-*-aix*) + +for ac_header in utmpx.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + case "$ac_cv_header_utmpx_h" in + yes) ;; + *) +for ac_header in utmp.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + ;; + esac + ;; + *) + +for ac_header in utmp.h utmpx.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + ;; +esac + +for ac_header in arpa/nameser.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in net/if.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if HAVE_SYS_SOCKET_H +#include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in net/if6.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in netinet/in_system.h netinet/in_systm.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in netinet/in.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in netinet/ip.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_NETINET_IN_SYSTM_H +#include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + for ac_header in netinfo/ni.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:2966: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2977: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <>confdefs.h <<\EOF -#define HAVE_NETINFO 1 -EOF +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define HAVE_NETINFO 1 +_ACEOF + +fi + done + + for ac_header in sun/audioio.h sys/audioio.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3007: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3018: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done + + for ac_header in sys/clkdefs.h sys/file.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3045: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3056: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -case "$target" in +case "$host" in *-*-sunos4*) ;; - *) for ac_header in sys/ioctl.h + *) +for ac_header in sys/ioctl.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3085: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3096: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done ;; esac + +for ac_header in sys/ipc.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + for ac_header in sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3125: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3136: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done + + + + for ac_header in sys/ppstime.h sys/proc.h sys/resource.h sys/sched.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3163: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3174: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -case "$target" in +case "$host" in *-*-sco*) - for ac_header in sys/sio.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3203: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3214: \"$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_ac_Header=yes" +for ac_header in sys/sio.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done ;; esac -for ac_header in sys/select.h sys/sockio.h sys/stat.h sys/stream.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3243: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3254: \"$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_ac_Header=yes" + + + +for ac_header in sys/select.h sys/shm.h sys/signal.h sys/sockio.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -for ac_header in sys/stropts.h sys/sysctl.h sys/syssgi.h sys/termios.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3281: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -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_ac_Header=yes" + +for ac_header in machine/soundcard.h sys/soundcard.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -for ac_header in sys/time.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3319: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3330: \"$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_ac_Header=yes" + +for ac_header in sys/stat.h sys/stream.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + +for ac_header in sys/termios.h sys/time.h sys/signal.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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_header in sys/timepps.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3369: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < + $EGREP "yes" >/dev/null 2>&1; then -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3380: \"$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_ac_Header=yes" +for ac_header in sys/timepps.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done fi rm -f conftest* + + + + + for ac_header in sys/timers.h sys/timex.h sys/tpro.h sys/types.h sys/wait.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3410: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3421: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -echo $ac_n "checking whether time.h and sys/time.h may both be included... $ac_c" 1>&6 -echo "configure:3445: checking whether time.h and sys/time.h may both be included" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -3455,153 +11135,484 @@ else int main () { -struct tm *tp; +if ((struct tm *) 0) +return 0; ; return 0; } -EOF -if { (eval echo configure:3464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define TIME_WITH_SYS_TIME 1 -EOF +_ACEOF fi -case "$target" in +case "$host" in *-convex-*) - for ac_header in /sys/sync/queue.h /sys/sync/sema.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3489: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3500: \"$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_ac_Header=yes" + +for ac_header in /sys/sync/queue.h /sys/sync/sema.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done ;; *-*-bsdi*) - for ac_header in machine/inline.h sys/pcl720.h sys/i8253.h -do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3529: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3540: \"$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_ac_Header=yes" + + +for ac_header in machine/inline.h sys/pcl720.h sys/i8253.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done ;; esac -echo $ac_n "checking for nlist.h... $ac_c" 1>&6 -echo "configure:3567: checking for nlist.h" 1>&5 if test "${ac_cv_header_nlist_h+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: 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 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_nlist_h" >&5 +echo "${ECHO_T}$ac_cv_header_nlist_h" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking nlist.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3578: \"$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* - ac_cv_header_nlist_h=yes +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_nlist_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking nlist.h presence" >&5 +echo $ECHO_N "checking nlist.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: nlist.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: nlist.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: nlist.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: nlist.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: nlist.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: nlist.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: nlist.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: nlist.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: nlist.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: nlist.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: 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 + ac_cv_header_nlist_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_nlist_h" >&5 +echo "${ECHO_T}$ac_cv_header_nlist_h" >&6 + fi -echo "$ac_t""$ac_cv_header_nlist_h" 1>&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:3599: checking for n_un in struct nlist" 1>&5 +cat >>confdefs.h <<\_ACEOF +#define NLIST_STRUCT 1 +_ACEOF + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int main () @@ -3610,36 +11621,116 @@ struct nlist n; n.n_un.n_name = 0; ; return 0; } -EOF -if { (eval echo configure:3615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define NLIST_NAME_UNION 1 -EOF +_ACEOF fi fi -echo $ac_n "checking for basic volatile support... $ac_c" 1>&6 -echo "configure:3637: checking for basic volatile support" 1>&5 -if test "${ac_cv_c_volatile+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + + + +for ac_header in resolv.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3649,41 +11740,54 @@ volatile int x; ; return 0; } -EOF -if { (eval echo configure:3654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 -EOF + *) +cat >>confdefs.h <<\_ACEOF +#define volatile +_ACEOF ;; esac -case "$target" in +case "$host" in sparc-*-solaris2*) # Assume that solaris2 is Ansi C... ;; *) - -echo $ac_n "checking for ${CC-cc} option to accept ANSI C... $ac_c" 1>&6 -echo "configure:3685: checking for ${CC-cc} option to accept ANSI C" 1>&5 + + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else am_cv_prog_cc_stdc=no ac_save_CC="$CC" @@ -3697,9 +11801,13 @@ 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -3738,85 +11846,124 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } -EOF -if { (eval echo configure:3743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 else - echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 + echo "$as_me:$LINENO: 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:3767: checking for function prototypes" 1>&5 + + +echo "$as_me:$LINENO: 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:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF #define PROTOTYPES 1 -EOF +_ACEOF U= ANSI2KNR= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: 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:3780: checking for ANSI C header files" 1>&5 +fi +# Ensure some checks needed by ansi2knr itself. +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3794: \"$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* +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.$ac_objext 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -3825,17 +11972,20 @@ 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -3844,18 +11994,23 @@ 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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') \ +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) @@ -3872,80 +12027,198 @@ main () exit(2); exit (0); } -EOF -if { (eval echo configure:3877: \"$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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 -fi -rm -fr conftest* + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no fi - +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +fi +echo "$as_me:$LINENO: 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 <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi - for ac_header in string.h + +for ac_header in string.h do -ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` -echo $ac_n "checking for $ac_header... $ac_c" 1>&6 -echo "configure:3904: checking for $ac_header" 1>&5 -if eval "test \"\${$ac_ac_Header+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include <$ac_header> - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3915: \"$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_ac_Header=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_Header=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 -echo "$ac_t""`eval echo '${'$ac_ac_Header'}'`" 1>&6 -if test `eval echo '${'$ac_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -fi ;; esac -echo $ac_n "checking if C compiler permits function prototypes... $ac_c" 1>&6 -echo "configure:3943: checking if C compiler permits function prototypes" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ extern int foo (short); int foo(short i) { return i; } @@ -3957,112 +12230,51 @@ int i; ; return 0; } -EOF -if { (eval echo configure:3962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_PROTOTYPES 1 -EOF +_ACEOF fi -echo $ac_n "checking for ${CC-cc} option to accept ANSI C... $ac_c" 1>&6 -echo "configure:3983: checking for ${CC-cc} option to accept ANSI C" 1>&5 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC="$CC" -# 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" - cat >conftest.$ac_ext < -#include -#include -#include -/* 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; -} -EOF -if { (eval echo configure:4038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_prog_cc_stdc="$ac_arg"; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -CC="$ac_save_CC" - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$ac_t""none needed" 1>&6 ;; - *) - echo "$ac_t""$ac_cv_prog_cc_stdc" 1>&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -echo $ac_n "checking for an ANSI C conforming const... $ac_c" 1>&6 -echo "configure:4060: checking for an ANSI C conforming const" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4117,38 +12329,51 @@ main () ; return 0; } -EOF -if { (eval echo configure:4122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -case "$host" in - $target) - echo $ac_n "checking whether byte ordering is bigendian... $ac_c" 1>&6 -echo "configure:4144: checking whether byte ordering is bigendian" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -4162,13 +12387,27 @@ main () ; return 0; } -EOF -if { (eval echo configure:4167: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -4182,29 +12421,93 @@ main () ; return 0; } -EOF -if { (eval echo configure:4187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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 -fi -rm -f conftest* -if test $ac_cv_c_bigendian = unknown; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. if test "$cross_compiling" = yes; then - { echo "configure: error: cannot run test program while cross compiling" 1>&2; exit 1; } + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi else - cat >conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () { @@ -4217,54 +12520,63 @@ main () u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } -EOF -if { (eval echo configure:4222: \"$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:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 -fi -rm -fr conftest* + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_bigendian=yes fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) -fi -fi -echo "$ac_t""$ac_cv_c_bigendian" 1>&6 -if test $ac_cv_c_bigendian = yes; then - cat >>confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 -EOF - -fi - - ;; - *) case "$target" in - i*86-*-vxworks*) - # LITTLEENDIAN - ;; - *-*-vxworks*) - cat >>confdefs.h <<\EOF -#define WORDS_BIGENDIAN 1 -EOF - - ;; - *) { echo "configure: error: Cross-compiling needs explicit byte order" 1>&2; exit 1; } - ;; - esac - ;; +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking return type of signal handlers... $ac_c" 1>&6 -echo "configure:4262: checking return type of signal handlers" 1>&5 + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #ifdef signal @@ -4283,31 +12595,48 @@ int i; ; return 0; } -EOF -if { (eval echo configure:4288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >>confdefs.h <&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo $ac_n "checking for off_t... $ac_c" 1>&6 -echo "configure:4305: checking for off_t" 1>&5 +ac_cv_type_signal=int +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -4319,36 +12648,52 @@ if (sizeof (off_t)) ; return 0; } -EOF -if { (eval echo configure:4324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_off_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_off_t=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define off_t long -EOF +_ACEOF fi -echo $ac_n "checking for size_t... $ac_c" 1>&6 -echo "configure:4346: checking for size_t" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -4360,36 +12705,52 @@ if (sizeof (size_t)) ; return 0; } -EOF -if { (eval echo configure:4365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_size_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_size_t=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define size_t unsigned -EOF +_ACEOF fi -echo $ac_n "checking for time_t... $ac_c" 1>&6 -echo "configure:4387: checking for time_t" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -4401,36 +12762,52 @@ if (sizeof (time_t)) ; return 0; } -EOF -if { (eval echo configure:4406: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_time_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_time_t=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define time_t long -EOF +_ACEOF fi -echo $ac_n "checking whether struct tm is in sys/time.h or time.h... $ac_c" 1>&6 -echo "configure:4428: checking whether struct tm is in sys/time.h or time.h" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -4441,33 +12818,152 @@ struct tm *tp; tp->tm_sec; ; return 0; } -EOF -if { (eval echo configure:4446: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define TM_IN_SYS_TIME 1 -EOF +_ACEOF fi -echo $ac_n "checking for a fallback value for HZ... $ac_c" 1>&6 -echo "configure:4466: checking for a fallback value for HZ" 1>&5 + +echo "$as_me:$LINENO: checking for u_int8_t" >&5 +echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +u_int8_t len = 42; return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int8_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int8_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int8_t" >&6 +if test $ac_cv_type_u_int8_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_U_INT8_T 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int64_t" >&5 +echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +u_int64_t len = 42; return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int64_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6 +if test $ac_cv_type_u_int64_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_U_INT64_T 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_default_hz=100 -case "$target" in +case "$host" in alpha*-dec-osf4*|alpha*-dec-osf5*) ac_cv_var_default_hz=1024 ;; @@ -4476,18 +12972,21 @@ case "$target" in ;; esac fi -echo "$ac_t""$ac_cv_var_default_hz" 1>&6 -cat >>confdefs.h <&5 +echo "${ECHO_T}$ac_cv_var_default_hz" >&6 -echo $ac_n "checking if we need to override the system's value for HZ... $ac_c" 1>&6 -echo "configure:4486: checking if we need to override the system's value for HZ" 1>&5 +cat >>confdefs.h <<_ACEOF +#define DEFAULT_HZ $ac_cv_var_default_hz +_ACEOF + + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_override_hz=no -case "$target" in +case "$host" in alpha*-dec-osf4*|alpha*-dec-osf5*) ac_cv_var_override_hz=yes ;; @@ -4502,25 +13001,33 @@ case "$target" in ;; esac fi -echo "$ac_t""$ac_cv_var_override_hz" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define OVERRIDE_HZ 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking struct sigaction for sa_sigaction... $ac_c" 1>&6 -echo "configure:4517: checking struct sigaction for sa_sigaction" 1>&5 + + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int main () @@ -4529,37 +13036,53 @@ struct sigaction act; act.sa_sigaction = 0; ; return 0; } -EOF -if { (eval echo configure:4534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_struct_sigaction_has_sa_sigaction=no fi -echo "$ac_t""$ac_cv_struct_sigaction_has_sa_sigaction" 1>&6 +rm -f conftest.$ac_objext conftest.$ac_ext + + +fi +echo "$as_me:$LINENO: 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 <<\_ACEOF #define HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION 1 -EOF +_ACEOF fi -echo $ac_n "checking for struct ppsclockev... $ac_c" 1>&6 -echo "configure:4557: checking for struct ppsclockev" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_SYS_TERMIOS_H @@ -4580,35 +13103,51 @@ return pce->serial; ; return 0; } -EOF -if { (eval echo configure:4585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_STRUCT_PPSCLOCKEV 1 -EOF +_ACEOF fi -echo $ac_n "checking struct sockaddr for sa_len... $ac_c" 1>&6 -echo "configure:4606: checking struct sockaddr for sa_len" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -4621,35 +13160,240 @@ return ps->sa_len; ; return 0; } -EOF -if { (eval echo configure:4626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_SA_LEN_IN_STRUCT_SOCKADDR 1 -EOF +_ACEOF fi -echo $ac_n "checking struct clockinfo for hz... $ac_c" 1>&6 -echo "configure:4647: checking struct clockinfo for hz" 1>&5 -if test "${ac_cv_struct_clockinfo_has_hz+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for ss_family field in struct sockaddr_storage" >&5 +echo $ECHO_N "checking for ss_family field in struct sockaddr_storage... $ECHO_C" >&6 +if test "${ac_cv_have_ss_family_in_struct_ss+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + struct sockaddr_storage s; s.ss_family = 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_ss_family_in_struct_ss="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_ss_family_in_struct_ss="no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_have_ss_family_in_struct_ss" >&5 +echo "${ECHO_T}$ac_cv_have_ss_family_in_struct_ss" >&6 +if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SS_FAMILY_IN_SS 1 +_ACEOF + +else + # Hack around a problem... + case "$host" in + *-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H" + ;; + esac +fi + +echo "$as_me:$LINENO: checking for __ss_family field in struct sockaddr_storage" >&5 +echo $ECHO_N "checking for __ss_family field in struct sockaddr_storage... $ECHO_C" >&6 +if test "${ac_cv_have___ss_family_in_struct_ss+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + struct sockaddr_storage s; s.__ss_family = 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have___ss_family_in_struct_ss="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have___ss_family_in_struct_ss="no" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_have___ss_family_in_struct_ss" >&5 +echo "${ECHO_T}$ac_cv_have___ss_family_in_struct_ss" >&6 +if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___SS_FAMILY_IN_SS 1 +_ACEOF + +fi + + + + +case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in + *yes*) + echo "$as_me:$LINENO: checking for struct snd_size" >&5 +echo $ECHO_N "checking for struct snd_size... $ECHO_C" >&6 +if test "${ac_cv_struct_snd_size+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_MACHINE_SOUNDCARD_H +# include +#endif +#ifdef HAVE_SYS_SOUNDCARD_H +# include +#endif +int +main () +{ + +extern struct snd_size *ss; +return ss->rec_size; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_struct_snd_size=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_struct_snd_size=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_struct_snd_size" >&5 +echo "${ECHO_T}$ac_cv_struct_snd_size" >&6 + case "$ac_cv_struct_snd_size" in + yes) +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_SND_SIZE 1 +_ACEOF + ;; + esac + ;; +esac + +echo "$as_me:$LINENO: 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int @@ -4661,35 +13405,51 @@ return pc->hz; ; return 0; } -EOF -if { (eval echo configure:4666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_HZ_IN_STRUCT_CLOCKINFO 1 -EOF +_ACEOF fi -echo $ac_n "checking struct clockinfo for tickadj... $ac_c" 1>&6 -echo "configure:4687: checking struct clockinfo for tickadj" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int @@ -4701,35 +13461,112 @@ return pc->tickadj; ; return 0; } -EOF -if { (eval echo configure:4706: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_TICKADJ_IN_STRUCT_CLOCKINFO 1 -EOF +_ACEOF fi -echo $ac_n "checking for struct ntptimeval... $ac_c" 1>&6 -echo "configure:4727: checking for struct ntptimeval" 1>&5 -if test "${ac_cv_struct_ntptimeval+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */ +#ifdef HAVE_ERRNO_H +# include +#endif +#ifdef HAVE_SYS_TIMEPPS_H +# define FRAC 4294967296 +# include +#endif +int +main () +{ +struct timespec n; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_struct_timespec=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_struct_timespec=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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 <<\_ACEOF +#define HAVE_STRUCT_TIMESPEC 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -4740,35 +13577,50 @@ struct ntptimeval n; ; return 0; } -EOF -if { (eval echo configure:4745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_STRUCT_NTPTIMEVAL 1 -EOF +_ACEOF fi -echo $ac_n "checking struct ntptimeval for time.tv_nsec... $ac_c" 1>&6 -echo "configure:4765: checking struct ntptimeval for time.tv_nsec" 1>&5 -if test "${ac_cv_struct_ntptimeval_tv_nsec+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef HAVE_SYS_TIME_H #include #else @@ -4783,474 +13635,1308 @@ else # include # endif #endif + int main () { - -extern struct ntptimeval *ntv; -return ntv->time.tv_nsec; +static struct ntptimeval ac_aggr; +if (ac_aggr.time.tv_nsec) +return 0; ; return 0; } -EOF -if { (eval echo configure:4797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_ntptimeval_tv_nsec=yes +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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_tv_nsec=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -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:4818: checking for struct timespec in struct ntptimeval" 1>&5 -if test "${ac_cv_struct_ntptimeval_timespec+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_SYS_TIME_H #include +#else +# ifdef HAVE_TIME_H +# include +# endif +#endif +#ifdef HAVE_SYS_TIMEX_H #include +#else +# ifdef HAVE_TIMEX_H +# include +# endif +#endif + int main () { -struct ntptimeval n; n.time.tv_nsec = 0; +static struct ntptimeval ac_aggr; +if (sizeof ac_aggr.time.tv_nsec) +return 0; ; return 0; } -EOF -if { (eval echo configure:4835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_ntptimeval_timespec=yes +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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 "$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 -EOF +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: 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 + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC 1 +_ACEOF + fi -echo $ac_n "checking for inline... $ac_c" 1>&6 -echo "configure:4855: checking for inline" 1>&5 + +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:$LINENO: 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 <<\_ACEOF +#define inline +_ACEOF + ;; + *) cat >>confdefs.h <<_ACEOF +#define inline $ac_cv_c_inline +_ACEOF + ;; +esac + + +echo "$as_me:$LINENO: 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default int main () { -#ifndef __cplusplus - } $ac_kw int foo() { -#endif +static int test_array [1 - 2 * !(((char) -1) < 0)]; +test_array [0] = 0 ; return 0; } -EOF -if { (eval echo configure:4876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_inline=$ac_kw; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done - -fi -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in - inline | yes) ;; - no) cat >>confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >>confdefs.h <&6 -echo "configure:4901: checking whether char is unsigned" 1>&5 -if test "${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 <&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_c_char_unsigned=yes -else - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_char_unsigned=no -fi -rm -f conftest* - else -if test "$cross_compiling" = yes; then - { echo "configure: error: cannot run test program while cross compiling" 1>&2; exit 1; } -else - cat >conftest.$ac_ext <&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* - ac_cv_c_char_unsigned=no -fi -rm -fr conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_c_char_unsigned=yes fi - +rm -f conftest.$ac_objext conftest.$ac_ext fi -fi -echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define __CHAR_UNSIGNED__ 1 -EOF +_ACEOF fi - case "$host" in - $target) - echo $ac_n "checking size of signed char... $ac_c" 1>&6 -echo "configure:4968: checking size of signed char" 1>&5 -if test "${ac_cv_sizeof_signed_char+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: 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 - if test "$cross_compiling" = yes; then - { echo "configure: error: cannot run test program while cross compiling" 1>&2; exit 1; } -else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () { - FILE *f = fopen ("conftestval", "w"); - if (!f) - exit (1); - fprintf (f, "%d\n", sizeof (signed char)); - exit (0); +if ((signed char *) 0) + return 0; +if (sizeof (signed char)) + return 0; + ; + return 0; } -EOF -if { (eval echo configure:4989: \"$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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signed_char=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signed_char=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signed_char" >&5 +echo "${ECHO_T}$ac_cv_type_signed_char" >&6 + +echo "$as_me:$LINENO: 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 + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (signed char))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (signed char))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + 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 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (signed char))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (signed char))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (signed char))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_signed_char=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (signed char), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (signed char), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (signed char)); } +unsigned long ulongval () { return (long) (sizeof (signed char)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (signed char))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (signed char)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (signed char)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (signed char), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (signed char), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* ac_cv_sizeof_signed_char=0 fi -rm -fr conftest* - fi - -fi -echo "$ac_t""$ac_cv_sizeof_signed_char" 1>&6 -cat >>confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_signed_char" >&6 +cat >>confdefs.h <<_ACEOF #define SIZEOF_SIGNED_CHAR $ac_cv_sizeof_signed_char -EOF +_ACEOF - ;; - *) case "$target" in - *-*-vxworks*) - echo $ac_n "checking size of signed char... $ac_c" 1>&6 -echo "configure:5012: checking size of signed char" 1>&5 -if test "${ac_cv_sizeof_signed_char+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: 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 - if test "$cross_compiling" = yes; then - ac_cv_sizeof_signed_char=1 -else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () { - FILE *f = fopen ("conftestval", "w"); - if (!f) - exit (1); - fprintf (f, "%d\n", sizeof (signed char)); - exit (0); +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; + ; + return 0; } -EOF -if { (eval echo configure:5033: \"$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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_signed_char=0 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int=no fi -rm -fr conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 -fi -echo "$ac_t""$ac_cv_sizeof_signed_char" 1>&6 -cat >>confdefs.h <&2; exit 1; } - ;; - esac - ;; -esac - -case "$host" in - $target) - echo $ac_n "checking size of int... $ac_c" 1>&6 -echo "configure:5062: checking size of int" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$ac_cv_type_int" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then - { echo "configure: error: cannot run test program while cross compiling" 1>&2; exit 1; } -else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () { - FILE *f = fopen ("conftestval", "w"); - if (!f) - exit (1); - fprintf (f, "%d\n", sizeof (int)); - exit (0); +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +test_array [0] = 0 + + ; + return 0; } -EOF -if { (eval echo configure:5083: \"$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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + 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 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (int))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* ac_cv_sizeof_int=0 fi -rm -fr conftest* - fi - -fi -echo "$ac_t""$ac_cv_sizeof_int" 1>&6 -cat >>confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int -EOF +_ACEOF - ;; - *) case "$target" in - *-*-vxworks*) - echo $ac_n "checking size of int... $ac_c" 1>&6 -echo "configure:5106: checking size of int" 1>&5 -if test "${ac_cv_sizeof_int+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: 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 - if test "$cross_compiling" = yes; then - ac_cv_sizeof_int=4 -else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () { - FILE *f = fopen ("conftestval", "w"); - if (!f) - exit (1); - fprintf (f, "%d\n", sizeof (int)); - exit (0); +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; } -EOF -if { (eval echo configure:5127: \"$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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_int=0 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long=no fi -rm -fr conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 -fi -echo "$ac_t""$ac_cv_sizeof_int" 1>&6 -cat >>confdefs.h <&2; exit 1; } - ;; - esac - ;; -esac - -case "$host" in - $target) - echo $ac_n "checking size of long... $ac_c" 1>&6 -echo "configure:5156: checking size of long" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then - { echo "configure: error: cannot run test program while cross compiling" 1>&2; exit 1; } -else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () { - FILE *f = fopen ("conftestval", "w"); - if (!f) - exit (1); - fprintf (f, "%d\n", sizeof (long)); - exit (0); +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; } -EOF -if { (eval echo configure:5177: \"$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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + 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 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* ac_cv_sizeof_long=0 fi -rm -fr conftest* - fi - -fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >>confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long -EOF +_ACEOF - ;; - *) case "$target" in - *-*-vxworks*) - echo $ac_n "checking size of long... $ac_c" 1>&6 -echo "configure:5200: checking size of long" 1>&5 -if test "${ac_cv_sizeof_long+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_sizeof_long=4 -else - cat >conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long=0 -fi -rm -fr conftest* -fi -fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >>confdefs.h <&2; exit 1; } - ;; - esac - ;; -esac - -echo $ac_n "checking for s_char... $ac_c" 1>&6 -echo "configure:5248: checking for s_char" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -5262,23 +14948,36 @@ if (sizeof (s_char)) ; return 0; } -EOF -if { (eval echo configure:5267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_s_char=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_s_char=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' 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 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define HAVE_S_CHAR 1 -EOF +_ACEOF + fi @@ -5288,1490 +14987,2871 @@ 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 <<\_ACEOF #define NEED_S_CHAR_TYPEDEF 1 -EOF +_ACEOF ;; no1no) # We have signed chars, can say 'signed char', no s_char typedef. - cat >>confdefs.h <<\EOF + cat >>confdefs.h <<\_ACEOF #define NEED_S_CHAR_TYPEDEF 1 -EOF +_ACEOF ;; 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:$LINENO: 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 <<\_ACEOF #define NEED_S_CHAR_TYPEDEF 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for uid_t in sys/types.h... $ac_c" 1>&6 -echo "configure:5317: checking for uid_t in sys/types.h" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "uid_t" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "uid_t" >/dev/null 2>&1; then 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:$LINENO: 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 -#define uid_t int -EOF - cat >>confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF +#define uid_t int +_ACEOF + + +cat >>confdefs.h <<\_ACEOF #define gid_t int -EOF +_ACEOF fi -case "$target" in + +case "$host" in *-*-linux*) - for ac_func in __adjtimex __ntp_gettime + + +for ac_func in __adjtimex __ntp_gettime do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5356: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac -case "$target" in - *-*-aix4*) +case "$host" in + *-*-aix[45]*) # (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub # (returning ENOSYS). I didn't check 4.2. If, in the future, # IBM pulls its thumbs out long enough to implement clock_settime, # 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_gettime clock_settime do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5424: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac -for ac_func in daemon getbootfile getdtablesize getrusage + +for ac_func in daemon do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5484: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -for ac_func in gettimeofday + +for ac_func in finite do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5542: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + +for ac_func in isfinite +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + echo "$as_me:$LINENO: checking for isfinite with " >&5 +echo $ECHO_N "checking for isfinite with ... $ECHO_C" >&6 + _libs=$LIBS + LIBS="$LIBS -lm" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +float f = 0.0; isfinite(f) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\_ACEOF +#define HAVE_ISFINITE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS=$_libs fi done -case "$target" in +fi +done + + + + + +for ac_func in getbootfile getclock getdtablesize getrusage +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +echo "$as_me:$LINENO: checking for gettimeofday" >&5 +echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 +if test "${ac_cv_func_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gettimeofday (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 gettimeofday (); +/* 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_gettimeofday) || defined (__stub___gettimeofday) +choke me +#else +char (*f) () = gettimeofday; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gettimeofday; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gettimeofday=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 +if test $ac_cv_func_gettimeofday = yes; then + : +else + +case "$host" in + *-*-mpeix*) ac_cv_func_gettimeofday=yes + ;; +esac +fi + +case "$host" in *-pc-cygwin*) ;; - *) for ac_func in getuid + *) +for ac_func in getuid do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5603: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac -for ac_func in hstrerror K_open kvm_open memcpy memmove memset + +for ac_func in hstrerror do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5663: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -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_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -case "$target" in +echo "$as_me:$LINENO: checking for inet_ntop" >&5 +echo $ECHO_N "checking for inet_ntop... $ECHO_C" >&6 +if test "${ac_cv_func_inet_ntop+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_ntop (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 inet_ntop (); +/* 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_inet_ntop) || defined (__stub___inet_ntop) +choke me +#else +char (*f) () = inet_ntop; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != inet_ntop; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_inet_ntop=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_inet_ntop=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_inet_ntop" >&5 +echo "${ECHO_T}$ac_cv_func_inet_ntop" >&6 +if test $ac_cv_func_inet_ntop = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_NEEDNTOP 1 +_ACEOF + +fi + + + + + + +for ac_func in K_open kvm_open memcpy memmove memset +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +case "$host" in *-*-sco3.2v5.0.*) # Just stubs. Idiots. ;; - *) for ac_func in mkstemp + *) +for ac_func in mkstemp do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5725: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac + for ac_func in mktime do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5785: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -case "$target" in - *-*-aix4*) +case "$host" in + *-*-aix[45]*) # Just a stub. Idiots. ;; - *-*-irix*) - # Just stubs in Irix. Idiots. + *-*-irix[45]*) + # Just a stub in "old" Irix. Idiots. + ;; + *-*-qnx*) + # Apparently there but not working in QNX. Idiots? ;; *-*-sco3.2v5.0.*) - # Just stubs. Idiots. + # Just a stub. Idiots. ;; alpha*-dec-osf4*|alpha*-dec-osf5*) # mlockall is there, as a #define calling memlk via # Not easy to test for - cheat. - for ac_func in memlk + +for ac_func in memlk do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5858: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF ac_cv_func_mlockall='yes' fi done - for ac_func in mlockall + +for ac_func in mlockall do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5916: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:5949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; - *) for ac_func in mlockall + *) +for ac_func in mlockall do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:5975: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac + + + + for ac_func in mrand48 srand48 nice nlist do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6035: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -case "$target" in +case "$host" in *-*-solaris2.6) # Broken... ;; - *) for ac_func in ntp_adjtime ntp_gettime + *) + +for ac_func in ntp_adjtime ntp_gettime do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6097: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac -for ac_func in plock pututline pututxline rtprio + + + + + +for ac_func in plock pututline pututxline readlink rtprio do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6157: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done case "$ac_cv_func_mrand48" in yes) ;; - *) for ac_func in random + *) +for ac_func in random do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6217: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + else - LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" + LIBOBJS="$LIBOBJS $ac_func.$ac_objext" fi done ;; esac -case "$target" in - *-*-aix4*) +case "$host" in + *-*-aix[45]*) # Just a stub in AIX 4. Idiots. ;; *-*-solaris2.5*) # Just stubs in solaris2.5. Idiots. ;; - *) for ac_func in sched_setscheduler + *) +for ac_func in sched_setscheduler do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6286: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac -for ac_func in setlinebuf + + + + +for ac_func in setlinebuf setpgid setpriority setsid do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6346: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -for ac_func in setpgid setpriority setsid settimeofday setvbuf sigaction + +for ac_func in setrlimit do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6404: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + +case "$host" in + *-*-mpeix*) ac_cv_func_settimeofday=yes + ;; +esac fi done + + +for ac_func in setvbuf sigaction +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + for ac_func in sigvec sigset sigsuspend stime strchr sysconf sysctl do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6462: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -for ac_func in snprintf strerror + + + + +for ac_func in snprintf strdup strerror strstr do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6520: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -case "$target" in - *-*-aix4*) + +for ac_func in timegm +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +case "$host" in + *-*-aix[45]*) # Just stubs. Idiots. ;; - *-*-netbsd*) + *-*-netbsd1*) + # Just stubs. Idiots. + ;; + *-*-netbsdelf1*) # Just stubs. Idiots. ;; *-*-openbsd*) # Just stubs. Idiots. ;; - *) for ac_func in timer_create timer_settime + *) + +for ac_func in timer_create timer_settime do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6590: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac -case "$target" in +case "$host" in *-pc-cygwin*) # I have no idea... ;; - *) for ac_func in umask + *) +for ac_func in umask do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6654: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done ;; esac + + + + for ac_func in uname updwtmp updwtmpx vsprintf do -ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` -echo $ac_n "checking for $ac_func... $ac_c" 1>&6 -echo "configure:6714: checking for $ac_func" 1>&5 -if eval "test \"\${$ac_ac_var+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ -/* 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() +#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 (); /* 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; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } -EOF -if { (eval echo configure:6747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "$ac_ac_var=yes" +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "$ac_ac_var=no" -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi -echo "$ac_t""`eval echo '${'$ac_ac_var'}'`" 1>&6 -if test `eval echo '${'$ac_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi done -echo $ac_n "checking number of arguments to gettimeofday()... $ac_c" 1>&6 -echo "configure:6769: checking number of arguments to gettimeofday()" 1>&5 + +case "$host" in + *-*-sunos4*) + +cat >>confdefs.h <<\_ACEOF +#define SPRINTF_CHAR 1 +_ACEOF + + ;; +esac + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int main () @@ -6783,35 +17863,51 @@ settimeofday((struct timeval*)0,(struct timezone*)0); ; return 0; } -EOF -if { (eval echo configure:6788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define SYSV_TIMEOFDAY 1 -EOF +_ACEOF fi -echo $ac_n "checking number of arguments taken by setpgrp()... $ac_c" 1>&6 -echo "configure:6809: checking number of arguments taken by setpgrp()" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include @@ -6827,38 +17923,54 @@ setpgrp(0,0); ; return 0; } -EOF -if { (eval echo configure:6832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define HAVE_SETPGRP_0 1 -EOF +_ACEOF 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:6856: checking argument pointer type of qsort()'s compare function and base" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "l_stdlib.h" @@ -6883,39 +17995,55 @@ qsort(base, 2, sizeof(char *), sortfunc); ; return 0; } -EOF -if { (eval echo configure:6888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define QSORT_USES_VOID_P 1 -EOF +_ACEOF ;; esac CFLAGS=$save_CFLAGS -echo $ac_n "checking if we need to declare 'errno'... $ac_c" 1>&6 -echo "configure:6913: checking if we need to declare 'errno'" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef HAVE_ERRNO_H #include #endif @@ -6926,34 +18054,50 @@ errno = 0; ; return 0; } -EOF -if { (eval echo configure:6931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define DECL_ERRNO 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we may declare 'h_errno'... $ac_c" 1>&6 -echo "configure:6951: checking if we may declare 'h_errno'" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_NETINET_IN_H #include @@ -6974,34 +18118,50 @@ extern int h_errno; ; return 0; } -EOF -if { (eval echo configure:6979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define DECL_H_ERRNO 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if declaring 'char *sys_errlist[]' is ok... $ac_c" 1>&6 -echo "configure:6999: checking [if declaring 'char *sys_errlist[]' is ok]" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_ERRNO_H #include @@ -7014,34 +18174,50 @@ extern char *sys_errlist[]; ; return 0; } -EOF -if { (eval echo configure:7019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define CHAR_SYS_ERRLIST 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if declaring 'syscall()' is ok... $ac_c" 1>&6 -echo "configure:7039: checking if declaring 'syscall()' is ok" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include @@ -7062,373 +18238,505 @@ extern int syscall P((int, ...)); ; return 0; } -EOF -if { (eval echo configure:7067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $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 +sed 's/^/| /' 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:$LINENO: 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 <<\_ACEOF #define DECL_SYSCALL 1 -EOF +_ACEOF ;; esac -case "$target" in - *-*-osf[45]*) - cat >>confdefs.h <<\EOF -#define DECL_PLOCK_0 1 -EOF +case "$host" in + *-*-aix4.3.*) - cat >>confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF +#define DECL_HSTRERROR_0 1 +_ACEOF + # Needed for XLC under AIX 4.3.2 + ;; + *-*-mpeix*) + +cat >>confdefs.h <<\_ACEOF +#define DECL_ADJTIME_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_INET_NTOA_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_MKTEMP_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_MRAND48_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_SELECT_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_SETITIMER_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_SRAND48_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_SYSLOG_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_TIMEOFDAY_0 1 +_ACEOF + + ;; + *-*-osf[45]*) + +cat >>confdefs.h <<\_ACEOF +#define DECL_PLOCK_0 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF #define DECL_STIME_1 1 -EOF +_ACEOF + + ;; + *-*-qnx*) + +cat >>confdefs.h <<\_ACEOF +#define DECL_ADJTIME_0 1 +_ACEOF ;; *-*-riscos4*) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_ADJTIME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_BZERO_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_IOCTL_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_IPC_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MEMMOVE_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MKTEMP_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_RENAME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SELECT_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETITIMER_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETPRIORITY_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_STDIO_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_STRTOL_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SYSLOG_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TIME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TIMEOFDAY_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TOLOWER_0 1 -EOF +_ACEOF ;; *-*-solaris2*) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MKSTEMP_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETPRIORITY_1 1 -EOF +_ACEOF - case "$target" in + case "$host" in *-*-solaris2.4) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TIMEOFDAY_0 1 -EOF +_ACEOF ;; esac ;; *-*-sunos4*) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_ADJTIME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_BCOPY_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_BZERO_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_IOCTL_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_IPC_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MEMMOVE_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MKTEMP_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MKSTEMP_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MRAND48_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_RENAME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SELECT_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETITIMER_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETPRIORITY_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SIGVEC_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SRAND48_0 1 -EOF +_ACEOF case "`basename $ac_cv_prog_CC`" in acc*) ;; - *) cat >>confdefs.h <<\EOF + *) +cat >>confdefs.h <<\_ACEOF #define DECL_STDIO_0 1 -EOF +_ACEOF ;; esac - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_STRTOL_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SYSLOG_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TIME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TIMEOFDAY_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TOLOWER_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TOUPPER_0 1 -EOF +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define DECL_STRERROR_0 1 +_ACEOF ;; *-*-ultrix4*) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_ADJTIME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_BZERO_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_CFSETISPEED_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_IOCTL_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_IPC_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MKTEMP_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_MRAND48_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_NLIST_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_PLOCK_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SELECT_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETITIMER_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SETPRIORITY_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SRAND48_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_STIME_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_SYSLOG_0 1 -EOF +_ACEOF - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define DECL_TIMEOFDAY_0 1 -EOF +_ACEOF ;; esac -case "$target" in +case "$host" in *-*-sco3.2*) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define TERMIOS_NEEDS__SVID3 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we should use a streams device for ifconfig... $ac_c" 1>&6 -echo "configure:7353: checking if we should use a streams device for ifconfig" 1>&5 -if test "${ac_cv_var_use_streams_device_for_ifconfig+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_var_use_streams_device_for_ifconfig=no -fi -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:7362: checking if we need extra room for SO_RCVBUF" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no -case "$target" in +case "$host" in *-*-hpux[567]*) ans=yes ;; esac ac_cv_var_rcvbuf_slop=$ans fi -echo "$ac_t""$ac_cv_var_rcvbuf_slop" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define NEED_RCVBUF_SLOP 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we will open the broadcast socket... $ac_c" 1>&6 -echo "configure:7383: checking if we will open the broadcast socket" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=yes -case "$target" in +case "$host" in *-*-domainos) ans=no ;; - *-*-linux*) - ans=no - ;; esac ac_cv_var_open_bcast_socket=$ans fi -echo "$ac_t""$ac_cv_var_open_bcast_socket" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define OPEN_BCAST_SOCKET 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we want the HPUX version of FindConfig()... $ac_c" 1>&6 -echo "configure:7407: checking if we want the HPUX version of FindConfig()" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no -case "$target" in +case "$host" in *-*-hpux*) ans=yes ;; esac ac_cv_var_hpux_findconfig=$ans fi -echo "$ac_t""$ac_cv_var_hpux_findconfig" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define NEED_HPUX_FINDCONFIG 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if process groups are set with -pid... $ac_c" 1>&6 -echo "configure:7428: checking if process groups are set with -pid" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$target" in + case "$host" in *-*-hpux[567]*) ans=no ;; @@ -7450,21 +18758,23 @@ else esac ac_cv_arg_setpgrp_negpid=$ans fi -echo "$ac_t""$ac_cv_arg_setpgrp_negpid" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define UDP_BACKWARDS_SETOWN 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we need a ctty for F_SETOWN... $ac_c" 1>&6 -echo "configure:7463: checking if we need a ctty for F_SETOWN" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$target" in - *-*-bsdi2*) + case "$host" in + *-*-bsdi[23]*) ans=yes ;; *-*-freebsd*) @@ -7484,17 +18794,19 @@ 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:$LINENO: 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 <<\_ACEOF #define USE_FSETOWNCTTY 1 -EOF +_ACEOF ;; esac ntp_warning='GRONK' -echo $ac_n "checking if we'll use clock_settime or settimeofday or stime... $ac_c" 1>&6 -echo "configure:7498: checking if we'll use clock_settime or settimeofday or stime" 1>&5 +echo "$as_me:$LINENO: 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='' @@ -7508,26 +18820,28 @@ 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!' + *) + case "$build" in + $host) ntp_warning='Which leaves us with nothing to use!' ans=none ;; esac esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 case "$ntp_warning" in '') ;; - *) echo "configure: warning: *** $ntp_warning ***" 1>&2 + *) { echo "$as_me:$LINENO: 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:7527: checking if we have a losing syscall()" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$target" in + case "$host" in *-*-solaris2.4*) ans=yes ;; @@ -7536,24 +18850,26 @@ else esac ac_cv_var_syscall_bug=$ans fi -echo "$ac_t""$ac_cv_var_syscall_bug" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define SYSCALL_BUG 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for Streams/TLI... $ac_c" 1>&6 -echo "configure:7549: checking for Streams/TLI" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$ac_cv_header_sys_stropts_h" in yes) ans=no # There must be a better way... - case "$target" in + case "$host" in *-*-ptx*) ans=yes ;; @@ -7562,53 +18878,58 @@ else esac ac_cv_var_streams_tli=$ans fi -echo "$ac_t""$ac_cv_var_streams_tli" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define STREAMS_TLI 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for SIGIO... $ac_c" 1>&6 -echo "configure:7577: checking for SIGIO" 1>&5 +echo "$as_me:$LINENO: checking for SIGIO" >&5 +echo $ECHO_N "checking for SIGIO... $ECHO_C" >&6 if test "${ac_cv_hdr_def_sigio+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ac_cv_hdr_def_sigio=yes else - rm -rf conftest* ac_cv_hdr_def_sigio=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_hdr_def_sigio" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_hdr_def_sigio" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_sigio" >&6 -echo $ac_n "checking if we want to use signalled IO... $ac_c" 1>&6 -echo "configure:7604: checking if we want to use signalled IO" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$ac_cv_hdr_def_sigio" in yes) ans=yes - case "$target" in + case "$host" in alpha*-dec-osf4*|alpha*-dec-osf5*) ans=no ;; @@ -7636,82 +18957,93 @@ case "$ac_cv_hdr_def_sigio" in *-*-linux*) ans=no ;; + *-*-unicosmp*) + ans=no + ;; esac ;; esac ac_cv_var_signalled_io=$ans fi -echo "$ac_t""$ac_cv_var_signalled_io" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define HAVE_SIGNALED_IO 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for SIGPOLL... $ac_c" 1>&6 -echo "configure:7654: checking for SIGPOLL" 1>&5 +echo "$as_me:$LINENO: checking for SIGPOLL" >&5 +echo $ECHO_N "checking for SIGPOLL... $ECHO_C" >&6 if test "${ac_cv_hdr_def_sigpoll+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ac_cv_hdr_def_sigpoll=yes else - rm -rf conftest* ac_cv_hdr_def_sigpoll=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_hdr_def_sigpoll" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_hdr_def_sigpoll" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_sigpoll" >&6 -echo $ac_n "checking for SIGSYS... $ac_c" 1>&6 -echo "configure:7681: checking for SIGSYS" 1>&5 +echo "$as_me:$LINENO: checking for SIGSYS" >&5 +echo $ECHO_N "checking for SIGSYS... $ECHO_C" >&6 if test "${ac_cv_hdr_def_sigsys+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ac_cv_hdr_def_sigsys=yes else - rm -rf conftest* ac_cv_hdr_def_sigsys=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_hdr_def_sigsys" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_hdr_def_sigsys" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_sigsys" >&6 -echo $ac_n "checking if we can use SIGPOLL for UDP I/O... $ac_c" 1>&6 -echo "configure:7708: checking if we can use SIGPOLL for UDP I/O" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$ac_cv_hdr_def_sigpoll" in yes) - case "$target" in + case "$host" in mips-sgi-irix*) ans=no ;; @@ -7724,7 +19056,7 @@ case "$ac_cv_hdr_def_sigpoll" in *-sni-sysv*) ans=no ;; - *-*-aix4*) + *-*-aix[45]*) ans=no ;; *-*-hpux*) @@ -7736,12 +19068,18 @@ case "$ac_cv_hdr_def_sigpoll" in *-*-osf*) ans=no ;; + *-*-qnx*) + ans=no + ;; *-*-sunos*) ans=no ;; *-*-ultrix*) ans=no ;; + *-*-unicosmp*) + ans=no + ;; *) ans=yes ;; esac @@ -7749,23 +19087,25 @@ case "$ac_cv_hdr_def_sigpoll" in esac ac_cv_var_use_udp_sigpoll=$ans fi -echo "$ac_t""$ac_cv_var_use_udp_sigpoll" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define USE_UDP_SIGPOLL 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we can use SIGPOLL for TTY I/O... $ac_c" 1>&6 -echo "configure:7762: checking if we can use SIGPOLL for TTY I/O" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$ac_cv_hdr_def_sigpoll" in yes) - case "$target" in + case "$host" in mips-sgi-irix*) ans=no ;; @@ -7778,7 +19118,7 @@ case "$ac_cv_hdr_def_sigpoll" in *-sni-sysv*) ans=no ;; - *-*-aix4*) + *-*-aix[45]*) ans=no ;; *-*-hpux*) @@ -7796,6 +19136,12 @@ case "$ac_cv_hdr_def_sigpoll" in *-*-ultrix*) ans=no ;; + *-*-qnx*) + ans=no + ;; + *-*-unicosmp*) + ans=no + ;; *) ans=yes ;; esac @@ -7803,42 +19149,47 @@ 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:$LINENO: 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 <<\_ACEOF #define USE_TTY_SIGPOLL 1 -EOF +_ACEOF ;; 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:7818: checking sys/sio.h for TIOCDCDTIMESTAMP" 1>&5 + echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then 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:$LINENO: result: $ac_cv_hdr_def_tiocdcdtimestamp" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_tiocdcdtimestamp" >&6 ;; esac @@ -7848,177 +19199,202 @@ 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:7853: checking if nlist() values might require extra indirection" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no -case "$target" in +case "$host" in *-*-aix*) ans=yes ;; esac ac_cv_var_nlist_extra_indirection=$ans fi -echo "$ac_t""$ac_cv_var_nlist_extra_indirection" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define NLIST_EXTRA_INDIRECTION 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for a minimum recommended value of tickadj... $ac_c" 1>&6 -echo "configure:7874: checking for a minimum recommended value of tickadj" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no -case "$target" in +case "$host" in *-*-aix*) ans=40 ;; esac ac_cv_var_min_rec_tickadj=$ans fi -echo "$ac_t""$ac_cv_var_min_rec_tickadj" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define MIN_REC_TICKADJ $ac_cv_var_min_rec_tickadj -EOF +_ACEOF ;; esac -echo $ac_n "checking if the TTY code permits PARENB and IGNPAR... $ac_c" 1>&6 -echo "configure:7896: checking if the TTY code permits PARENB and IGNPAR" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no -case "$target" in +case "$host" in i?86-*-linux*) ans=yes ;; mips-sgi-irix*) ans=yes ;; + i?86-*-freebsd[123].*) + ;; + i?86-*-freebsd*) + ans=yes + ;; + *-*-unicosmp*) + ans=yes + ;; esac ac_cv_var_no_parenb_ignpar=$ans fi -echo "$ac_t""$ac_cv_var_no_parenb_ignpar" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define NO_PARENB_IGNPAR 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we're including debugging code... $ac_c" 1>&6 -echo "configure:7920: checking if we're including debugging code" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define DEBUG 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:7938: checking for a the number of minutes in a DST adjustment" 1>&5 +echo "$as_me:$LINENO: 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 +fi; -cat >>confdefs.h <>confdefs.h <<_ACEOF #define DSTMINUTES $ans -EOF +_ACEOF -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: 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:7954: checking if we have the tty_clk line discipline/streams module" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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:$LINENO: 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 <<\_ACEOF #define TTYCLK 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for the ppsclock streams module... $ac_c" 1>&6 -echo "configure:7971: checking for the ppsclock streams module" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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:$LINENO: 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 <<\_ACEOF #define PPS 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking for kernel multicast support... $ac_c" 1>&6 -echo "configure:7986: checking for kernel multicast support" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_mcast=no - case "$target" in + case "$host" in i386-sequent-sysv4) ;; - *) cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ac_cv_var_mcast=yes fi rm -f conftest* ;; esac fi -echo "$ac_t""$ac_cv_var_mcast" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define MCAST 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking availability of ntp_{adj,get}time()... $ac_c" 1>&6 -echo "configure:8020: checking [availability of ntp_{adj,get}time()]" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_ntp_syscalls=no case "$ac_cv_func___adjtimex" in @@ -8029,18 +19405,21 @@ else yesyes) ac_cv_var_ntp_syscalls=libc ;; - *) cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ac_cv_var_ntp_syscalls=kernel fi rm -f conftest* @@ -8050,55 +19429,61 @@ rm -f conftest* ;; esac fi -echo "$ac_t""$ac_cv_var_ntp_syscalls" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define NTP_SYSCALLS_LIBC 1 -EOF +_ACEOF ;; kernel) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define NTP_SYSCALLS_STD 1 -EOF +_ACEOF ;; *) ;; esac -echo $ac_n "checking if sys/timex.h has STA_FLL... $ac_c" 1>&6 -echo "configure:8073: checking if sys/timex.h has STA_FLL" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ac_cv_var_sta_fll=yes else - rm -rf conftest* ac_cv_var_sta_fll=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_var_sta_fll" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_var_sta_fll" >&5 +echo "${ECHO_T}$ac_cv_var_sta_fll" >&6 -echo $ac_n "checking if we have kernel PLL support... $ac_c" 1>&6 -echo "configure:8100: checking if we have kernel PLL support" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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*) @@ -8108,23 +19493,25 @@ else ;; esac fi -echo "$ac_t""$ac_cv_var_kernel_pll" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define KERNEL_PLL 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if SIOCGIFCONF returns buffer size in the buffer... $ac_c" 1>&6 -echo "configure:8123: checking if SIOCGIFCONF returns buffer size in the buffer" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no - case "$target" in + case "$host" in *-fujitsu-uxp*) ans=yes ;; @@ -8137,62 +19524,38 @@ 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:$LINENO: 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 <<\_ACEOF #define SIZE_RETURNED_IN_BUFFER 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we want to use MD5 authentication... $ac_c" 1>&6 -echo "configure:8150: checking if we want to use MD5 authentication" 1>&5 -if test "${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 AUTOKEY -EOF - - 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:8180: checking ioctl TIOCGPPSEV" 1>&5 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ntp_ok=yes else - rm -rf conftest* ntp_ok=no fi rm -f conftest* @@ -8201,33 +19564,37 @@ else ntp_ok=no fi if test "$ntp_ok" = "yes"; then - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_TIOCGPPSEV 1 -EOF +_ACEOF ac_cv_var_oncore_ok=yes fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8215: checking ioctl TIOCSPPS" 1>&5 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ntp_ok=yes else - rm -rf conftest* ntp_ok=no fi rm -f conftest* @@ -8237,32 +19604,36 @@ else fi if test "$ntp_ok" = "yes"; then - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_TIOCSPPS 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8250: checking ioctl CIOGETEV" 1>&5 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #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* + $EGREP "yes" >/dev/null 2>&1; then ntp_ok=yes else - rm -rf conftest* ntp_ok=no fi rm -f conftest* @@ -8272,67 +19643,191 @@ ntp_ok=no fi if test "$ntp_ok" = "yes"; then ac_cv_var_oncore_ok=yes - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_CIOGETEV 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define HAVE_PPSAPI 1 -EOF +_ACEOF ac_cv_var_oncore_ok=yes - cat >>confdefs.h <<\EOF -#define HAVE_TIMESPEC 1 -EOF - + ac_cv_var_ripe_ncc_ok=yes + ac_cv_var_jupiter_ok=yes ;; esac # Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG -echo $ac_n "checking for linux/serial.h... $ac_c" 1>&6 -echo "configure:8303: checking for linux/serial.h" 1>&5 if test "${ac_cv_header_linux_serial_h+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: 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 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_linux_serial_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_serial_h" >&6 else - cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking linux/serial.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include - -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8314: \"$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* - ac_cv_header_linux_serial_h=yes +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_linux_serial_h=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_header_linux_serial_h" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo $ac_n "checking ioctl TIOCGSERIAL... $ac_c" 1>&6 -echo "configure:8331: checking ioctl TIOCGSERIAL" 1>&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking linux/serial.h presence" >&5 +echo $ECHO_N "checking linux/serial.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: linux/serial.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: linux/serial.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/serial.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: linux/serial.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: linux/serial.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: linux/serial.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/serial.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: linux/serial.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/serial.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: linux/serial.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: 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 + ac_cv_header_linux_serial_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_linux_serial_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_serial_h" >&6 + +fi + + +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include typedef int u_int; @@ -8350,11 +19845,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* + $EGREP "yes" >/dev/null 2>&1; then ntp_ok=yes fi rm -f conftest* @@ -8365,85 +19859,95 @@ rm -f conftest* ;; esac if test "$ntp_ok" = "yes"; then - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_TIO_SERIAL_STUFF 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8378: checking SHMEM_STATUS support" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define ONCORE_SHMEM_STATUS 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + ntp_refclock=no # HPUX only, and by explicit request -echo $ac_n "checking Datum/Bancomm bc635/VME interface... $ac_c" 1>&6 -echo "configure:8395: checking Datum/Bancomm bc635/VME interface" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_BANC 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 -case "$ntp_ok$target" in +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 +case "$ntp_ok$host" in yes*-*-hpux*) ;; - yes*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yes*) { echo "$as_me:$LINENO: 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:8419: checking TrueTime GPS receiver/VME interface" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_GPSVME 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 -case "$ntp_ok$target" in +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 +case "$ntp_ok$host" in yes*-*-hpux*) ;; - yes*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yes*) { echo "$as_me:$LINENO: 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:8442: checking for PCL720 clock support" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_PPS720 1 -EOF +_ACEOF ans=yes ;; @@ -8451,327 +19955,75 @@ EOF ans=no ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: 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:8458: checking for SHM clock attached thru shared memory" 1>&5 -# 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 - -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - cat >>confdefs.h <<\EOF -#define CLOCK_SHM 1 -EOF - -fi -echo "$ac_t""$ntp_ok" 1>&6 - -echo $ac_n "checking for default inclusion of all suitable non-PARSE clocks... $ac_c" 1>&6 -echo "configure:8477: checking for default inclusion of all suitable non-PARSE clocks" 1>&5 +echo "$as_me:$LINENO: 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 +fi; +echo "$as_me:$LINENO: result: $ntp_eac" >&5 +echo "${ECHO_T}$ntp_eac" >&6 -echo "$ac_t""$ntp_eac" 1>&6 - -echo $ac_n "checking if we have support for PARSE clocks... $ac_c" 1>&6 -echo "configure:8489: checking if we have support for PARSE clocks" 1>&5 -case "$ac_cv_header_termio_h$ac_cv_header_termios_h" in - *yes*) +echo "$as_me:$LINENO: 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:$LINENO: 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:8500: checking if we have support for audio clocks" 1>&5 -case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h" in - *yes*) ntp_canaudio=yes ;; - *) ntp_canaudio=no ;; +echo "$as_me:$LINENO: 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$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in + *yes*) + ntp_canaudio=yes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AUDIO +_ACEOF + + ;; + *) ntp_canaudio=no ;; esac -echo "$ac_t""$ntp_canaudio" 1>&6 +echo "$as_me:$LINENO: result: $ntp_canaudio" >&5 +echo "${ECHO_T}$ntp_canaudio" >&6 -echo $ac_n "checking for struct audio_info.monitor_gain... $ac_c" 1>&6 -echo "configure:8508: checking for struct audio_info.monitor_gain" 1>&5 -if test "${ac_cv_member_struct_audio_info_monitor_gain+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif - -int -main () -{ -struct audio_info foo; -foo.monitor_gain; - ; - return 0; -} -EOF -if { (eval echo configure:8531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_member_struct_audio_info_monitor_gain=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_member_struct_audio_info_monitor_gain=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_member_struct_audio_info_monitor_gain" 1>&6 -if test $ac_cv_member_struct_audio_info_monitor_gain = yes; then - cat >>confdefs.h <&6 -echo "configure:8551: checking for struct audio_info.output_muted" 1>&5 -if test "${ac_cv_member_struct_audio_info_output_muted+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif - -int -main () -{ -struct audio_info foo; -foo.output_muted; - ; - return 0; -} -EOF -if { (eval echo configure:8574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_member_struct_audio_info_output_muted=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_member_struct_audio_info_output_muted=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_member_struct_audio_info_output_muted" 1>&6 -if test $ac_cv_member_struct_audio_info_output_muted = yes; then - cat >>confdefs.h <&6 -echo "configure:8594: checking for struct audio_info.blocksize" 1>&5 -if test "${ac_cv_member_struct_audio_info_blocksize+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif - -int -main () -{ -struct audio_info foo; -foo.blocksize; - ; - return 0; -} -EOF -if { (eval echo configure:8617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_member_struct_audio_info_blocksize=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_member_struct_audio_info_blocksize=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_member_struct_audio_info_blocksize" 1>&6 -if test $ac_cv_member_struct_audio_info_blocksize = yes; then - cat >>confdefs.h <&6 -echo "configure:8637: checking for struct audio_info.hiwat" 1>&5 -if test "${ac_cv_member_struct_audio_info_hiwat+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif - -int -main () -{ -struct audio_info foo; -foo.hiwat; - ; - return 0; -} -EOF -if { (eval echo configure:8660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_member_struct_audio_info_hiwat=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_member_struct_audio_info_hiwat=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_member_struct_audio_info_hiwat" 1>&6 -if test $ac_cv_member_struct_audio_info_hiwat = yes; then - cat >>confdefs.h <&6 -echo "configure:8680: checking for struct audio_info.lowat" 1>&5 -if test "${ac_cv_member_struct_audio_info_lowat+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif - -int -main () -{ -struct audio_info foo; -foo.lowat; - ; - return 0; -} -EOF -if { (eval echo configure:8703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_member_struct_audio_info_lowat=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_member_struct_audio_info_lowat=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_member_struct_audio_info_lowat" 1>&6 -if test $ac_cv_member_struct_audio_info_lowat = yes; then - cat >>confdefs.h <&6 -echo "configure:8723: checking for struct audio_info.mode" 1>&5 -if test "${ac_cv_member_struct_audio_info_mode+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.$ac_ext < -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif - -int -main () -{ -struct audio_info foo; -foo.mode; - ; - return 0; -} -EOF -if { (eval echo configure:8746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_member_struct_audio_info_mode=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_member_struct_audio_info_mode=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_member_struct_audio_info_mode" 1>&6 -if test $ac_cv_member_struct_audio_info_mode = yes; then - cat >>confdefs.h <&5 +echo $ECHO_N "checking if we have support for the SHM refclock interface... $ECHO_C" >&6 +case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in + yesyes) + ntp_canshm=yes + ;; + *) ntp_canshm=no ;; +esac +echo "$as_me:$LINENO: result: $ntp_canshm" >&5 +echo "${ECHO_T}$ntp_canshm" >&6 # Requires modem control -echo $ac_n "checking ACTS modem service... $ac_c" 1>&6 -echo "configure:8767: checking ACTS modem service" 1>&5 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_SYS_IOCTL_H #include @@ -8779,127 +20031,154 @@ 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* + $EGREP "yes" >/dev/null 2>&1; then 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 <<\_ACEOF #define CLOCK_ACTS 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8807: checking Arbiter 1088A/B GPS receiver" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_ARBITER 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Arcron MSF receiver... $ac_c" 1>&6 -echo "configure:8826: checking Arcron MSF receiver" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_ARCRON_MSF 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8845: checking Austron 2200A/2201A GPS receiver" 1>&5 +echo "$as_me:$LINENO: 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 + +cat >>confdefs.h <<\_ACEOF #define CLOCK_AS2201 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking PPS interface... $ac_c" 1>&6 -echo "configure:8864: checking PPS interface" 1>&5 +echo "$as_me:$LINENO: 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 + +cat >>confdefs.h <<\_ACEOF #define CLOCK_ATOM 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking CHU modem/decoder... $ac_c" 1>&6 -echo "configure:8883: checking CHU modem/decoder" 1>&5 +echo "$as_me:$LINENO: 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; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_CHRONOLOG 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_CHU 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8903: checking CHU audio/decoder" 1>&5 +echo "$as_me:$LINENO: 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" @@ -8909,23 +20188,25 @@ else *no*) ntp_ok=no ;; *) ntp_ok=yes ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define AUDIO_CHU 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:8929: checking Datum Programmable Time System" 1>&5 +echo "$as_me:$LINENO: 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" @@ -8938,47 +20219,73 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define CLOCK_DATUM 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Forum Graphic GPS... $ac_c" 1>&6 -echo "configure:8954: checking Forum Graphic GPS" 1>&5 +echo "$as_me:$LINENO: 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; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_DUMBCLOCK 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_FG 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:8974: checking Heath GC-1000 WWV/WWVH receiver" 1>&5 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_SYS_IOCTL_H #include @@ -8986,50 +20293,90 @@ 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* + $EGREP "yes" >/dev/null 2>&1; then 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 <<\_ACEOF #define CLOCK_HEATH 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking HP 58503A GPS receiver... $ac_c" 1>&6 -echo "configure:9014: checking HP 58503A GPS receiver" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF +#define CLOCK_HOPF_SERIAL 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF +#define CLOCK_HOPF_PCI 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_HPGPS 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Sun IRIG audio decoder... $ac_c" 1>&6 -echo "configure:9033: checking Sun IRIG audio decoder" 1>&5 +echo "$as_me:$LINENO: checking IRIG audio decoder" >&5 +echo $ECHO_N "checking 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" @@ -9039,80 +20386,128 @@ 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 <<\_ACEOF #define CLOCK_IRIG 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9058: checking Leitch CSD 5300 Master Clock System Driver" 1>&5 +echo "$as_me:$LINENO: checking for JJY receiver" >&5 +echo $ECHO_N "checking for JJY receiver... $ECHO_C" >&6 +# Check whether --enable-JJY or --disable-JJY was given. +if test "${enable_JJY+set}" = set; then + enableval="$enable_JJY" + ntp_ok=$enableval +else + ntp_ok=$ntp_eac +fi; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_JJY 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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" + ntp_ok=$enableval +else + ntp_ok=$ntp_eac +fi; +case "$ac_cv_var_jupiter_ok" in + no) ntp_ok=no ;; +esac +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_JUPITER 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_LEITCH 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking local clock reference... $ac_c" 1>&6 -echo "configure:9077: checking local clock reference" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_LOCAL 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking EES M201 MSF receiver... $ac_c" 1>&6 -echo "configure:9096: checking EES M201 MSF receiver" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_MSFEES 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:9116: checking Magnavox MX4200 GPS receiver" 1>&5 +echo "$as_me:$LINENO: 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" @@ -9124,63 +20519,87 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define CLOCK_MX4200 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 -case "$ntp_ok$target" in - yes*-*-ultrix*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 +case "$ntp_ok$host" in + yes*-*-ultrix*) { echo "$as_me:$LINENO: 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:9143: checking NMEA GPS receiver" 1>&5 +echo "$as_me:$LINENO: checking for NeoClock4X receiver" >&5 +echo $ECHO_N "checking for NeoClock4X receiver... $ECHO_C" >&6 +# Check whether --enable-NEOCLOCK4X or --disable-NEOCLOCK4X was given. +if test "${enable_NEOCLOCK4X+set}" = set; then + enableval="$enable_NEOCLOCK4X" + ntp_ok=$enableval +else + ntp_ok=$ntp_eac +fi; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_NEOCLOCK4X 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_NMEA 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:9162: checking for ONCORE Motorola VP/UT Oncore GPS" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_ONCORE 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking for Palisade clock... $ac_c" 1>&6 -echo "configure:9184: checking for Palisade clock" 1>&5 +echo "$as_me:$LINENO: 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" @@ -9193,75 +20612,74 @@ else *) ntp_ok=no ;; esac -fi +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define CLOCK_PALISADE 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:9209: checking PST/Traconex 1020 WWV/WWVH receiver" 1>&5 +echo "$as_me:$LINENO: 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; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_PCF 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_PST 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 - -# Not Ultrix -echo $ac_n "checking Rockwell Jupiter GPS receiver... $ac_c" 1>&6 -echo "configure:9229: checking Rockwell Jupiter GPS receiver" 1>&5 -# Check whether --enable-JUPITER or --disable-JUPITER was given. -if test "${enable_JUPITER+set}" = set; then - enableval="$enable_JUPITER" - ntp_ok=$enableval -else - case "$ac_cv_var_ppsclock" in -# yes) ntp_ok=$ntp_eac -# ;; - *) ntp_ok=no - ;; - esac -fi - -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - cat >>confdefs.h <<\EOF -#define CLOCK_JUPITER 1 -EOF - -fi -echo "$ac_t""$ntp_ok" 1>&6 -case "$ntp_ok$target" in - yes*-*-ultrix*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; -esac +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Requires modem control -echo $ac_n "checking PTB modem service... $ac_c" 1>&6 -echo "configure:9257: checking PTB modem service" 1>&5 +echo "$as_me:$LINENO: 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 <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_SYS_IOCTL_H #include @@ -9269,31 +20687,99 @@ 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* + $EGREP "yes" >/dev/null 2>&1; then 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 <<\_ACEOF #define CLOCK_PTBACTS 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:9297: checking KSI/Odetics TPRO/S GPS receiver/IRIG interface" 1>&5 +echo "$as_me:$LINENO: checking RIPENCC specific Trimble driver" >&5 +echo $ECHO_N "checking RIPENCC specific Trimble driver... $ECHO_C" >&6 +# Check whether --enable-RIPENCC or --disable-RIPENCC was given. +if test "${enable_RIPENCC+set}" = set; then + enableval="$enable_RIPENCC" + ntp_ok=$enableval +else + ntp_ok=no +fi; +# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage +case "$ac_cv_var_ripe_ncc_ok" in + no) ntp_ok=no ;; +esac +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_RIPENCC +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +# Danny Meyer says SHM compiles (with a few warnings) under Win32. +# For *IX, we need sys/ipc.h and sys/shm.h. +echo "$as_me:$LINENO: 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 + case "$ntp_eac$ntp_canshm" in + *no*) ntp_ok=no ;; + *) ntp_ok=yes ;; +esac +fi; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_SHM 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_SPECTRACOM 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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" @@ -9306,124 +20792,51 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define CLOCK_TPRO 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9325: checking TRAK 8810 GPS receiver" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_TRAK 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 - -echo $ac_n "checking Chrono-log K-series WWVB receiver... $ac_c" 1>&6 -echo "configure:9344: checking Chrono-log K-series WWVB receiver" 1>&5 -# 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 - -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - cat >>confdefs.h <<\EOF -#define CLOCK_CHRONOLOG 1 -EOF - -fi -echo "$ac_t""$ntp_ok" 1>&6 - -echo $ac_n "checking Dumb generic hh:mm:ss local clock... $ac_c" 1>&6 -echo "configure:9363: checking Dumb generic hh:mm:ss local clock" 1>&5 -# 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 - -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - cat >>confdefs.h <<\EOF -#define CLOCK_DUMBCLOCK 1 -EOF - -fi -echo "$ac_t""$ntp_ok" 1>&6 - -echo $ac_n "checking Conrad parallel port radio clock... $ac_c" 1>&6 -echo "configure:9382: checking Conrad parallel port radio clock" 1>&5 -# 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 - -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - cat >>confdefs.h <<\EOF -#define CLOCK_PCF 1 -EOF - -fi -echo "$ac_t""$ntp_ok" 1>&6 - -echo $ac_n "checking Spectracom 8170/Netclock/2 WWVB receiver... $ac_c" 1>&6 -echo "configure:9401: checking Spectracom 8170/Netclock/2 WWVB receiver" 1>&5 -# 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 - -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - cat >>confdefs.h <<\EOF -#define CLOCK_SPECTRACOM 1 -EOF - -fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:9421: checking Kinemetrics/TrueTime receivers" 1>&5 +echo "$as_me:$LINENO: 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" ntp_ok=$enableval else - case "$target" in + case "$host" in vax-dec-bsd) ntp_ok=no ;; @@ -9431,41 +20844,108 @@ else ntp_ok=$ntp_eac ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define CLOCK_TRUETIME 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 -case "$ntp_ok$target" in - yesvax-dec-bsd) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 +case "$ntp_ok$host" in + yesvax-dec-bsd) { echo "$as_me:$LINENO: 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:9450: checking Ultralink M320 WWVB receiver" 1>&5 +echo "$as_me:$LINENO: checking TrueTime 560 IRIG-B decoder" >&5 +echo $ECHO_N "checking TrueTime 560 IRIG-B decoder... $ECHO_C" >&6 +# Check whether --enable-TT560 or --disable-TT560 was given. +if test "${enable_TT560+set}" = set; then + enableval="$enable_TT560" + ntp_ok=$enableval +else + ntp_ok=no +fi; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_TT560 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_ULINK 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking WWV receiver... $ac_c" 1>&6 -echo "configure:9469: checking WWV receiver" 1>&5 +# Requires modem control +echo "$as_me:$LINENO: 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef TIOCMBIS + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + ntp_ok=$ntp_eac +else + ntp_ok=no +fi +rm -f conftest* + +fi; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_USNO 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:$LINENO: 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" @@ -9475,63 +20955,44 @@ 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 <<\_ACEOF #define CLOCK_WWV 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9495: checking USNO modem service" 1>&5 -# Check whether --enable-USNO or --disable-USNO was given. -if test "${enable_USNO+set}" = set; then - enableval="$enable_USNO" +echo "$as_me:$LINENO: checking for Zyfer receiver" >&5 +echo $ECHO_N "checking for Zyfer receiver... $ECHO_C" >&6 +# Check whether --enable-ZYFER or --disable-ZYFER was given. +if test "${enable_ZYFER+set}" = set; then + enableval="$enable_ZYFER" ntp_ok=$enableval else - cat >conftest.$ac_ext < -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef TIOCMBIS - yes -#endif - -EOF -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 -#define CLOCK_USNO 1 -EOF + +cat >>confdefs.h <<\_ACEOF +#define CLOCK_ZYFER 1 +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:9535: checking for default inclusion of all suitable PARSE clocks" 1>&5 +echo "$as_me:$LINENO: 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" @@ -9542,16 +21003,20 @@ else *) ntp_eapc=no ;; esac ntp_eapc=no -fi - -echo "$ac_t""$ntp_eapc" 1>&6 +fi; +echo "$as_me:$LINENO: 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:$LINENO: 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:$LINENO: 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 @@ -9560,153 +21025,170 @@ ntp_libparse=no ntp_parseutil=no ntp_rawdcf=no -echo $ac_n "checking Diem Computime Radio Clock... $ac_c" 1>&6 -echo "configure:9565: checking Diem Computime Radio Clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_COMPUTIME 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9590: checking ELV/DCF7000 clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_DCF7000 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9615: checking HOPF 6021 clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_HOPF6021 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9640: checking Meinberg clocks" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_MEINBERG 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9665: checking DCF77 raw time code" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_RAWDCF 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9694: checking if we must enable parity for RAWDCF" 1>&5 + echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no - case "$target" in + case "$host" in *-*-linux*) ans=yes ;; esac ac_cv_var_rawdcf_parity=$ans fi -echo "$ac_t""$ac_cv_var_rawdcf_parity" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define RAWDCF_NO_IGNPAR 1 -EOF +_ACEOF ;; esac ;; @@ -9716,221 +21198,476 @@ EOF ;; esac -echo $ac_n "checking RCC 8000 clock... $ac_c" 1>&6 -echo "configure:9721: checking RCC 8000 clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_RCC8000 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9746: checking Schmid DCF77 clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_SCHMID 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9771: checking Trimble GPS receiver/TAIP protocol" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_TRIMTAIP 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9796: checking Trimble GPS receiver/TSIP protocol" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_TRIMTSIP 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9821: checking WHARTON 400A Series clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_WHARTON_400A 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9846: checking VARITEXT clock" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_VARITEXT 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:$LINENO: 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:$LINENO: 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:9871: checking if we need to make and use the parse libraries" 1>&5 + + + +echo "$as_me:$LINENO: 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 <<\_ACEOF #define CLOCK_PARSE 1 -EOF +_ACEOF LIBPARSE=../libparse/libparse.a MAKE_LIBPARSE=libparse.a MAKE_CHECK_Y2K=check_y2k - cat >>confdefs.h <<\EOF -#define PPS_SAMPLE 1 -EOF - cat >>confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF +#define PPS_SAMPLE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF #define CLOCK_ATOM 1 -EOF +_ACEOF ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we need to make and use the RSAREF library... $ac_c" 1>&6 -echo "configure:9896: checking if we need to make and use the RSAREF library" 1>&5 -# Check whether --with-rsaref or --without-rsaref was given. -if test "${with_rsaref+set}" = set; then - withval="$with_rsaref" - ans=yes -case "$withval" in - no) ans=no ;; -esac +# AC_SUBST(RSAOBJS) +# AC_SUBST(RSASRCS) +# AC_SUBST(RSADIR) +# AC_SUBST(RSAREF) +# AC_SUBST(LIBRSAREF) +# AC_SUBST(MAKE_LIBRSAREF) + + + + + + + +echo "$as_me:$LINENO: 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 - +fi; case "$ans" in - yes) - ans=no - if test -f $srcdir/rsaref2/source/rsa.c - then - ans=yes - LIBRSAREF=../librsaref/librsaref.a - MAKE_LIBRSAREF=librsaref.a - MAKE_NTP_GENKEYS=ntp_genkeys - cat >>confdefs.h <<\EOF -#define DES 1 -EOF + no) ;; + yes) # Look in: + ans="/usr/lib /usr/lib/openssl /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 + case "$host" in + *-*-darwin*) + test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break + ;; + *) + test -f $i/libcrypto.a -a -f $i/libssl.a && break + ;; + esac + done + case "$i" in + no) + ans=no + OPENSSL_LIB= + ;; + *) ans=$i + OPENSSL_LIB=$ans + ;; + esac + ;; +esac +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 - cat >>confdefs.h <<\EOF -#define PUBKEY -EOF +echo "$as_me:$LINENO: 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:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 + + +# 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|openssl) + 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" + LCRYPTO=-lcrypto + + MAKE_NTP_KEYGEN=ntp-keygen + +cat >>confdefs.h <<\_ACEOF +#define OPENSSL +_ACEOF + + + +for ac_func in EVP_md2 EVP_mdc2 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* 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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done fi ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: checking for the level of crypto support" >&5 +echo $ECHO_N "checking for the level of crypto support... $ECHO_C" >&6 +echo "$as_me:$LINENO: 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:9931: checking if we can make dcf parse utilities" 1>&5 +echo "$as_me:$LINENO: 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:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 + +echo "$as_me:$LINENO: checking if we want to try SNTP" >&5 +echo $ECHO_N "checking if we want to try SNTP... $ECHO_C" >&6 + +# Check whether --with-sntp or --without-sntp was given. +if test "${with_sntp+set}" = set; then + withval="$with_sntp" + ans=$withval +else + ans=no +fi; +case "$ans" in + no) ;; + *) + MAKE_SNTP="sntp" + + ans=yes + ;; +esac +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 + + + + +echo "$as_me:$LINENO: 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 + case "$host" in *-*-sunos4*|*-*-solaris2*|*-*-linux*) ans="dcfd testdcf" DCFD=dcfd @@ -9938,20 +21675,23 @@ if test "$ntp_parseutil" = "yes"; then ;; esac fi -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: 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:9945: checking if we can build kernel streams modules for parse" 1>&5 + +echo "$as_me:$LINENO: 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) - case "$target" in + case "$host" in sparc-*-sunos4*) case "$ac_cv_var_kernel_pll" in yes) - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define PPS_SYNC 1 -EOF +_ACEOF ;; esac @@ -9965,23 +21705,26 @@ EOF esac ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we need basic refclock support... $ac_c" 1>&6 -echo "configure:9972: checking if we need basic refclock support" 1>&5 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define REFCLOCK 1 -EOF +_ACEOF fi -echo "$ac_t""$ntp_refclock" 1>&6 +echo "$as_me:$LINENO: 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:9984: checking if we want HP-UX adjtimed support" 1>&5 -case "$target" in + +echo "$as_me:$LINENO: checking if we want HP-UX adjtimed support" >&5 +echo $ECHO_N "checking if we want HP-UX adjtimed support... $ECHO_C" >&6 +case "$host" in *-*-hpux[56789]*) ans=yes ;; @@ -9990,17 +21733,38 @@ case "$target" in esac if test "$ans" = "yes"; then MAKE_ADJTIMED=adjtimed - cat >>confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define NEED_HPUX_ADJTIME 1 -EOF +_ACEOF fi -echo "$ac_t""$ans" 1>&6 +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we can read kmem... $ac_c" 1>&6 -echo "configure:10002: checking if we can read kmem" 1>&5 +echo "$as_me:$LINENO: checking if we want QNX adjtime support" >&5 +echo $ECHO_N "checking if we want QNX adjtime support... $ECHO_C" >&6 +case "$host" in + *-*-qnx*) + ans=yes + ;; + *) ans=no + ;; +esac +if test "$ans" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_QNX_ADJTIME 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-kmem or --disable-kmem was given. if test "${enable_kmem+set}" = set; then @@ -10014,7 +21778,7 @@ else *) ans=no ;; esac - case "$target" in + case "$host" in *-*-aix*) #ans=no ;; @@ -10033,33 +21797,37 @@ else *-*-winnt3.5) ans=no ;; + *-*-unicosmp*) + 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:$LINENO: 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 <<\_ACEOF #define NOKMEM 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if adjtime is accurate... $ac_c" 1>&6 -echo "configure:10054: checking if adjtime is accurate" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 "$host" in i386-sequent-ptx*) ans=no ;; @@ -10072,41 +21840,45 @@ else *-fujitsu-uxp*) ans=yes ;; - *-ibm-aix4*) + *-ibm-aix[45]*) ans=yes ;; *-*-linux*) ans=yes ;; - *-*-solaris2.[01]*) + *-*-solaris2.[01]) ans=no ;; *-*-solaris2*) ans=yes ;; + *-*-unicosmp*) + ans=yes + ;; *) 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:$LINENO: 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 <<\_ACEOF #define ADJTIME_IS_ACCURATE 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking the name of 'tick' in the kernel... $ac_c" 1>&6 -echo "configure:10105: checking the name of 'tick' in the kernel" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=_tick -case "$target" in +case "$host" in m68*-hp-hpux*) # HP9000/300? ans=_old_tick ;; @@ -10116,7 +21888,10 @@ case "$target" in *-hp-hpux*) ans=old_tick ;; - *-ibm-aix[34]*) + *-ibm-aix[345]*) + ans=no + ;; + *-*-mpeix*) ans=no ;; *-*-ptx*) @@ -10134,45 +21909,49 @@ case "$target" in esac ac_cv_var_nlist_tick=$ans fi -echo "$ac_t""$ac_cv_var_nlist_tick" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define K_TICK_NAME "$ac_cv_var_nlist_tick" -EOF +_ACEOF ;; esac # -echo $ac_n "checking for the units of 'tick'... $ac_c" 1>&6 -echo "configure:10148: checking for the units of 'tick'" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=usec -case "$target" in +case "$host" in *-*-solaris2*) ans=nsec ;; esac ac_cv_var_tick_nano=$ans fi -echo "$ac_t""$ac_cv_var_tick_nano" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define TICK_NANO 1 -EOF +_ACEOF ;; esac # -echo $ac_n "checking the name of 'tickadj' in the kernel... $ac_c" 1>&6 -echo "configure:10171: checking the name of 'tickadj' in the kernel" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=_tickadj -case "$target" in +case "$host" in m68*-hp-hpux*) # HP9000/300? ans=_tickadj ;; @@ -10191,6 +21970,9 @@ case "$target" in *-*-aix*) ans=tickadj ;; + *-*-mpeix*) + ans=no + ;; *-*-ptx*) ans=tickadj ;; @@ -10209,44 +21991,48 @@ case "$target" in esac ac_cv_var_nlist_tickadj=$ans fi -echo "$ac_t""$ac_cv_var_nlist_tickadj" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define K_TICKADJ_NAME "$ac_cv_var_nlist_tickadj" -EOF +_ACEOF ;; esac # -echo $ac_n "checking for the units of 'tickadj'... $ac_c" 1>&6 -echo "configure:10223: checking for the units of 'tickadj'" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=usec -case "$target" in +case "$host" in *-*-solaris2*) ans=nsec ;; esac ac_cv_var_tickadj_nano=$ans fi -echo "$ac_t""$ac_cv_var_tickadj_nano" 1>&6 +echo "$as_me:$LINENO: 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 <<\_ACEOF #define TICKADJ_NANO 1 -EOF +_ACEOF ;; esac # -echo $ac_n "checking half-heartedly for 'dosynctodr' in the kernel... $ac_c" 1>&6 -echo "configure:10246: checking half-heartedly for 'dosynctodr' in the kernel" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$target" in + case "$host" in *-apple-aux[23]*) ans=no ;; @@ -10259,6 +22045,9 @@ else *-*-hpux*) ans=no ;; + *-*-mpeix*) + ans=no + ;; *-*-nextstep*) ans=_dosynctodr ;; @@ -10283,22 +22072,24 @@ else esac ac_cv_var_nlist_dosynctodr=$ans fi -echo "$ac_t""$ac_cv_var_nlist_dosynctodr" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define K_DOSYNCTODR_NAME "$ac_cv_var_nlist_dosynctodr" -EOF +_ACEOF ;; esac # -echo $ac_n "checking half-heartedly for 'noprintf' in the kernel... $ac_c" 1>&6 -echo "configure:10298: checking half-heartedly for 'noprintf' in the kernel" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$target" in + case "$host" in *-apple-aux[23]*) ans=no ;; @@ -10311,6 +22102,9 @@ else *-*-hpux*) ans=no ;; + *-*-mpeix*) + ans=no + ;; *-*-ptx*) ans=noprintf ;; @@ -10329,20 +22123,25 @@ else esac ac_cv_var_nlist_noprintf=$ans fi -echo "$ac_t""$ac_cv_var_nlist_noprintf" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define K_NOPRINTF_NAME "$ac_cv_var_nlist_noprintf" -EOF +_ACEOF ;; esac -echo $ac_n "checking for a default value for 'tick'... $ac_c" 1>&6 -echo "configure:10344: checking for a default value for 'tick'" 1>&5 + + + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-tick or --disable-tick was given. if test "${enable_tick+set}" = set; then @@ -10350,7 +22149,7 @@ if test "${enable_tick+set}" = set; then ans=$enableval else ans=no - case "$target" in + case "$host" in XXX-*-pc-cygwin*) ;; *-univel-sysv*) @@ -10362,30 +22161,37 @@ else *-*-linux*) ans=txc.tick ;; + *-*-mpeix*) + ans=no + ;; *-*-winnt3.5) ans='(every / 10)' ;; + *-*-unicosmp*) + ans=10000 + ;; *) ans='1000000L/hz' ;; esac -fi - +fi; ac_cv_var_tick=$ans fi -echo "$ac_t""$ac_cv_var_tick" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define PRESET_TICK $ac_cv_var_tick -EOF +_ACEOF ;; esac -echo $ac_n "checking for a default value for 'tickadj'... $ac_c" 1>&6 -echo "configure:10387: checking for a default value for 'tickadj'" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-tickadj or --disable-tickadj was given. if test "${enable_tickadj+set}" = set; then @@ -10393,7 +22199,7 @@ if test "${enable_tickadj+set}" = set; then ans=$enableval else ans='500/hz' - case "$target" in + case "$host" in *-fujitsu-uxp*) case "$ac_cv_var_adjtime_is_accurate" in yes) ans='tick/16' ;; @@ -10423,6 +22229,9 @@ else *-*-irix*) ans=150 ;; + *-*-mpeix*) + ans=no + ;; *-*-sco3.2v5.0*) ans=10000L/hz ;; @@ -10436,17 +22245,21 @@ else *-*-winnt3.5) ans=50 ;; + *-*-unicosmp*) + ans=150 + ;; esac -fi - +fi; ac_cv_var_tickadj=$ans fi -echo "$ac_t""$ac_cv_var_tickadj" 1>&6 +echo "$as_me:$LINENO: 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 <>confdefs.h <<_ACEOF #define PRESET_TICKADJ $ac_cv_var_tickadj -EOF +_ACEOF ;; esac @@ -10454,32 +22267,37 @@ esac # 1/100s (system tick). Sigh ... # 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 +case "$host" in + mips-sni-sysv4*) +cat >>confdefs.h <<\_ACEOF #define RELIANTUNIX_CLOCK 1 -EOF +_ACEOF ;; esac -case "$target" in - *-*-sco3.2v5*) cat >>confdefs.h <<\EOF +case "$host" in + *-*-sco3.2v5*) +cat >>confdefs.h <<\_ACEOF #define SCO5_CLOCK 1 -EOF +_ACEOF ;; 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:$LINENO: 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:$LINENO: 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:$LINENO: 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. @@ -10487,52 +22305,27 @@ 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:$LINENO: 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:$LINENO: error: This shouldn't happen." >&5 +echo "$as_me: error: This shouldn't happen." >&2;} + { (exit 1); exit 1; }; } ;; esac -case "$target" in - mips-sni-sysv4*) - # tickadj is pretty useless on newer versions of ReliantUNIX - # Do not bother - 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:10518: checking if we want and can make the tickadj utility" 1>&5 -if test "${ac_cv_make_tickadj+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_make_tickadj=yes -fi -echo "$ac_t""$ac_cv_make_tickadj" 1>&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:10532: checking if we want and can make the ntptime utility" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$target" in + case "$host" in *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in yesyes) ans=yes @@ -10545,17 +22338,108 @@ else esac ac_cv_make_ntptime=$ans fi -echo "$ac_t""$ac_cv_make_ntptime" 1>&6 +echo "$as_me:$LINENO: 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 -echo $ac_n "checking if we want UDP wildcard delivery... $ac_c" 1>&6 -echo "configure:10557: checking if we want UDP wildcard delivery" 1>&5 + +case "$host" 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 "$host" in + *-*-solaris2.1[0-9]*) + ac_cv_make_tickadj=no + ;; + *-*-solaris2.[0-4]*) ;; + *) ac_cv_make_tickadj=no ;; + esac + ;; + *-*-unicosmp*) + ac_cv_make_tickadj=no + ;; +esac +echo "$as_me:$LINENO: 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 "$as_me:$LINENO: 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 "$as_me:$LINENO: 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 "$host" in + *-*-irix*) + ac_cv_make_timetrim=yes + ;; + *-*-unicosmp*) + ac_cv_make_timetrim=yes + ;; + *) + ac_cv_make_timetrim=no + ;; +esac +fi +echo "$as_me:$LINENO: result: $ac_cv_make_timetrim" >&5 +echo "${ECHO_T}$ac_cv_make_timetrim" >&6 +case "$ac_cv_make_timetrim" in + yes) + MAKE_TIMETRIM=timetrim + ;; +esac + + + +echo "$as_me:$LINENO: checking if we want to build the NTPD simulator" >&5 +echo $ECHO_N "checking if we want to build the NTPD simulator... $ECHO_C" >&6 +if test "${ac_cv_var_ntpd_sim+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Check whether --enable-simulator or --disable-simulator was given. +if test "${enable_simulator+set}" = set; then + enableval="$enable_simulator" + ans=$enableval +else + ans=no +fi; +ac_cv_var_ntpd_sim=$ans +fi +echo "$as_me:$LINENO: result: $ac_cv_var_ntpd_sim" >&5 +echo "${ECHO_T}$ac_cv_var_ntpd_sim" >&6 +case "$ac_cv_var_ntpd_sim" in + yes) + MAKE_NTPDSIM=ntpdsim + MAKE_LIBNTPSIM=libntpsim.a + ;; +esac + +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 @@ -10563,7 +22447,7 @@ if test "${enable_udp_wildcard+set}" = set; then ans=$enableval else ans=no - case "$target" in + case "$host" in *-fujitsu-uxp*) ans=yes ;; @@ -10573,7 +22457,7 @@ else *-*-aix3.2*) ans=yes ;; - *-*-aix4*) + *-*-aix[45]*) ans=yes ;; *-*-bsdi*) @@ -10594,6 +22478,9 @@ else *-*-linux*) ans=yes ;; + *-*-mpeix*) + ans=yes + ;; *-*-osf*) ans=yes ;; @@ -10606,23 +22493,27 @@ else *-*-sunos4*) ans=yes ;; + *-*-unicosmp*) + 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:$LINENO: 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 <<\_ACEOF #define UDP_WILDCARD_DELIVERY 1 -EOF +_ACEOF ;; esac -case "$host" in - $target) +case "$build" in + $host) ;; - *) case "$target" in + *) case "$host" in *-*-vxworks*) LDFLAGS="$LDFLAGS -r" ;; @@ -10630,17 +22521,17 @@ case "$host" in ;; esac -echo $ac_n "checking if we should always slew the time... $ac_c" 1>&6 -echo "configure:10635: checking if we should always slew the time" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 "$host" in *-apple-aux[23]*) ans=yes ;; @@ -10656,30 +22547,31 @@ 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:$LINENO: 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 <<\_ACEOF #define SLEWALWAYS 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we should step and slew the time... $ac_c" 1>&6 -echo "configure:10674: checking if we should step and slew the time" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 "$host" in *-sni-sysv*) ans=yes ;; @@ -10689,6 +22581,9 @@ else *-*-ptx*) ans=yes ;; + *-*-solaris2.1[0-9]*) + ans-no + ;; *-*-solaris2.[012]*) ans=yes ;; @@ -10698,60 +22593,62 @@ 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:$LINENO: 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 <<\_ACEOF #define STEP_SLEW 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if ntpdate should step the time... $ac_c" 1>&6 -echo "configure:10716: checking if ntpdate should step the time" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 "$host" 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:$LINENO: 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 <<\_ACEOF #define FORCE_NTPDATE_STEP 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we should sync TODR clock every hour... $ac_c" 1>&6 -echo "configure:10746: checking if we should sync TODR clock every hour" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 enableval="$enable_hourly_todr_sync" ans=$enableval else - case "$target" in + case "$host" in *-*-nextstep*) ans=yes ;; @@ -10761,45 +22658,65 @@ 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:$LINENO: 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 <<\_ACEOF #define DOSYNCTODR 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking if we should avoid kernel FLL bug... $ac_c" 1>&6 -echo "configure:10778: checking if we should avoid kernel FLL bug" 1>&5 +echo "$as_me:$LINENO: 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 $ac_n "(cached) $ac_c" 1>&6 + 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 "$host" in *-*-solaris2.6) - case "`uname -v`" in - Generic_105181-17) - ans=no + 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 - ;; - Generic_106541-08) - 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 ;; @@ -10808,23 +22725,396 @@ 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:$LINENO: 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 <<\_ACEOF #define KERNEL_FLL_BUG 1 -EOF +_ACEOF ;; esac -case "$host" in - $target) +echo "$as_me:$LINENO: checking if we should use the IRIG sawtooth filter" >&5 +echo $ECHO_N "checking if we should use the IRIG sawtooth filter... $ECHO_C" >&6 +if test "${ac_cv_var_irig_sucks+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Check whether --enable-irig-sawtooth or --disable-irig-sawtooth was given. +if test "${enable_irig_sawtooth+set}" = set; then + enableval="$enable_irig_sawtooth" + ans=$enableval +else + case "$host" in + *-*-solaris2.[89]) + ans=yes + ;; + *-*-solaris2.1[0-9]*) + ans=yes + ;; + *) ans=no + ;; + esac + +fi; +ac_cv_var_irig_sucks=$ans +fi +echo "$as_me:$LINENO: result: $ac_cv_var_irig_sucks" >&5 +echo "${ECHO_T}$ac_cv_var_irig_sucks" >&6 +case "$ac_cv_var_irig_sucks" in + yes) +cat >>confdefs.h <<\_ACEOF +#define IRIG_SUCKS 1 +_ACEOF + ;; +esac + +echo "$as_me:$LINENO: checking if we should enable NIST lockclock scheme" >&5 +echo $ECHO_N "checking if we should enable NIST lockclock scheme... $ECHO_C" >&6 +if test "${ac_cv_var_nist_lockclock+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Check whether --enable-nist or --disable-nist was given. +if test "${enable_nist+set}" = set; then + enableval="$enable_nist" + ans=$enableval +else + ans=no +fi; +ac_cv_var_nist_lockclock=$ans +fi +echo "$as_me:$LINENO: result: $ac_cv_var_nist_lockclock" >&5 +echo "${ECHO_T}$ac_cv_var_nist_lockclock" >&6 +case "$ac_cv_var_nist_lockclock" in + yes) +cat >>confdefs.h <<\_ACEOF +#define LOCKCLOCK 1 +_ACEOF + ;; +esac + +# +# ISC stuff +# + +if test $ac_cv_struct_sockaddr_has_sa_len = yes; then + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_HAVESALEN +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for IPv6 structures" >&5 +echo $ECHO_N "checking for IPv6 structures... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +int +main () +{ +struct sockaddr_in6 sin6; return (0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + found_ipv6=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + found_ipv6=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +echo "$as_me:$LINENO: checking for struct if_laddrconf" >&5 +echo $ECHO_N "checking for struct if_laddrconf... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + struct if_laddrconf a; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_HAVEIF_LADDRCONF +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +echo "$as_me:$LINENO: checking for struct if_laddrreq" >&5 +echo $ECHO_N "checking for struct if_laddrreq... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + struct if_laddrreq a; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_HAVEIF_LADDRREQ +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +case "$found_ipv6" in + yes) + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_HAVEIPV6 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define WANT_IPV6 +_ACEOF + + + echo "$as_me:$LINENO: checking for in6_pktinfo" >&5 +echo $ECHO_N "checking for in6_pktinfo... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +$isc_netinetin6_hack +$isc_netinet6in6_hack + +int +main () +{ +struct in6_pktinfo xyzzy; return (0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_HAVEIN6PKTINFO +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no -- disabling runtime ipv6 support" >&5 +echo "${ECHO_T}no -- disabling runtime ipv6 support" >&6 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + echo "$as_me:$LINENO: checking for in6addr_any" >&5 +echo $ECHO_N "checking for in6addr_any... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +$isc_netinetin6_hack +$isc_netinet6in6_hack +$isc_in_addr6_hack + +int +main () +{ +struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cat >>confdefs.h <<\_ACEOF +#define ISC_PLATFORM_NEEDIN6ADDRANY +_ACEOF + + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ;; - *) case "$target" in +esac + +# +# Look for a sysctl call to get the list of network interfaces. +# +echo "$as_me:$LINENO: checking for interface list sysctl" >&5 +echo $ECHO_N "checking for interface list sysctl... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +#ifdef NET_RT_IFLIST +found_rt_iflist +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "found_rt_iflist" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_IFLIST_SYSCTL 1 +_ACEOF + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest* + + +case "$build" in + $host) + ;; + *) case "$host" in *-*-vxworks*) LDFLAGS="$LDFLAGS -r" ;; @@ -10832,49 +23122,157 @@ case "$host" in ;; esac -# 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_expanded=`( + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + eval echo \""$sysconfdir"\" + )` + +cat >>confdefs.h <<_ACEOF +#define NTP_KEYSDIR "$ac_expanded" +_ACEOF + + + + +if test -d $srcdir/arlib +then + +# Check whether --with-arlib or --without-arlib was given. +if test "${with_arlib+set}" = set; then + withval="$with_arlib" + ans=$withval +else + ans=no +fi; + + case "$ans" in + yes) + ARLIB_DIR=arlib + + +subdirs="$subdirs arlib" + + ;; + esac +fi + + ac_config_files="$ac_config_files Makefile" + + ac_config_files="$ac_config_files ElectricFence/Makefile" + + ac_config_files="$ac_config_files adjtimed/Makefile" + + ac_config_files="$ac_config_files clockstuff/Makefile" + + ac_config_files="$ac_config_files include/Makefile" + + ac_config_files="$ac_config_files include/isc/Makefile" + + ac_config_files="$ac_config_files kernel/Makefile" + + ac_config_files="$ac_config_files kernel/sys/Makefile" + + ac_config_files="$ac_config_files libntp/Makefile" + + ac_config_files="$ac_config_files libparse/Makefile" + + ac_config_files="$ac_config_files ntpd/Makefile" + + ac_config_files="$ac_config_files ntpdate/Makefile" + + ac_config_files="$ac_config_files ntpdc/Makefile" + + ac_config_files="$ac_config_files ntpdc/nl.pl" + + ac_config_files="$ac_config_files ntpq/Makefile" + + ac_config_files="$ac_config_files parseutil/Makefile" + + ac_config_files="$ac_config_files scripts/Makefile" + + ac_config_files="$ac_config_files scripts/calc_tickadj" + + ac_config_files="$ac_config_files scripts/checktime" + + ac_config_files="$ac_config_files scripts/freq_adj" + + ac_config_files="$ac_config_files scripts/mkver" + + ac_config_files="$ac_config_files scripts/ntp-wait" + + ac_config_files="$ac_config_files scripts/ntpsweep" + + ac_config_files="$ac_config_files scripts/ntptrace" + + ac_config_files="$ac_config_files scripts/ntpver" + + ac_config_files="$ac_config_files scripts/plot_summary" + + ac_config_files="$ac_config_files scripts/summary" + + ac_config_files="$ac_config_files util/Makefile" + + +case "$MAKE_SNTP" in + '') ;; + *) + + +subdirs="$subdirs sntp" + + ;; +esac + +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 overridden 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/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_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 diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $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" @@ -10882,192 +23280,580 @@ if cmp -s $cache_file confcache; then :; else 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 DEFS=-DHAVE_CONFIG_H +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + : ${CONFIG_STATUS=./config.status} -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 -echo creating $CONFIG_STATUS -cat >$CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # 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. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +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 + +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 + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF # Files that config.status was made for. -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/calc_tickadj scripts/checktime scripts/freq_adj scripts/mkver - scripts/ntp-wait scripts/ntpsweep scripts/ntpver scripts/plot_summary - scripts/summary util/Makefile" -config_headers="\\ - config.h" -config_commands="\\ - default-1 default-2 default" +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi -ac_cs_usage="\\ -\\\`$CONFIG_STATUS' instantiates files from templates according to the +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 <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the current configuration. -Usage: $CONFIG_STATUS [OPTIONS] FILE... +Usage: $0 [OPTIONS] [FILE]... - --recheck Update $CONFIG_STATUS by reconfiguring in the same conditions - --version Print the version of Autoconf and exit - --help Display this help and exit + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -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 + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - Instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: -\$config_files +$config_files Configuration headers: -\$config_headers +$config_headers Configuration commands: -\$config_commands +$config_commands Report bugs to ." +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -$CONFIG_STATUS generated by autoconf version 2.14a. -Configured on host `(hostname || uname -n) 2>/dev/null | sed 1q` by - `echo "$0 $ac_configure_args" | sed 's/[\\"\`\$]/\\\\&/g'`" +config.status +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -# Root of the tmp file names. Use pid to allow concurrent executions. -ac_cs_root=cs\$\$ -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +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" +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF # 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 +while test $# != 0 do - case "\$1" in + case $1 in --*=*) - ac_option=\`echo "\$1" | sed -e 's/=.*//'\` - ac_optarg=\`echo "\$1" | sed -e 's/[^=]*=//'\` - shift - set dummy "\$ac_option" "\$ac_optarg" \${1+"\$@"} - shift + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift ;; - -*);; *) # This is not an option, so the user has probably given explicit # arguments. + ac_option=$1 ac_need_defaults=false;; esac - case "\$1" in - + case $ac_option in # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 `echo "$ac_configure_args" | sed 's/[\\"\`\$]/\\\\&/g'` --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 "\$ac_cs_version"; exit 0 ;; + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - echo "$CONFIG_STATUS: ambiguous option: \$ac_option"; exit 1 ;; - -help | --help | --hel ) - echo "\$ac_cs_usage"; exit 0 ;; + { { echo "$as_me:$LINENO: 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_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) - shift - CONFIG_HEADERS="\$CONFIG_FILES \$1" + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" 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" ;; - '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" ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; # This is an error. - -*) echo "$CONFIG_STATUS: invalid option: \$1"; exit 1 ;; - *) echo "$CONFIG_STATUS: invalid argument: \$1"; exit 1 ;; + -*) { { echo "$as_me:$LINENO: 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; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + esac shift done -EOF +ac_configure_extra_args= -cat >>$CONFIG_STATUS </dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" fi -# Remove all the CONFIG_FILES, and trap to remove the temp files. -rm -fr \`echo "\$CONFIG_FILES" | sed "s/:[^ ]*//g"\` -trap 'rm -fr \$ac_cs_root*; exit 1' 1 2 15 +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi -EOF +_ACEOF -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # -AMDEP="$AMDEP" -ac_aux_dir="$ac_aux_dir" -EOF +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "ElectricFence/Makefile" ) CONFIG_FILES="$CONFIG_FILES ElectricFence/Makefile" ;; + "adjtimed/Makefile" ) CONFIG_FILES="$CONFIG_FILES adjtimed/Makefile" ;; + "clockstuff/Makefile" ) CONFIG_FILES="$CONFIG_FILES clockstuff/Makefile" ;; + "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/isc/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/isc/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" ;; + "ntpd/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntpd/Makefile" ;; + "ntpdate/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntpdate/Makefile" ;; + "ntpdc/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntpdc/Makefile" ;; + "ntpdc/nl.pl" ) CONFIG_FILES="$CONFIG_FILES ntpdc/nl.pl" ;; + "ntpq/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntpq/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/ntptrace" ) CONFIG_FILES="$CONFIG_FILES scripts/ntptrace" ;; + "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" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# 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 + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. @@ -11077,95 +23863,128 @@ cat >>$CONFIG_STATUS <\$ac_cs_root.subs <<\\CEOF -s%@SHELL@%$SHELL%;t t -s%@CFLAGS@%$CFLAGS%;t t -s%@CPPFLAGS@%$CPPFLAGS%;t t -s%@CXXFLAGS@%$CXXFLAGS%;t t -s%@FFLAGS@%$FFLAGS%;t t -s%@DEFS@%$DEFS%;t t -s%@LDFLAGS@%$LDFLAGS%;t t -s%@LIBS@%$LIBS%;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%@host@%$host%;t t -s%@host_alias@%$host_alias%;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_alias@%$target_alias%;t t -s%@target_cpu@%$target_cpu%;t t -s%@target_vendor@%$target_vendor%;t t -s%@target_os@%$target_os%;t t -s%@build@%$build%;t t -s%@build_alias@%$build_alias%;t t -s%@build_cpu@%$build_cpu%;t t -s%@build_vendor@%$build_vendor%;t t -s%@build_os@%$build_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%@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%@CPP@%$CPP%;t t -s%@CCDEPMODE@%$CCDEPMODE%;t t -s%@LN_S@%$LN_S%;t t -s%@RANLIB@%$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%@RSAREF@%$RSAREF%;t t -s%@LIBRSAREF@%$LIBRSAREF%;t t -s%@MAKE_LIBRSAREF@%$MAKE_LIBRSAREF%;t t -s%@MAKE_NTP_GENKEYS@%$MAKE_NTP_GENKEYS%;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_TICKADJ@%$MAKE_TICKADJ%;t t -s%@MAKE_NTPTIME@%$MAKE_NTPTIME%;t t + 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,@PATH_SEPARATOR@,$PATH_SEPARATOR,;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,@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,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;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,@CYGPATH_W@,$CYGPATH_W,;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,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;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,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;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,@READLINE_LIBS@,$READLINE_LIBS,;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,@OPENSSL@,$OPENSSL,;t t +s,@OPENSSL_INC@,$OPENSSL_INC,;t t +s,@OPENSSL_LIB@,$OPENSSL_LIB,;t t +s,@MAKE_NTP_KEYGEN@,$MAKE_NTP_KEYGEN,;t t +s,@LCRYPTO@,$LCRYPTO,;t t +s,@EF_PROGS@,$EF_PROGS,;t t +s,@EF_LIBS@,$EF_LIBS,;t t +s,@MAKE_SNTP@,$MAKE_SNTP,;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 +s,@MAKE_LIBNTPSIM@,$MAKE_LIBNTPSIM,;t t +s,@MAKE_NTPDSIM@,$MAKE_NTPDSIM,;t t +s,@ARLIB_DIR@,$ARLIB_DIR,;t t +s,@subdirs@,$subdirs,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF -EOF +_ACEOF - cat >>$CONFIG_STATUS <<\EOF + cat >>$CONFIG_STATUS <<\_ACEOF # 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 @@ -11173,27 +23992,26 @@ EOF 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="" + ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $ac_cs_root.subs >$ac_cs_root.sfrag + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else - sed "${ac_end}q" $ac_cs_root.subs >$ac_cs_root.sfrag + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi - if test ! -s $ac_cs_root.sfrag; then + if test ! -s $tmp/subs.frag; then ac_more_lines=false - rm -f $ac_cs_root.sfrag else # 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 $ac_cs_root.sfrag) >$ac_cs_root.s$ac_sed_frag + /@[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 $ac_cs_root.s$ac_sed_frag" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $ac_cs_root.s$ac_sed_frag" + 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 @@ -11205,84 +24023,183 @@ EOF fi fi # test -n "$CONFIG_FILES" -EOF -cat >>$CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +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%/[^/][^/]*$%%'` - 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%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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 $as_mkdir_p; then + mkdir -p "$ac_dir" else - ac_dir_suffix= ac_dots= - fi + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } - 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" ;; + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + 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_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: 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 by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." - 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 - *[Mm]akefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - # Don't redirect the output to AC_FILE directly: use `mv' so that updating - # is atomic, and doesn't need trapping. - ac_file_inputs=`echo $ac_file_in | - sed -e "s%^%$ac_given_srcdir/%;s%:% $ac_given_srcdir/%g"` - for ac_file_input in $ac_file_inputs; - do - test -f "$ac_file_input" || - { echo "configure: error: cannot find input file \`$ac_file_input'" 1>&2; exit 1; } - done -EOF -cat >>$CONFIG_STATUS <&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:$LINENO: 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; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub $extrasub -EOF -cat >>$CONFIG_STATUS <<\EOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s%@configure_input@%$configure_input%;t t -s%@srcdir@%$srcdir%;t t -s%@top_srcdir@%$top_srcdir%;t t -s%@INSTALL@%$INSTALL%;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$ac_cs_root.out - mv $ac_cs_root.out $ac_file +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;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 -fi; done -rm -f $ac_cs_root.s* -EOF -cat >>$CONFIG_STATUS <<\EOF + # Run the commands associated with the file. + case $ac_file in + ntpdc/nl.pl ) chmod +x ntpdc/nl.pl ;; + scripts/calc_tickadj ) chmod +x scripts/calc_tickadj ;; + scripts/checktime ) chmod +x scripts/checktime ;; + scripts/freq_adj ) chmod +x scripts/freq_adj ;; + scripts/mkver ) chmod +x scripts/mkver ;; + scripts/ntp-wait ) chmod +x scripts/ntp-wait ;; + scripts/ntpsweep ) chmod +x scripts/ntpsweep ;; + scripts/ntptrace ) chmod +x scripts/ntptrace ;; + scripts/ntpver ) chmod +x scripts/ntpver ;; + scripts/plot_summary ) chmod +x scripts/plot_summary ;; + scripts/summary ) chmod +x scripts/summary ;; + esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. @@ -11292,38 +24209,62 @@ cat >>$CONFIG_STATUS <<\EOF # 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%^\([ ]*\)#\([ ]*<>[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%;t t' +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_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='%;t t' +ac_uD=',;t' -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 + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - rm -f $ac_cs_root.frag $ac_cs_root.in $ac_cs_root.out - ac_file_inputs=`echo $ac_file_in | - sed -e "s%^%$ac_given_srcdir/%;s%:% $ac_given_srcdir/%g"` - for ac_file_input in $ac_file_inputs; - do - test -f "$ac_file_input" || - { echo "configure: error: cannot find input file \`$ac_file_input'" 1>&2; exit 1; } - done + # 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:$LINENO: 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:$LINENO: 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 -e 's/[ ]*$//' $ac_file_inputs >$ac_cs_root.in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in -EOF +_ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into @@ -11333,55 +24274,64 @@ EOF # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs -cat >$ac_cs_root.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g +# 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 <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g t clear : clear -s%^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$%${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD}%gp -t cleanup -s%^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -: cleanup -EOF +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF # 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 $ac_cs_root.hdr >conftest.defines -sed -e 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f $ac_cs_root.hdr +# 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.undefs <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF # 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" $ac_cs_root.in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*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 $ac_cs_root.frag. - echo ' cat >$ac_cs_root.frag <>$CONFIG_STATUS - echo ': t' >>$CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$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 $ac_cs_root.frag $ac_cs_root.in >$ac_cs_root.out - rm -f $ac_cs_root.in - mv $ac_cs_root.out $ac_cs_root.in + 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 ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size @@ -11390,15 +24340,18 @@ echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do - # Write a limited-size here document to $ac_cs_root.frag. - echo ' cat >$ac_cs_root.frag <>$CONFIG_STATUS - echo ': t' >>$CONFIG_STATUS + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$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 $ac_cs_root.frag $ac_cs_root.in >$ac_cs_root.out - rm -f $ac_cs_root.in - mv $ac_cs_root.out $ac_cs_root.in + 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 @@ -11406,46 +24359,171 @@ do done rm -f conftest.undefs -cat >>$CONFIG_STATUS <<\EOF - rm -f $ac_cs_root.frag $ac_cs_root.h - echo "/* $ac_file. Generated automatically by configure. */" >$ac_cs_root.h - cat $ac_cs_root.in >>$ac_cs_root.h - rm -f $ac_cs_root.in - if cmp -s $ac_file $ac_cs_root.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f $ac_cs_root.h +cat >>$CONFIG_STATUS <<\_ACEOF + # 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 by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated 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%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv $ac_cs_root.h $ac_file + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi -fi; done -EOF -cat >>$CONFIG_STATUS <<\EOF + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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 $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$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'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # -for ac_file in .. $CONFIG_COMMANDS; do if test "x$ac_file" != x..; then - ac_dest=`echo "$ac_file"|sed 's%:.*%%'` - ac_source=`echo "$ac_file"|sed 's%[^:]*:%%'` +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,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. - echo "executing commands of $ac_dest" - 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 - Makefile) dirpart=.;; - */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; - *) continue;; - esac +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. @@ -11470,30 +24548,222 @@ for mf in $CONFIG_FILES; do sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue - fdir=`echo "$file" | sed -e 's|/[^/]*$||'` - $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" 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 -fi;done -EOF +done +_ACEOF -cat >>$CONFIG_STATUS <<\EOF +cat >>$CONFIG_STATUS <<\_ACEOF -# -# CONFIG_COMMANDS section. -# - -exit 0 -EOF +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -trap 'exit 1' 1 2 15 +ac_clean_files=$ac_clean_files_save -test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 -#test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h]) +# 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=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || 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 + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -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=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d $srcdir/$ac_dir || continue + + { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 +echo "$as_me: configuring in $ac_dir" >&6;} + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + cd $ac_dir + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" + elif test -f $ac_srcdir/configure; then + ac_sub_configure="$SHELL '$ac_srcdir/configure'" + elif test -f $ac_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_top_builddir$cache_file ;; + esac + + { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval $ac_sub_configure $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || + { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd $ac_popdir + done +fi + diff --git a/dist/ntp/configure.in b/dist/ntp/configure.in index 85f5713de5af..131d18f7098d 100644 --- a/dist/ntp/configure.in +++ b/dist/ntp/configure.in @@ -2,45 +2,75 @@ dnl -*-fundamental-*- dnl Process this file with autoconf to produce a configure script. AC_INIT(ntpd/ntp_refclock.c) AC_CANONICAL_SYSTEM -AC_DEFINE_UNQUOTED(STR_SYSTEM, "$target") +AC_DEFINE_UNQUOTED(STR_SYSTEM, "$host", [canonical system (cpu-vendor-os) string]) AM_CONFIG_HEADER(config.h) AC_ARG_PROGRAM -AM_INIT_AUTOMAKE(ntp, 4.0.99i) -AC_PREREQ(2.14) +AM_INIT_AUTOMAKE(ntp, 4.2.0) +AC_PREREQ(2.53) +ac_cv_var_atom_ok=no ac_cv_var_oncore_ok=no +ac_cv_var_ripe_ncc_ok=no +ac_cv_var_jupiter_ok=no dnl Grab any initial CFLAGS so we can pick better defaults. iCFLAGS="$CFLAGS" +dnl check these early to avoid autoconf warnings +AC_AIX +AC_MINIX + 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 +case "$host" in + *-*-amigaos) + CFLAGS="$CFLAGS -Dfork=vfork -DSYS_AMIGA" + ;; *-pc-cygwin*) CFLAGS="$CFLAGS -DSYS_CYGWIN32" ;; i386-sequent-sysv4) case "$CC" in cc) - CFLAGS="$CFLAGS -Wc,+Abi-socket" + CFLAGS="$CFLAGS -Wc,+abi-socket" ;; esac ;; - alpha*-dec-osf*) - case "$CC" in - cc) - CFLAGS="$CFLAGS -std1" - ;; - esac + *-*-mpeix*) + CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB" + LDFLAGS="$LDFLAGS -L/SYSLOG/PUB" + LIBS="$LIBS -lcurses" ;; esac -case "$host" in - $target) +AC_CACHE_CHECK(if we should use /dev/clockctl, ac_clockctl, +[AC_ARG_ENABLE(clockctl, + AC_HELP_STRING([--enable-clockctl], [Use /dev/clockctl for non-root time control]), + [ans=$enableval], + [case "$target" in + *-*-netbsd*) + ans=yes + ;; + *) ans=no + ;; + esac + ]) +ac_clockctl=$ans]) +# End of AC_CACHE_CHECK for clockctl +AC_CHECK_HEADERS(sys/clockctl.h) +case "$ac_clockctl$ac_cv_header_sys_clockctl_h" in + yesyes) + AC_DEFINE(HAVE_CLOCKCTL, ,[[Use /dev/clockctl?]]) ;; - *) case "$target" in +esac + +case "$build" in + $host) + ;; + *) case "$host" in *-*-vxworks*) # Quick and dirty sanity check case "$VX_KERNEL" in @@ -62,36 +92,23 @@ 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 - if test -z "`${CC-cc} -pipe -c conftest.c 2>&1`" -a -s conftest.o; then - ac_cv_prog_cc_pipe=yes - else - ac_cv_prog_cc_pipe=no - fi - rm -f conftest* - ]) - - case "$ac_cv_prog_cc_pipe" in - yes) - CFLAGS="$CFLAGS -pipe" - ;; - esac ;; esac ac_busted_vpath_in_make=no -case "$target" in +case "$host" in *-next-nextstep3) CFLAGS="$CFLAGS -posix" ;; @@ -105,6 +122,7 @@ case "$target" in case "$CFLAGS" in *-n32*) ;; *-n64*) ;; + *-64*) ;; *) case "$iCFLAGS" in '') CFLAGS="-O2 -g3 -n32" ;; *) CFLAGS="$CFLAGS -n32" ;; @@ -114,6 +132,7 @@ case "$target" in case "$LDFLAGS" in *-n32*) ;; *-n64*) ;; + *-64*) ;; *) LDFLAGS="$LDFLAGS -n32" ;; esac fi @@ -121,6 +140,9 @@ case "$target" in *-*-solaris2.5.1) ac_busted_vpath_in_make=yes ;; + *-*-unicosmp*) + ac_busted_vpath_in_make=yes + ;; dnl This is currently commented out by bor. dnl The new versions of ReliantUNIX round adjtime() interval down dnl to 1/100s (system tick). This makes tickadj actually useless. @@ -153,14 +175,15 @@ AC_SUBST(LDFLAGS)dnl AC_PROG_LN_S AC_PROG_GCC_TRADITIONAL -AC_AIX -AC_MINIX +AC_C_VOLATILE AC_ISC_POSIX AC_PROG_RANLIB AC_PATH_PROG(PATH_SH, sh) AC_PATH_PROG(PATH_PERL, perl) -case "$target" in +hs_ULONG_CONST + +case "$host" in *-*-vxworks*) ac_link="$ac_link $VX_KERNEL" ;; @@ -168,59 +191,137 @@ esac AC_PROG_INSTALL -case "$target" in +case "$host" in *-pc-cygwin*) 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_FUNC(openlog, , + AC_CHECK_LIB(gen, openlog, , + AC_CHECK_LIB(syslog, openlog, , , -lsocket))) +AC_CHECK_LIB(md5, MD5Init, , + AC_CHECK_LIB(md, MD5Init)) +AC_CHECK_FUNCS(MD5Init) +dnl HMS: What a hack... +AC_CHECK_HEADERS(readline/history.h readline/readline.h) +case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in + *no*) ;; + *) save_LIBS=$LIBS + LIBS= + AC_CHECK_LIB(readline, readline, , + AC_MSG_NOTICE([Trying again with -lcurses]) + unset ac_cv_lib_readline_readline + AC_CHECK_LIB(readline, readline, + LIBS="-lreadline -lcurses $LIBS" + AC_DEFINE(HAVE_LIBREADLINE) + AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?]), + AC_CHECK_LIB(edit, readline, + LIBS="-ledit -lcurses" + AC_DEFINE(HAVE_LIBEDIT, , [Do we have the edit library?]) + AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?]) + , , -lcurses) + , -lcurses)) + READLINE_LIBS=$LIBS + AC_SUBST(READLINE_LIBS) + LIBS=$save_LIBS + ;; +esac 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 "$host" 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) -AC_CHECK_HEADERS(resolv.h 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(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(bstring.h errno.h fcntl.h ieeefp.h math.h) +# HMS: Lame, but fast. +if test -f /etc/redhat-release +then + : +else + AC_CHECK_HEADERS(md5.h) +fi +AC_CHECK_HEADERS(memory.h netdb.h poll.h) +AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h) +AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h) +case "$host" in + *-*-aix*) + AC_CHECK_HEADERS(utmpx.h) + case "$ac_cv_header_utmpx_h" in + yes) ;; + *) AC_CHECK_HEADERS(utmp.h) ;; + esac + ;; + *) AC_CHECK_HEADERS(utmp.h utmpx.h) ;; +esac +AC_CHECK_HEADERS(arpa/nameser.h) +AC_CHECK_HEADERS(net/if.h, [], [], +[#if HAVE_SYS_SOCKET_H +#include +#endif +]) +AC_CHECK_HEADERS(net/if6.h) +AC_CHECK_HEADERS(netinet/in_system.h netinet/in_systm.h) +AC_CHECK_HEADERS(netinet/in.h) +AC_CHECK_HEADERS(netinet/ip.h, [], [], +[#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_NETINET_IN_SYSTM_H +#include +#endif +]) +AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO, 1, [NetInfo support?])]) AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h) dnl AC_CHECK_HEADERS(sys/chudefs.h) AC_CHECK_HEADERS(sys/clkdefs.h sys/file.h) -case "$target" in +case "$host" in *-*-sunos4*) ;; *) AC_CHECK_HEADERS(sys/ioctl.h) ;; esac +AC_CHECK_HEADERS(sys/ipc.h) AC_CHECK_HEADERS(sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h) AC_CHECK_HEADERS(sys/ppstime.h sys/proc.h sys/resource.h sys/sched.h) -case "$target" in +case "$host" in *-*-sco*) AC_CHECK_HEADERS(sys/sio.h) ;; esac -AC_CHECK_HEADERS(sys/select.h sys/sockio.h sys/stat.h sys/stream.h) -AC_CHECK_HEADERS(sys/stropts.h sys/sysctl.h sys/syssgi.h sys/termios.h) -AC_CHECK_HEADERS(sys/time.h) +AC_CHECK_HEADERS(sys/select.h sys/shm.h sys/signal.h sys/sockio.h) +AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h) +AC_CHECK_HEADERS(sys/stat.h sys/stream.h) +AC_CHECK_HEADERS(sys/stropts.h sys/sysctl.h sys/syssgi.h sys/systune.h) +AC_CHECK_HEADERS(sys/termios.h sys/time.h sys/signal.h) AC_EGREP_CPP(yes, [#include #ifdef PPS_API_VERS_1 yes #endif -], AC_CHECK_HEADERS(sys/timepps.h)) +], [AC_CHECK_HEADERS(sys/timepps.h)]) AC_CHECK_HEADERS(sys/timers.h sys/timex.h sys/tpro.h sys/types.h sys/wait.h) AC_HEADER_TIME -case "$target" in +case "$host" in *-convex-*) AC_CHECK_HEADERS(/sys/sync/queue.h /sys/sync/sema.h) ;; @@ -230,16 +331,37 @@ case "$target" in esac AC_CHECK_HEADER(nlist.h, -[AC_DEFINE(NLIST_STRUCT) +[AC_DEFINE(NLIST_STRUCT, 1, [nlist stuff]) AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un, [AC_TRY_COMPILE([#include ], [struct nlist n; n.n_un.n_name = 0;], ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)]) if test $ac_cv_struct_nlist_n_un = yes; then - AC_DEFINE(NLIST_NAME_UNION) + AC_DEFINE(NLIST_NAME_UNION, 1, [does struct nlist use a name union?]) fi ])dnl +dnl AC_CHECK_HEADERS(net/if.h, [], [], +dnl [#if HAVE_SYS_TYPES_H +dnl # include +dnl #endif +dnl #if HAVE_SYS_SOCKET_H +dnl # include +dnl #endif +dnl ]) + +AC_CHECK_HEADERS(resolv.h, [], [], +[#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif +]) + AC_CACHE_CHECK(for basic volatile support, ac_cv_c_volatile, [AC_TRY_COMPILE([],[ volatile int x;], @@ -249,11 +371,11 @@ volatile int x;], case "$ac_cv_c_volatile" in yes) ;; - *) AC_DEFINE(volatile,) + *) AC_DEFINE(volatile, , [Does the compiler like "volatile"?]) ;; esac -case "$target" in +case "$host" in sparc-*-solaris2*) # Assume that solaris2 is Ansi C... ;; @@ -268,35 +390,40 @@ int foo(short i) { return i; }],[ int i;], ac_cv_have_prototypes=yes, ac_cv_have_prototypes=no) ]) if test "$ac_cv_have_prototypes" = yes; then - AC_DEFINE(HAVE_PROTOTYPES) + AC_DEFINE(HAVE_PROTOTYPES, 1, [Are function prototypes OK?]) fi AC_C_CONST -case "$host" in - $target) - AC_C_BIGENDIAN - ;; - *) case "$target" in - i*86-*-vxworks*) - # LITTLEENDIAN - ;; - *-*-vxworks*) - AC_DEFINE(WORDS_BIGENDIAN) - ;; - *) AC_MSG_ERROR(Cross-compiling needs explicit byte order) - ;; - esac - ;; -esac +AC_C_BIGENDIAN AC_TYPE_SIGNAL AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_TYPE(time_t, long) AC_STRUCT_TM +AC_CACHE_CHECK([for u_int8_t], ac_cv_type_u_int8_t, +[AC_TRY_COMPILE([#include ], + [u_int8_t len = 42; return 0;], + ac_cv_type_u_int8_t=yes, + ac_cv_type_u_int8_t=no) +]) +if test $ac_cv_type_u_int8_t = yes; then + AC_DEFINE(HAVE_TYPE_U_INT8_T,1,Does u_int8_t exist) +fi + +AC_CACHE_CHECK([for u_int64_t], ac_cv_type_u_int64_t, +[AC_TRY_COMPILE([#include ], + [u_int64_t len = 42; return 0;], + ac_cv_type_u_int64_t=yes, + ac_cv_type_u_int64_t=no) +]) +if test $ac_cv_type_u_int64_t = yes; then + AC_DEFINE(HAVE_TYPE_U_INT64_T,1,Does u_int64_t exist) +fi + AC_CACHE_CHECK(for a fallback value for HZ, ac_cv_var_default_hz, [ac_cv_var_default_hz=100 -case "$target" in +case "$host" in alpha*-dec-osf4*|alpha*-dec-osf5*) ac_cv_var_default_hz=1024 ;; @@ -304,11 +431,11 @@ case "$target" in ac_cv_var_default_hz=256 ;; esac]) -AC_DEFINE_UNQUOTED(DEFAULT_HZ, $ac_cv_var_default_hz) +AC_DEFINE_UNQUOTED(DEFAULT_HZ, $ac_cv_var_default_hz, [What is the fallback value for HZ?]) AC_CACHE_CHECK(if we need to override the system's value for HZ, ac_cv_var_override_hz, [ac_cv_var_override_hz=no -case "$target" in +case "$host" in alpha*-dec-osf4*|alpha*-dec-osf5*) ac_cv_var_override_hz=yes ;; @@ -324,7 +451,7 @@ case "$target" in esac]) case "$ac_cv_var_override_hz" in yes) - AC_DEFINE(OVERRIDE_HZ) + AC_DEFINE(OVERRIDE_HZ, 1, [Do we need to override the system's idea of HZ?]) ;; esac @@ -363,7 +490,7 @@ AC_CACHE_CHECK( ] ) if test $ac_cv_struct_sigaction_has_sa_sigaction = yes; then - AC_DEFINE(HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION) + AC_DEFINE(HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION, 1, [Obvious...]) fi AC_CACHE_CHECK(for struct ppsclockev, ac_cv_struct_ppsclockev, @@ -384,7 +511,7 @@ return pce->serial;], ac_cv_struct_ppsclockev=no) ]) if test $ac_cv_struct_ppsclockev = yes; then - AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV) + AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV, 1, [Does a system header define struct ppsclockev?]) fi AC_CACHE_CHECK(struct sockaddr for sa_len, ac_cv_struct_sockaddr_has_sa_len, @@ -397,9 +524,75 @@ return ps->sa_len;], ac_cv_struct_sockaddr_has_sa_len=no) ]) if test $ac_cv_struct_sockaddr_has_sa_len = yes; then - AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR) + AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR, 1, [Should be obvious...]) fi +AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], + ac_cv_have_ss_family_in_struct_ss, [ + AC_TRY_COMPILE( + [ +#include +#include + ], + [ struct sockaddr_storage s; s.ss_family = 1; ], + [ ac_cv_have_ss_family_in_struct_ss="yes" ], + [ ac_cv_have_ss_family_in_struct_ss="no" ], + ) +]) +if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then + AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?]) +else + # Hack around a problem... + case "$host" in + *-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H" + ;; + esac +fi + +AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], + ac_cv_have___ss_family_in_struct_ss, [ + AC_TRY_COMPILE( + [ +#include +#include + ], + [ struct sockaddr_storage s; s.__ss_family = 1; ], + [ ac_cv_have___ss_family_in_struct_ss="yes" ], + [ ac_cv_have___ss_family_in_struct_ss="no" ] + ) +]) +if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then + AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?]) +fi + +AH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS], +[/* Handle ss_family */ +#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS) +# define ss_family __ss_family +# define ss_len __ss_len +#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */]) + +case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in + *yes*) + AC_CACHE_CHECK([for struct snd_size], ac_cv_struct_snd_size, +[AC_TRY_COMPILE([ +#ifdef HAVE_MACHINE_SOUNDCARD_H +# include +#endif +#ifdef HAVE_SYS_SOUNDCARD_H +# include +#endif],[ +extern struct snd_size *ss; +return ss->rec_size;], + ac_cv_struct_snd_size=yes, + ac_cv_struct_snd_size=no) +]) + case "$ac_cv_struct_snd_size" in + yes) AC_DEFINE(HAVE_STRUCT_SND_SIZE, 1,[Do we have struct snd_size?]) ;; + esac + ;; +esac + AC_CACHE_CHECK(struct clockinfo for hz, ac_cv_struct_clockinfo_has_hz, [AC_TRY_COMPILE([ #include ],[ @@ -409,7 +602,7 @@ return pc->hz;], ac_cv_struct_clockinfo_has_hz=no) ]) if test $ac_cv_struct_clockinfo_has_hz = yes; then - AC_DEFINE(HAVE_HZ_IN_STRUCT_CLOCKINFO) + AC_DEFINE(HAVE_HZ_IN_STRUCT_CLOCKINFO, 1, [Obvious...]) fi AC_CACHE_CHECK(struct clockinfo for tickadj, ac_cv_struct_clockinfo_has_tickadj, @@ -421,7 +614,24 @@ return pc->tickadj;], ac_cv_struct_clockinfo_has_tickadj=no) ]) if test $ac_cv_struct_clockinfo_has_tickadj = yes; then - AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO) + AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO, 1, [Obvious...]) +fi + +AC_CACHE_CHECK([for struct timespec], ac_cv_struct_timespec, +[AC_TRY_COMPILE([ +#include +/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */ +#ifdef HAVE_ERRNO_H +# include +#endif +#ifdef HAVE_SYS_TIMEPPS_H +# define FRAC 4294967296 +# include +#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, @@ -434,9 +644,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 #else # ifdef HAVE_TIME_H @@ -449,77 +658,22 @@ AC_CACHE_CHECK(struct ntptimeval for time.tv_nsec, ac_cv_struct_ntptimeval_tv_ns # ifdef HAVE_TIMEX_H # include # 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 -#include ], -[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? -case "$host" in - $target) - AC_CHECK_SIZEOF(signed char) - ;; - *) case "$target" in - *-*-vxworks*) - AC_CHECK_SIZEOF(signed char, 1) - ;; - *) AC_MSG_ERROR(Cross-compiling needs explicit SIZEOF_SIGNED_LONG) - ;; - esac - ;; -esac +AC_CHECK_SIZEOF(signed char) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) -case "$host" in - $target) - AC_CHECK_SIZEOF(int) - ;; - *) case "$target" in - *-*-vxworks*) - AC_CHECK_SIZEOF(int, 4) - ;; - *) AC_MSG_ERROR(Cross-compiling needs explicit SIZEOF_INT) - ;; - esac - ;; -esac - -case "$host" in - $target) - AC_CHECK_SIZEOF(long) - ;; - *) case "$target" in - *-*-vxworks*) - AC_CHECK_SIZEOF(long, 4) - ;; - *) AC_MSG_ERROR(Cross-compiling needs explicit SIZEOF_LONG) - ;; - esac - ;; -esac - -AC_CHECK_TYPES((s_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... ;; no0no) # We have signed chars, can't say 'signed char', no s_char typedef. - AC_DEFINE(NEED_S_CHAR_TYPEDEF) + AC_DEFINE(NEED_S_CHAR_TYPEDEF, 1, [Do we need an s_char typedef?]) ;; no1no) # We have signed chars, can say 'signed char', no s_char typedef. @@ -536,48 +690,68 @@ case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in esac AC_TYPE_UID_T -case "$target" in +case "$host" in *-*-linux*) AC_CHECK_FUNCS(__adjtimex __ntp_gettime) ;; esac -case "$target" in - *-*-aix4*) +case "$host" in + *-*-aix[[45]]*) # (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub # (returning ENOSYS). I didn't check 4.2. If, in the future, # IBM pulls its thumbs out long enough to implement clock_settime, # this conditional will need to change. Maybe use AC_TRY_RUN # instead to try to set the time to itself and check errno. ;; - *) AC_CHECK_FUNCS(clock_settime) + *) AC_CHECK_FUNCS(clock_gettime clock_settime) ;; esac -AC_CHECK_FUNCS(daemon getbootfile getdtablesize getrusage) -AC_CHECK_FUNCS(gettimeofday) -case "$target" in +AC_CHECK_FUNCS(daemon) +AC_CHECK_FUNCS(finite, , + [AC_CHECK_FUNCS(isfinite, , + [AC_MSG_CHECKING(for isfinite with ) + _libs=$LIBS + LIBS="$LIBS -lm" + AC_TRY_LINK([#include ], [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) +AC_CHECK_FUNC(gettimeofday, ,[ +case "$host" in + *-*-mpeix*) ac_cv_func_gettimeofday=yes + ;; +esac]) +case "$host" in *-pc-cygwin*) ;; *) AC_CHECK_FUNCS(getuid) ;; esac -AC_CHECK_FUNCS(hstrerror K_open kvm_open memcpy memmove memset) -case "$target" in +AC_CHECK_FUNCS(hstrerror) +AC_CHECK_FUNC(inet_ntop, [], [AC_DEFINE(ISC_PLATFORM_NEEDNTOP, 1, [ISC: provide inet_ntop()])]) +AC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset) +case "$host" in *-*-sco3.2v5.0.*) # Just stubs. Idiots. ;; *) AC_CHECK_FUNCS(mkstemp) ;; esac -AC_REPLACE_FUNCS(mktime) -case "$target" in - *-*-aix4*) +AC_CHECK_FUNCS(mktime) +case "$host" in + *-*-aix[[45]]*) # Just a stub. Idiots. ;; - *-*-irix*) - # Just stubs in Irix. Idiots. + *-*-irix[[45]]*) + # Just a stub in "old" Irix. Idiots. + ;; + *-*-qnx*) + # Apparently there but not working in QNX. Idiots? ;; *-*-sco3.2v5.0.*) - # Just stubs. Idiots. + # Just a stub. Idiots. ;; alpha*-dec-osf4*|alpha*-dec-osf5*) # mlockall is there, as a #define calling memlk via @@ -589,20 +763,20 @@ case "$target" in ;; esac AC_CHECK_FUNCS(mrand48 srand48 nice nlist) -case "$target" in +case "$host" in *-*-solaris2.6) # Broken... ;; *) AC_CHECK_FUNCS(ntp_adjtime ntp_gettime) ;; esac -AC_CHECK_FUNCS(plock pututline pututxline rtprio) +AC_CHECK_FUNCS(plock pututline pututxline readlink rtprio) case "$ac_cv_func_mrand48" in yes) ;; *) AC_REPLACE_FUNCS(random) ;; esac -case "$target" in - *-*-aix4*) +case "$host" in + *-*-aix[[45]]*) # Just a stub in AIX 4. Idiots. ;; *-*-solaris2.5*) @@ -611,15 +785,25 @@ case "$target" in *) AC_CHECK_FUNCS(sched_setscheduler) ;; esac -AC_CHECK_FUNCS(setlinebuf) -AC_CHECK_FUNCS(setpgid setpriority setsid settimeofday setvbuf sigaction) +AC_CHECK_FUNCS(setlinebuf setpgid setpriority setsid) +AC_CHECK_FUNCS(setrlimit) +AC_CHECK_FUNCS(settimeofday, ,[ +case "$host" in + *-*-mpeix*) ac_cv_func_settimeofday=yes + ;; +esac]) +AC_CHECK_FUNCS(setvbuf sigaction) AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl) -AC_REPLACE_FUNCS(snprintf strerror) -case "$target" in - *-*-aix4*) +AC_CHECK_FUNCS(snprintf strdup strerror strstr) +AC_CHECK_FUNCS(timegm) +case "$host" in + *-*-aix[[45]]*) # Just stubs. Idiots. ;; - *-*-netbsd*) + *-*-netbsd1*) + # Just stubs. Idiots. + ;; + *-*-netbsdelf1*) # Just stubs. Idiots. ;; *-*-openbsd*) @@ -628,7 +812,7 @@ case "$target" in *) AC_CHECK_FUNCS(timer_create timer_settime) ;; esac -case "$target" in +case "$host" in *-pc-cygwin*) # I have no idea... ;; @@ -637,6 +821,12 @@ case "$target" in esac AC_CHECK_FUNCS(uname updwtmp updwtmpx vsprintf) +case "$host" in + *-*-sunos4*) + AC_DEFINE(SPRINTF_CHAR, 1, [*s*printf() functions are char*]) + ;; +esac + AC_CACHE_CHECK(number of arguments to gettimeofday(), ac_cv_func_Xettimeofday_nargs, [AC_TRY_COMPILE([#include ],[ gettimeofday((struct timeval*)0,(struct timezone*)0); @@ -645,7 +835,7 @@ settimeofday((struct timeval*)0,(struct timezone*)0); ac_cv_func_Xettimeofday_nargs=2, ac_cv_func_Xettimeofday_nargs=1) ]) if test $ac_cv_func_Xettimeofday_nargs = 1; then - AC_DEFINE(SYSV_TIMEOFDAY) + AC_DEFINE(SYSV_TIMEOFDAY, 1, [Does Xettimeofday take 1 arg?]) fi AC_CACHE_CHECK(number of arguments taken by setpgrp(), ac_cv_func_setpgrp_nargs, @@ -660,7 +850,7 @@ AC_CACHE_CHECK(number of arguments taken by setpgrp(), ac_cv_func_setpgrp_nargs, ac_cv_func_setpgrp_nargs=2, ac_cv_func_setpgrp_nargs=0) ]) if test $ac_cv_func_setpgrp_nargs = 0; then - AC_DEFINE(HAVE_SETPGRP_0) + AC_DEFINE(HAVE_SETPGRP_0, 1, [define if setpgrp takes 0 arguments]) fi save_CFLAGS=$CFLAGS @@ -689,7 +879,7 @@ qsort(base, 2, sizeof(char *), sortfunc); ]) case "$ac_cv_func_qsort_argtype" in void) - AC_DEFINE(QSORT_USES_VOID_P) + AC_DEFINE(QSORT_USES_VOID_P, 1, [Does qsort expect to work on "void *" stuff?]) ;; esac @@ -702,7 +892,7 @@ AC_CACHE_CHECK(if we need to declare 'errno', ac_cv_decl_errno, [errno = 0;], ac_cv_decl_errno=no, ac_cv_decl_errno=yes)]) case "$ac_cv_decl_errno" in - yes) AC_DEFINE(DECL_ERRNO) ;; + yes) AC_DEFINE(DECL_ERRNO, 1, [Declare errno?]) ;; esac dnl FIXME: from ntpd/ntp_intres.c, but there's no info which header produces @@ -730,7 +920,7 @@ AC_CACHE_CHECK(if we may declare 'h_errno', ac_cv_decl_h_errno, [extern int h_errno;], ac_cv_decl_h_errno=yes, ac_cv_decl_h_errno=no)]) case "$ac_cv_decl_h_errno" in - yes) AC_DEFINE(DECL_H_ERRNO) ;; + yes) AC_DEFINE(DECL_H_ERRNO, 1, [Declare h_errno?]) ;; esac dnl See if char *sys_errlist[] is OK. @@ -743,7 +933,7 @@ AC_CACHE_CHECK([[if declaring 'char *sys_errlist[]' is ok]], ac_cv_decl_sys_errl ], 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) ;; + yes) AC_DEFINE(CHAR_SYS_ERRLIST, 1, [Declare char *sys_errlist array]) ;; esac AC_CACHE_CHECK(if declaring 'syscall()' is ok, ac_cv_decl_syscall, @@ -763,140 +953,151 @@ AC_CACHE_CHECK(if declaring 'syscall()' is ok, ac_cv_decl_syscall, [extern int syscall P((int, ...));], ac_cv_decl_syscall=yes, ac_cv_decl_syscall=no)]) case "$ac_cv_decl_syscall" in - yes) AC_DEFINE(DECL_SYSCALL) ;; + yes) AC_DEFINE(DECL_SYSCALL, 1, [Declare syscall()?]) ;; esac -case "$target" in +case "$host" in + *-*-aix4.3.*) + AC_DEFINE(DECL_HSTRERROR_0, 1, [Declaration style]) # Needed for XLC under AIX 4.3.2 + ;; + *-*-mpeix*) + AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_INET_NTOA_0, 1, [Declaration style]) + AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style]) + AC_DEFINE(DECL_MRAND48_0, 1, [Declaration style]) + AC_DEFINE(DECL_SELECT_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style]) + AC_DEFINE(DECL_SRAND48_0, 1, [Declaration style]) + AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style]) + AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style]) + ;; *-*-osf[[45]]*) - AC_DEFINE(DECL_PLOCK_0) - AC_DEFINE(DECL_STIME_1) + AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style]) + AC_DEFINE(DECL_STIME_1, 1, [Declaration style]) + ;; + *-*-qnx*) + AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style]) ;; *-*-riscos4*) - AC_DEFINE(DECL_ADJTIME_0) - AC_DEFINE(DECL_BZERO_0) - AC_DEFINE(DECL_IOCTL_0) - AC_DEFINE(DECL_IPC_0) - AC_DEFINE(DECL_MEMMOVE_0) - AC_DEFINE(DECL_MKTEMP_0) - AC_DEFINE(DECL_RENAME_0) - AC_DEFINE(DECL_SELECT_0) - AC_DEFINE(DECL_SETITIMER_0) - AC_DEFINE(DECL_SETPRIORITY_0) - AC_DEFINE(DECL_STDIO_0) - AC_DEFINE(DECL_STRTOL_0) - AC_DEFINE(DECL_SYSLOG_0) - AC_DEFINE(DECL_TIME_0) - AC_DEFINE(DECL_TIMEOFDAY_0) - AC_DEFINE(DECL_TOLOWER_0) + AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_BZERO_0, 1, [Declaration style]) + AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style]) + AC_DEFINE(DECL_IPC_0, 1, [Declaration style]) + AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style]) + AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style]) + AC_DEFINE(DECL_RENAME_0, 1, [Declaration style]) + AC_DEFINE(DECL_SELECT_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style]) + AC_DEFINE(DECL_STDIO_0, 1, [Declaration style]) + AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style]) + AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style]) + AC_DEFINE(DECL_TIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style]) + AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style]) ;; *-*-solaris2*) - AC_DEFINE(DECL_MKSTEMP_0) - AC_DEFINE(DECL_SETPRIORITY_1) - case "$target" in + AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETPRIORITY_1, 1, [Declaration style]) + case "$host" in *-*-solaris2.4) - AC_DEFINE(DECL_TIMEOFDAY_0) + AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style]) ;; esac ;; *-*-sunos4*) - AC_DEFINE(DECL_ADJTIME_0) - AC_DEFINE(DECL_BCOPY_0) - AC_DEFINE(DECL_BZERO_0) - AC_DEFINE(DECL_IOCTL_0) - AC_DEFINE(DECL_IPC_0) - AC_DEFINE(DECL_MEMMOVE_0) - AC_DEFINE(DECL_MKTEMP_0) - AC_DEFINE(DECL_MKSTEMP_0) - AC_DEFINE(DECL_MRAND48_0) - AC_DEFINE(DECL_RENAME_0) - AC_DEFINE(DECL_SELECT_0) - AC_DEFINE(DECL_SETITIMER_0) - AC_DEFINE(DECL_SETPRIORITY_0) - AC_DEFINE(DECL_SIGVEC_0) - AC_DEFINE(DECL_SRAND48_0) + AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_BCOPY_0, 1, [Declaration style]) + AC_DEFINE(DECL_BZERO_0, 1, [Declaration style]) + AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style]) + AC_DEFINE(DECL_IPC_0, 1, [Declaration style]) + AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style]) + AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style]) + AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style]) + AC_DEFINE(DECL_MRAND48_0, 1, [Declaration style]) + AC_DEFINE(DECL_RENAME_0, 1, [Declaration style]) + AC_DEFINE(DECL_SELECT_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style]) + AC_DEFINE(DECL_SIGVEC_0, 1, [Declaration style]) + AC_DEFINE(DECL_SRAND48_0, 1, [Declaration style]) case "`basename $ac_cv_prog_CC`" in acc*) ;; - *) AC_DEFINE(DECL_STDIO_0) + *) AC_DEFINE(DECL_STDIO_0, 1, [Declaration style]) ;; esac - AC_DEFINE(DECL_STRTOL_0) - AC_DEFINE(DECL_SYSLOG_0) - AC_DEFINE(DECL_TIME_0) - AC_DEFINE(DECL_TIMEOFDAY_0) - AC_DEFINE(DECL_TOLOWER_0) - AC_DEFINE(DECL_TOUPPER_0) + AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style]) + AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style]) + AC_DEFINE(DECL_TIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style]) + AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style]) + AC_DEFINE(DECL_TOUPPER_0, 1, [Declaration style]) + AC_DEFINE(DECL_STRERROR_0, 1, [Declaration style]) ;; *-*-ultrix4*) - AC_DEFINE(DECL_ADJTIME_0) - AC_DEFINE(DECL_BZERO_0) - AC_DEFINE(DECL_CFSETISPEED_0) - AC_DEFINE(DECL_IOCTL_0) - AC_DEFINE(DECL_IPC_0) - AC_DEFINE(DECL_MKTEMP_0) - AC_DEFINE(DECL_MRAND48_0) - AC_DEFINE(DECL_NLIST_0) - AC_DEFINE(DECL_PLOCK_0) - AC_DEFINE(DECL_SELECT_0) - AC_DEFINE(DECL_SETITIMER_0) - AC_DEFINE(DECL_SETPRIORITY_0) - AC_DEFINE(DECL_SRAND48_0) - AC_DEFINE(DECL_STIME_0) - AC_DEFINE(DECL_SYSLOG_0) - AC_DEFINE(DECL_TIMEOFDAY_0) + AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_BZERO_0, 1, [Declaration style]) + AC_DEFINE(DECL_CFSETISPEED_0, 1, [Declaration style]) + AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style]) + AC_DEFINE(DECL_IPC_0, 1, [Declaration style]) + AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style]) + AC_DEFINE(DECL_MRAND48_0, 1, [Declaration style]) + AC_DEFINE(DECL_NLIST_0, 1, [Declaration style]) + AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style]) + AC_DEFINE(DECL_SELECT_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style]) + AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style]) + AC_DEFINE(DECL_SRAND48_0, 1, [Declaration style]) + AC_DEFINE(DECL_STIME_0, 1, [Declaration style]) + AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style]) + AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style]) ;; esac -case "$target" in +case "$host" in *-*-sco3.2*) - AC_DEFINE(TERMIOS_NEEDS__SVID3) + AC_DEFINE(TERMIOS_NEEDS__SVID3, 1, [Do we need to #define _SVID3 when we #include ?]) ;; esac -AC_CACHE_CHECK(if we should use a streams device for ifconfig, - ac_cv_var_use_streams_device_for_ifconfig, - ac_cv_var_use_streams_device_for_ifconfig=no) - AC_CACHE_CHECK(if we need extra room for SO_RCVBUF, ac_cv_var_rcvbuf_slop, [ans=no -case "$target" in +case "$host" in *-*-hpux[[567]]*) ans=yes ;; esac ac_cv_var_rcvbuf_slop=$ans]) case "$ac_cv_var_rcvbuf_slop" in - yes) AC_DEFINE(NEED_RCVBUF_SLOP) ;; + yes) AC_DEFINE(NEED_RCVBUF_SLOP, 1, [Do we need extra room for SO_RCVBUF? (HPUX <8)]) ;; esac AC_CACHE_CHECK(if we will open the broadcast socket, ac_cv_var_open_bcast_socket, [ans=yes -case "$target" in +case "$host" in *-*-domainos) ans=no ;; - *-*-linux*) - ans=no - ;; esac ac_cv_var_open_bcast_socket=$ans]) case "$ac_cv_var_open_bcast_socket" in - yes) AC_DEFINE(OPEN_BCAST_SOCKET) ;; + yes) AC_DEFINE(OPEN_BCAST_SOCKET, 1, [Should we open the broadcast socket?]) ;; esac AC_CACHE_CHECK(if we want the HPUX version of FindConfig(), ac_cv_var_hpux_findconfig, [ans=no -case "$target" in +case "$host" in *-*-hpux*) ans=yes ;; esac ac_cv_var_hpux_findconfig=$ans]) case "$ac_cv_var_hpux_findconfig" in - yes) AC_DEFINE(NEED_HPUX_FINDCONFIG) ;; + yes) AC_DEFINE(NEED_HPUX_FINDCONFIG, 1, [Do we want the HPUX FindConfig()?]) ;; esac AC_CACHE_CHECK(if process groups are set with -pid, ac_cv_arg_setpgrp_negpid, -[case "$target" in +[case "$host" in *-*-hpux[[567]]*) ans=no ;; @@ -918,12 +1119,12 @@ AC_CACHE_CHECK(if process groups are set with -pid, ac_cv_arg_setpgrp_negpid, esac ac_cv_arg_setpgrp_negpid=$ans]) case "$ac_cv_arg_setpgrp_negpid" in - yes) AC_DEFINE(UDP_BACKWARDS_SETOWN) ;; + yes) AC_DEFINE(UDP_BACKWARDS_SETOWN, 1, [Do we set process groups with -pid?]) ;; esac AC_CACHE_CHECK(if we need a ctty for F_SETOWN, ac_cv_func_ctty_for_f_setown, -[case "$target" in - *-*-bsdi2*) +[case "$host" in + *-*-bsdi[[23]]*) ans=yes ;; *-*-freebsd*) @@ -943,7 +1144,7 @@ AC_CACHE_CHECK(if we need a ctty for F_SETOWN, ac_cv_func_ctty_for_f_setown, esac ac_cv_func_ctty_for_f_setown=$ans]) case "$ac_cv_func_ctty_for_f_setown" in - yes) AC_DEFINE(USE_FSETOWNCTTY) ;; + yes) AC_DEFINE(USE_FSETOWNCTTY, 1, [Must we have a CTTY for fsetown?]) ;; esac ntp_warning='GRONK' @@ -962,8 +1163,8 @@ case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in ans='stime()' ;; *) - case "$host" in - $target) ntp_warning='Which leaves us with nothing to use!' + case "$build" in + $host) ntp_warning='Which leaves us with nothing to use!' ans=none ;; esac @@ -976,7 +1177,7 @@ case "$ntp_warning" in esac AC_CACHE_CHECK(if we have a losing syscall(), ac_cv_var_syscall_bug, -[case "$target" in +[case "$host" in *-*-solaris2.4*) ans=yes ;; @@ -985,7 +1186,7 @@ AC_CACHE_CHECK(if we have a losing syscall(), ac_cv_var_syscall_bug, esac ac_cv_var_syscall_bug=$ans]) case "$ac_cv_var_syscall_bug" in - yes) AC_DEFINE(SYSCALL_BUG) ;; + yes) AC_DEFINE(SYSCALL_BUG, 1, [Buggy syscall() (Solaris2.4)?]) ;; esac AC_CACHE_CHECK(for Streams/TLI, ac_cv_var_streams_tli, @@ -993,7 +1194,7 @@ AC_CACHE_CHECK(for Streams/TLI, ac_cv_var_streams_tli, yes) ans=no # There must be a better way... - case "$target" in + case "$host" in *-*-ptx*) ans=yes ;; @@ -1003,7 +1204,7 @@ AC_CACHE_CHECK(for Streams/TLI, ac_cv_var_streams_tli, ac_cv_var_streams_tli=$ans]) case "$ac_cv_var_streams_tli" in yes) - AC_DEFINE(STREAMS_TLI) + AC_DEFINE(STREAMS_TLI, 1, [Do we have STREAMS/TLI? (Can we replace this with HAVE_SYS_STROPTS_H?)]) ;; esac @@ -1021,7 +1222,7 @@ AC_CACHE_CHECK(if we want to use signalled IO, ac_cv_var_signalled_io, case "$ac_cv_hdr_def_sigio" in yes) ans=yes - case "$target" in + case "$host" in alpha*-dec-osf4*|alpha*-dec-osf5*) ans=no ;; @@ -1049,12 +1250,15 @@ case "$ac_cv_hdr_def_sigio" in *-*-linux*) ans=no ;; + *-*-unicosmp*) + ans=no + ;; esac ;; esac ac_cv_var_signalled_io=$ans]) case "$ac_cv_var_signalled_io" in - yes) AC_DEFINE(HAVE_SIGNALED_IO) ;; + yes) AC_DEFINE(HAVE_SIGNALED_IO, 1, [Can we use SIGIO for tcp and udp IO?]) ;; esac AC_CACHE_CHECK(for SIGPOLL, ac_cv_hdr_def_sigpoll, @@ -1077,7 +1281,7 @@ 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) - case "$target" in + case "$host" in mips-sgi-irix*) ans=no ;; @@ -1090,7 +1294,7 @@ case "$ac_cv_hdr_def_sigpoll" in *-sni-sysv*) ans=no ;; - *-*-aix4*) + *-*-aix[[45]]*) ans=no ;; *-*-hpux*) @@ -1102,12 +1306,18 @@ case "$ac_cv_hdr_def_sigpoll" in *-*-osf*) ans=no ;; + *-*-qnx*) + ans=no + ;; *-*-sunos*) ans=no ;; *-*-ultrix*) ans=no ;; + *-*-unicosmp*) + ans=no + ;; *) ans=yes ;; esac @@ -1115,14 +1325,14 @@ case "$ac_cv_hdr_def_sigpoll" in esac ac_cv_var_use_udp_sigpoll=$ans]) case "$ac_cv_var_use_udp_sigpoll" in - yes) AC_DEFINE(USE_UDP_SIGPOLL) ;; + yes) AC_DEFINE(USE_UDP_SIGPOLL, 1, [Can we use SIGPOLL for UDP?]) ;; esac AC_CACHE_CHECK(if we can use SIGPOLL for TTY I/O, ac_cv_var_use_tty_sigpoll, [ans=no case "$ac_cv_hdr_def_sigpoll" in yes) - case "$target" in + case "$host" in mips-sgi-irix*) ans=no ;; @@ -1135,7 +1345,7 @@ case "$ac_cv_hdr_def_sigpoll" in *-sni-sysv*) ans=no ;; - *-*-aix4*) + *-*-aix[[45]]*) ans=no ;; *-*-hpux*) @@ -1153,6 +1363,12 @@ case "$ac_cv_hdr_def_sigpoll" in *-*-ultrix*) ans=no ;; + *-*-qnx*) + ans=no + ;; + *-*-unicosmp*) + ans=no + ;; *) ans=yes ;; esac @@ -1160,7 +1376,7 @@ case "$ac_cv_hdr_def_sigpoll" in esac ac_cv_var_use_tty_sigpoll=$ans]) case "$ac_cv_var_use_tty_sigpoll" in - yes) AC_DEFINE(USE_TTY_SIGPOLL) ;; + yes) AC_DEFINE(USE_TTY_SIGPOLL, 1, [Can we use SIGPOLL for tty IO?]) ;; esac case "$ac_cv_header_sys_sio_h" in @@ -1184,20 +1400,20 @@ esac AC_CACHE_CHECK(if nlist() values might require extra indirection, ac_cv_var_nlist_extra_indirection, [ans=no -case "$target" in +case "$host" in *-*-aix*) ans=yes ;; esac ac_cv_var_nlist_extra_indirection=$ans]) case "$ac_cv_var_nlist_extra_indirection" in - yes) AC_DEFINE(NLIST_EXTRA_INDIRECTION) ;; + yes) AC_DEFINE(NLIST_EXTRA_INDIRECTION, 1, [Might nlist() values require an extra level of indirection (AIX)?]) ;; esac AC_CACHE_CHECK(for a minimum recommended value of tickadj, ac_cv_var_min_rec_tickadj, [ans=no -case "$target" in +case "$host" in *-*-aix*) ans=40 ;; @@ -1205,37 +1421,45 @@ esac ac_cv_var_min_rec_tickadj=$ans]) case "$ac_cv_var_min_rec_tickadj" in ''|no) ;; - *) AC_DEFINE_UNQUOTED(MIN_REC_TICKADJ, $ac_cv_var_min_rec_tickadj) ;; + *) AC_DEFINE_UNQUOTED(MIN_REC_TICKADJ, $ac_cv_var_min_rec_tickadj, [Should we recommend a minimum value for tickadj?]) ;; esac AC_CACHE_CHECK(if the TTY code permits PARENB and IGNPAR, ac_cv_var_no_parenb_ignpar, [ans=no -case "$target" in +case "$host" in i?86-*-linux*) ans=yes ;; mips-sgi-irix*) ans=yes ;; + i?86-*-freebsd[[123]].*) + ;; + i?86-*-freebsd*) + ans=yes + ;; + *-*-unicosmp*) + ans=yes + ;; esac ac_cv_var_no_parenb_ignpar=$ans]) case "$ac_cv_var_no_parenb_ignpar" in - yes) AC_DEFINE(NO_PARENB_IGNPAR) ;; + yes) AC_DEFINE(NO_PARENB_IGNPAR, 1, [Is there a problem using PARENB and IGNPAR (IRIX)?]) ;; esac AC_MSG_CHECKING(if we're including debugging code) AC_ARG_ENABLE(debugging, [ --enable-debugging + include debugging code], [ntp_ok=$enableval], [ntp_ok=yes]) if test "$ntp_ok" = "yes"; then - AC_DEFINE(DEBUG) + AC_DEFINE(DEBUG, 1, [Enable debugging?]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(for a the number of minutes in a DST adjustment) AC_ARG_ENABLE(dst_minutes, [ --enable-dst-minutes=60 + minutes per DST adjustment], [ans=$enableval], [ans=60]) -AC_DEFINE_UNQUOTED(DSTMINUTES, $ans) +AC_DEFINE_UNQUOTED(DSTMINUTES, $ans, [The number of minutes in a DST adjustment]) AC_MSG_RESULT($ans) AC_CACHE_CHECK(if we have the tty_clk line discipline/streams module, @@ -1244,19 +1468,19 @@ AC_CACHE_CHECK(if we have the tty_clk line discipline/streams module, *yes*) ac_cv_var_tty_clk=yes ;; esac]) case "$ac_cv_var_tty_clk" in - yes) AC_DEFINE(TTYCLK) ;; + yes) AC_DEFINE(TTYCLK, 1, [Do we have the tty_clk line discipline/streams module?]) ;; esac AC_CACHE_CHECK(for the ppsclock streams module, ac_cv_var_ppsclock, ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev) case "$ac_cv_var_ppsclock" in - yes) AC_DEFINE(PPS) ;; + yes) AC_DEFINE(PPS, 1, [Do we have the ppsclock streams module?]) ;; esac AC_CACHE_CHECK(for kernel multicast support, ac_cv_var_mcast, [ac_cv_var_mcast=no - case "$target" in + case "$host" in i386-sequent-sysv4) ;; *) AC_EGREP_CPP(yes, [#include @@ -1266,7 +1490,7 @@ AC_CACHE_CHECK(for kernel multicast support, ac_cv_var_mcast, ], ac_cv_var_mcast=yes) ;; esac]) case "$ac_cv_var_mcast" in - yes) AC_DEFINE(MCAST) ;; + yes) AC_DEFINE(MCAST, 1, [Does the kernel support multicasting IP?]) ;; esac AC_CACHE_CHECK([[availability of ntp_{adj,get}time()]], ac_cv_var_ntp_syscalls, @@ -1291,10 +1515,10 @@ AC_CACHE_CHECK([[availability of ntp_{adj,get}time()]], ac_cv_var_ntp_syscalls, esac]) case "$ac_cv_var_ntp_syscalls" in libc) - AC_DEFINE(NTP_SYSCALLS_LIBC) + AC_DEFINE(NTP_SYSCALLS_LIBC, 1, [Do we have ntp_{adj,get}time in libc?]) ;; kernel) - AC_DEFINE(NTP_SYSCALLS_STD) + AC_DEFINE(NTP_SYSCALLS_STD, 1, [Do we have ntp_{adj,get}time in the kernel?]) ;; *) ;; @@ -1319,13 +1543,13 @@ case "$ac_cv_header_sys_timex_h$ac_cv_struct_ntptimeval$ac_cv_var_sta_fll$ac_cv_ esac]) case "$ac_cv_var_kernel_pll" in yes) - AC_DEFINE(KERNEL_PLL) + AC_DEFINE(KERNEL_PLL, 1, [Does the kernel support precision time discipline?]) ;; esac AC_CACHE_CHECK(if SIOCGIFCONF returns buffer size in the buffer, ac_cv_var_size_returned_in_buffer, [ans=no - case "$target" in + case "$host" in *-fujitsu-uxp*) ans=yes ;; @@ -1338,7 +1562,7 @@ AC_CACHE_CHECK(if SIOCGIFCONF returns buffer size in the buffer, ac_cv_var_size_ esac ac_cv_var_size_returned_in_buffer=$ans]) case "$ac_cv_var_size_returned_in_buffer" in - yes) AC_DEFINE(SIZE_RETURNED_IN_BUFFER) ;; + yes) AC_DEFINE(SIZE_RETURNED_IN_BUFFER, 1, [Does SIOCGIFCONF return size in the buffer?]) ;; esac dnl AC_CACHE_CHECK(if we want GDT surveying code, ac_cv_var_gdt_surveying, @@ -1346,20 +1570,9 @@ dnl [AC_ARG_ENABLE(gdt-surveying, [ --enable-gdt-surveying - include GDT surv dnl [ans=$enableval], [ans=no]) dnl ac_cv_var_gdt_surveying=$ans]) dnl case "$ac_cv_var_gdt_surveying" in -dnl yes) AC_DEFINE(GDT_SURVEYING) ;; +dnl yes) AC_DEFINE(GDT_SURVEYING, 1, [Include the GDT Surveying code?]) ;; 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(AUTOKEY, , [Autokey?]) - AC_DEFINE(MD5) - ;; -esac - # Check for ioctls TIOCGPPSEV AC_MSG_CHECKING(ioctl TIOCGPPSEV) if test "$ac_cv_header_termios_h" = "yes"; then @@ -1373,7 +1586,7 @@ else ntp_ok=no fi if test "$ntp_ok" = "yes"; then - AC_DEFINE(HAVE_TIOCGPPSEV) + AC_DEFINE(HAVE_TIOCGPPSEV, 1, [Do we have the TIOCGPPSEV ioctl (Solaris)?]) ac_cv_var_oncore_ok=yes fi AC_MSG_RESULT($ntp_ok) @@ -1392,7 +1605,7 @@ else fi if test "$ntp_ok" = "yes"; then - AC_DEFINE(HAVE_TIOCSPPS) + AC_DEFINE(HAVE_TIOCSPPS, 1, [Do we have the TIOCSPPS ioctl (Solaris)?]) fi AC_MSG_RESULT($ntp_ok) @@ -1410,19 +1623,36 @@ ntp_ok=no fi if test "$ntp_ok" = "yes"; then ac_cv_var_oncore_ok=yes - AC_DEFINE(HAVE_CIOGETEV) + AC_DEFINE(HAVE_CIOGETEV, 1, [Do we have the CIOGETEV ioctl (SunOS, Linux)?]) fi AC_MSG_RESULT($ntp_ok) -# 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*) - AC_DEFINE(HAVE_PPSAPI) +# 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. + +# 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, 1, [Do we have the PPS API per the Draft RFC?]) ac_cv_var_oncore_ok=yes - AC_DEFINE(HAVE_TIMESPEC) + ac_cv_var_ripe_ncc_ok=yes + ac_cv_var_jupiter_ok=yes ;; esac @@ -1456,7 +1686,7 @@ typedef int u_int; ;; esac if test "$ntp_ok" = "yes"; then - AC_DEFINE(HAVE_TIO_SERIAL_STUFF) + AC_DEFINE(HAVE_TIO_SERIAL_STUFF, 1, [Do we have the TIO serial stuff?]) fi AC_MSG_RESULT($ntp_ok) @@ -1467,7 +1697,7 @@ case "$ac_cv_header_sys_mman_h" in *) ntp_ok=no ;; esac if test "$ntp_ok" = "yes"; then - AC_DEFINE(ONCORE_SHMEM_STATUS) + AC_DEFINE(ONCORE_SHMEM_STATUS, 1, [Do we have support for SHMEM_STATUS?]) fi AC_MSG_RESULT($ntp_ok) @@ -1488,28 +1718,30 @@ ntp_refclock=no # 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], +AC_ARG_ENABLE(BANCOMM, + AC_HELP_STRING([--enable-BANCOMM], [- Datum/Bancomm bc635/VME interface]), [ntp_ok=$enableval], [ntp_ok=no]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_BANC) + AC_DEFINE(CLOCK_BANC, 1, [Datum/Bancomm bc635/VME interface?]) fi AC_MSG_RESULT($ntp_ok) -case "$ntp_ok$target" in +case "$ntp_ok$host" in yes*-*-hpux*) ;; yes*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac #HPUX only, and only by explicit request AC_MSG_CHECKING(TrueTime GPS receiver/VME interface) -AC_ARG_ENABLE(GPSVME, [ --enable-GPSVME - TrueTime GPS receiver/VME interface], +AC_ARG_ENABLE(GPSVME, + AC_HELP_STRING([--enable-GPSVME], [- TrueTime GPS receiver/VME interface]), [ntp_ok=$enableval], [ntp_ok=no]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_GPSVME) + AC_DEFINE(CLOCK_GPSVME, 1, [TrueTime GPS receiver/VME interface?]) fi AC_MSG_RESULT($ntp_ok) -case "$ntp_ok$target" in +case "$ntp_ok$host" in yes*-*-hpux*) ;; yes*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac @@ -1517,7 +1749,7 @@ esac AC_MSG_CHECKING(for PCL720 clock support) case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in yesyesyes) - AC_DEFINE(CLOCK_PPS720) + AC_DEFINE(CLOCK_PPS720, 1, [PCL 720 clock support]) ans=yes ;; *) @@ -1526,23 +1758,15 @@ case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_ esac AC_MSG_RESULT($ans) -AC_MSG_CHECKING(for SHM clock attached thru shared memory) -AC_ARG_ENABLE(SHM, [ --enable-SHM - SHM clock attached thru shared memory], - [ntp_ok=$enableval], [ntp_ok=no]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_SHM) -fi -AC_MSG_RESULT($ntp_ok) - AC_MSG_CHECKING(for default inclusion of all suitable non-PARSE clocks) -AC_ARG_ENABLE(all-clocks, [ --enable-all-clocks + include all suitable non-PARSE clocks:], +AC_ARG_ENABLE(all-clocks, + AC_HELP_STRING([--enable-all-clocks], [+ include all suitable non-PARSE clocks:]), [ntp_eac=$enableval], [ntp_eac=yes]) 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 @@ -1551,48 +1775,28 @@ esac 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 ;; +case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in + *yes*) + ntp_canaudio=yes + AC_DEFINE(HAVE_AUDIO, , [Do we have audio support?]) + ;; + *) ntp_canaudio=no ;; esac AC_MSG_RESULT($ntp_canaudio) -dnl AC_MSG_CHECKING([struct audio_info for monitor_gain]) -dnl AC_C_STRUCT_MEMBER(ai_monitor_gain, -dnl [#ifdef HAVE_SUN_AUDIO_H -dnl #include -dnl #endif -dnl #ifdef HAVE_SYS_AUDIOIO_H -dnl #include -dnl #endif], [struct audio_info], monitor_gain) -dnl case "$ai_monitor_gain" in -dnl *yes*) -dnl AC_DEFINE(HAVE_AI_MONITOR_GAIN, [struct audio_info.monitor_gain?]) -dnl ans=yes -dnl ;; -dnl *) ans=no ;; -dnl esac -dnl AC_MSG_RESULT($ans) - -dnl AC_CHECK_MEMBERS ((AGGREGATE.MEMBER, ...), [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND], [INCLUDES]) - -AC_CHECK_MEMBERS((struct audio_info.monitor_gain, - struct audio_info.output_muted, - struct audio_info.blocksize, - struct audio_info.hiwat, - struct audio_info.lowat, - struct audio_info.mode), , , -[#ifdef HAVE_SUN_AUDIO_H -#include -#endif -#ifdef HAVE_SYS_AUDIOIO_H -#include -#endif]) +AC_MSG_CHECKING([if we have support for the SHM refclock interface]) +case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in + yesyes) + ntp_canshm=yes + ;; + *) ntp_canshm=no ;; +esac +AC_MSG_RESULT($ntp_canshm) # Requires modem control AC_MSG_CHECKING(ACTS modem service) -AC_ARG_ENABLE(ACTS, [ --enable-ACTS + ACTS modem service], +AC_ARG_ENABLE(ACTS, + AC_HELP_STRING([--enable-ACTS], [s ACTS modem service]), [ntp_ok=$enableval], [AC_EGREP_CPP(yes, [#include @@ -1605,65 +1809,84 @@ AC_ARG_ENABLE(ACTS, [ --enable-ACTS + ACTS modem service], ], ntp_ok=$ntp_eac, ntp_ok=no)]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ACTS) + AC_DEFINE(CLOCK_ACTS, 1, [ACTS modem service]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(Arbiter 1088A/B GPS receiver) -AC_ARG_ENABLE(ARBITER, [ --enable-ARBITER + Arbiter 1088A/B GPS receiver], +AC_ARG_ENABLE(ARBITER, + AC_HELP_STRING([--enable-ARBITER], [+ Arbiter 1088A/B GPS receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ARBITER) + AC_DEFINE(CLOCK_ARBITER, 1, [Arbiter 1088A/B GPS receiver]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(Arcron MSF receiver) -AC_ARG_ENABLE(ARCRON_MSF, [ --enable-ARCRON-MSF + Arcron MSF receiver], +AC_ARG_ENABLE(ARCRON_MSF, + AC_HELP_STRING([--enable-ARCRON-MSF], [+ Arcron MSF receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ARCRON_MSF) + AC_DEFINE(CLOCK_ARCRON_MSF, 1, [ARCRON support?]) 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_ARG_ENABLE(AS2201, + AC_HELP_STRING([--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_AS2201) + AC_DEFINE(CLOCK_AS2201, 1, [Austron 2200A/2201A GPS receiver?]) fi AC_MSG_RESULT($ntp_ok) -AC_MSG_CHECKING(PPS interface) -AC_ARG_ENABLE(ATOM, [ --enable-ATOM + PPS interface], +AC_MSG_CHECKING(ATOM PPS interface) +AC_ARG_ENABLE(ATOM, + AC_HELP_STRING([--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_ATOM, 1, [PPS interface?]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(Chrono-log K-series WWVB receiver) +AC_ARG_ENABLE(CHRONOLOG, + AC_HELP_STRING([--enable-CHRONOLOG], [+ Chrono-log K-series WWVB receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ATOM) + AC_DEFINE(CLOCK_CHRONOLOG, 1, [Chronolog K-series WWVB receiver?]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(CHU modem/decoder) -AC_ARG_ENABLE(CHU, [ --enable-CHU - CHU modem/decoder], +AC_ARG_ENABLE(CHU, + AC_HELP_STRING([--enable-CHU], [+ CHU modem/decoder]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_CHU) + AC_DEFINE(CLOCK_CHU, 1, [CHU modem/decoder]) fi AC_MSG_RESULT($ntp_ok) ac_refclock_chu=$ntp_ok AC_MSG_CHECKING(CHU audio/decoder) -AC_ARG_ENABLE(AUDIO-CHU, [ --enable-AUDIO-CHU s CHU audio/decoder], +AC_ARG_ENABLE(AUDIO-CHU, + AC_HELP_STRING([--enable-AUDIO-CHU], [s CHU audio/decoder]), [ntp_ok=$enableval], [case "$ntp_eac$ac_refclock_chu$ntp_canaudio" in *no*) ntp_ok=no ;; *) ntp_ok=yes ;; esac]) if test "$ntp_ok" = "yes"; then - AC_DEFINE(AUDIO_CHU) + AC_DEFINE(AUDIO_CHU, 1, [CHU audio/decoder?]) fi AC_MSG_RESULT($ntp_ok) # We used to check for sunos/solaris target... @@ -1673,7 +1896,8 @@ esac # Not under HP-UX AC_MSG_CHECKING(Datum Programmable Time System) -AC_ARG_ENABLE(DATUM, [ --enable-DATUM s Datum Programmable Time System], +AC_ARG_ENABLE(DATUM, + AC_HELP_STRING([--enable-DATUM], [s Datum Programmable Time System]), [ntp_ok=$enableval], [case "$ac_cv_header_termios_h" in yes) @@ -1684,22 +1908,34 @@ AC_ARG_ENABLE(DATUM, [ --enable-DATUM s Datum Programmable Time Syste esac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_DATUM) + AC_DEFINE(CLOCK_DATUM, 1, [Datum Programmable Time System?]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(Dumb generic hh:mm:ss local clock) +AC_ARG_ENABLE(DUMBCLOCK, + AC_HELP_STRING([--enable-DUMBCLOCK], [+ Dumb generic hh:mm:ss local clock]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_DUMBCLOCK, 1, [Dumb generic hh:mm:ss local clock?]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(Forum Graphic GPS) -AC_ARG_ENABLE(FG, [ --enable-FG + Forum Graphic GPS], +AC_ARG_ENABLE(FG, + AC_HELP_STRING([--enable-FG], [+ Forum Graphic GPS]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_FG) + AC_DEFINE(CLOCK_FG, 1, [Forum Graphic GPS datating station driver?]) fi AC_MSG_RESULT($ntp_ok) # Requires modem control AC_MSG_CHECKING(Heath GC-1000 WWV/WWVH receiver) -AC_ARG_ENABLE(HEATH, [ --enable-HEATH s Heath GC-1000 WWV/WWVH receiver], +AC_ARG_ENABLE(HEATH, + AC_HELP_STRING([--enable-HEATH], [s Heath GC-1000 WWV/WWVH receiver]), [ntp_ok=$enableval], [AC_EGREP_CPP(yes, [#include @@ -1712,21 +1948,43 @@ AC_ARG_ENABLE(HEATH, [ --enable-HEATH s Heath GC-1000 WWV/WWVH receiv ], ntp_ok=$ntp_eac, ntp_ok=no)]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_HEATH) + AC_DEFINE(CLOCK_HEATH, 1, [Heath GC-1000 WWV/WWVH receiver?]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(for hopf serial clock device) +AC_ARG_ENABLE(HOPFSERIAL, + AC_HELP_STRING([--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, 1, [HOPF serial clock device?]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(for hopf PCI clock 6039) +AC_ARG_ENABLE(HOPFPCI, + AC_HELP_STRING([--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, 1, [HOPF PCI clock device?]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(HP 58503A GPS receiver) -AC_ARG_ENABLE(HPGPS, [ --enable-HPGPS + HP 58503A GPS receiver], +AC_ARG_ENABLE(HPGPS, + AC_HELP_STRING([--enable-HPGPS], [+ HP 58503A GPS receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_HPGPS) + AC_DEFINE(CLOCK_HPGPS, 1, [HP 58503A GPS receiver?]) fi AC_MSG_RESULT($ntp_ok) -AC_MSG_CHECKING(Sun IRIG audio decoder) -AC_ARG_ENABLE(IRIG, [ --enable-IRIG s Sun IRIG audio decoder], +AC_MSG_CHECKING(IRIG audio decoder) +AC_ARG_ENABLE(IRIG, + AC_HELP_STRING([--enable-IRIG], [s IRIG audio decoder]), [ntp_ok=$enableval], [case "$ntp_eac$ntp_canaudio" in *no*) ntp_ok=no ;; @@ -1734,43 +1992,70 @@ AC_ARG_ENABLE(IRIG, [ --enable-IRIG s Sun IRIG audio decoder], esac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_IRIG) + AC_DEFINE(CLOCK_IRIG, 1, [IRIG audio decoder?]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canaudio" in yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac -AC_MSG_CHECKING(Leitch CSD 5300 Master Clock System Driver) -AC_ARG_ENABLE(LEITCH, [ --enable-LEITCH + Leitch CSD 5300 Master Clock System Driver], +AC_MSG_CHECKING(for JJY receiver) +AC_ARG_ENABLE(JJY, + AC_HELP_STRING([--enable-JJY], [+ JJY receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_LEITCH) + AC_DEFINE(CLOCK_JJY, 1, [JJY receiver?]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(Rockwell Jupiter GPS receiver) +AC_ARG_ENABLE(JUPITER, + AC_HELP_STRING([--enable-JUPITER], [s Rockwell Jupiter GPS receiver]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +case "$ac_cv_var_jupiter_ok" in + no) ntp_ok=no ;; +esac +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_JUPITER, 1, [Rockwell Jupiter GPS clock?]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(Leitch CSD 5300 Master Clock System Driver) +AC_ARG_ENABLE(LEITCH, + AC_HELP_STRING([--enable-LEITCH], [+ Leitch CSD 5300 Master Clock System Driver]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_LEITCH, 1, [Leitch CSD 5300 Master Clock System Driver?]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(local clock reference) -AC_ARG_ENABLE(LOCAL-CLOCK, [ --enable-LOCAL-CLOCK + local clock reference], +AC_ARG_ENABLE(LOCAL-CLOCK, + AC_HELP_STRING([--enable-LOCAL-CLOCK], [+ local clock reference]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_LOCAL) + AC_DEFINE(CLOCK_LOCAL, 1, [local clock reference?]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(EES M201 MSF receiver) -AC_ARG_ENABLE(MSFEES, [ --enable-MSFEES + EES M201 MSF receiver], +AC_ARG_ENABLE(MSFEES, + AC_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_MSFEES) + AC_DEFINE(CLOCK_MSFEES, 1, [EES M201 MSF receiver]) fi AC_MSG_RESULT($ntp_ok) # Not Ultrix AC_MSG_CHECKING(Magnavox MX4200 GPS receiver) -AC_ARG_ENABLE(MX4200, [ --enable-MX4200 s Magnavox MX4200 GPS receiver], +AC_ARG_ENABLE(MX4200, + AC_HELP_STRING([--enable-MX4200 ], [s Magnavox MX4200 GPS receiver]), [ntp_ok=$enableval], [case "$ac_cv_var_ppsclock" in yes) ntp_ok=$ntp_eac @@ -1780,36 +2065,49 @@ AC_ARG_ENABLE(MX4200, [ --enable-MX4200 s Magnavox MX4200 GPS receiver esac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_MX4200) + AC_DEFINE(CLOCK_MX4200, 1, [Magnavox MX4200 GPS receiver]) fi AC_MSG_RESULT($ntp_ok) -case "$ntp_ok$target" in +case "$ntp_ok$host" in yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac -AC_MSG_CHECKING(NMEA GPS receiver) -AC_ARG_ENABLE(NMEA, [ --enable-NMEA + NMEA GPS receiver], +AC_MSG_CHECKING(for NeoClock4X receiver) +AC_ARG_ENABLE(NEOCLOCK4X, + AC_HELP_STRING([--enable-NEOCLOCK4X], [+ NeoClock4X DCF77 / TDF receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_NMEA) + AC_DEFINE(CLOCK_NEOCLOCK4X, 1, [NeoClock4X]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(NMEA GPS receiver) +AC_ARG_ENABLE(NMEA, + AC_HELP_STRING([--enable-NMEA], [+ NMEA GPS receiver]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_NMEA, 1, [NMEA GPS receiver]) 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, + AC_HELP_STRING([--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 ;; esac if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ONCORE) + AC_DEFINE(CLOCK_ONCORE, 1, [Motorola UT Oncore GPS]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(for Palisade clock) -AC_ARG_ENABLE(PALISADE, [ --enable-PALISADE + Palisade clock], +AC_ARG_ENABLE(PALISADE, + AC_HELP_STRING([--enable-PALISADE], [s Palisade clock]), [ntp_ok=$enableval], [case "$ac_cv_header_termios_h" in yes) @@ -1821,41 +2119,34 @@ AC_ARG_ENABLE(PALISADE, [ --enable-PALISADE + Palisade clock], if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_PALISADE) + AC_DEFINE(CLOCK_PALISADE, 1, [Palisade clock]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(Conrad parallel port radio clock) +AC_ARG_ENABLE(PCF, + AC_HELP_STRING([--enable-PCF ], [+ Conrad parallel port radio clock]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_PCF, 1, [Conrad parallel port radio clock]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(PST/Traconex 1020 WWV/WWVH receiver) -AC_ARG_ENABLE(PST, [ --enable-PST + PST/Traconex 1020 WWV/WWVH receiver], +AC_ARG_ENABLE(PST, + AC_HELP_STRING([--enable-PST], [+ PST/Traconex 1020 WWV/WWVH receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_PST) + AC_DEFINE(CLOCK_PST, 1, [PST/Traconex 1020 WWV/WWVH receiver]) fi AC_MSG_RESULT($ntp_ok) -# Not Ultrix -AC_MSG_CHECKING(Rockwell Jupiter GPS receiver) -AC_ARG_ENABLE(JUPITER, [ --enable-JUPITER s Rockwell Jupiter GPS receiver], - [ntp_ok=$enableval], - [case "$ac_cv_var_ppsclock" in -# yes) ntp_ok=$ntp_eac -# ;; - *) ntp_ok=no - ;; - esac]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_JUPITER) -fi -AC_MSG_RESULT($ntp_ok) -case "$ntp_ok$target" in - yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; -esac - # Requires modem control AC_MSG_CHECKING(PTB modem service) -AC_ARG_ENABLE(PTBACTS, [ --enable-PTBACTS s PTB modem service], +AC_ARG_ENABLE(PTBACTS, + AC_HELP_STRING([--enable-PTBACTS], [s PTB modem service]), [ntp_ok=$enableval], [AC_EGREP_CPP(yes, [#include @@ -1868,12 +2159,53 @@ AC_ARG_ENABLE(PTBACTS, [ --enable-PTBACTS s PTB modem service], ], ntp_ok=$ntp_eac, ntp_ok=no)]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_PTBACTS) + AC_DEFINE(CLOCK_PTBACTS, 1, [PTB modem service]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(RIPENCC specific Trimble driver) +AC_ARG_ENABLE(RIPENCC, + AC_HELP_STRING([--enable-RIPENCC], [- RIPENCC specific Trimble driver]), + [ntp_ok=$enableval], [ntp_ok=no]) +# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage +case "$ac_cv_var_ripe_ncc_ok" in + no) ntp_ok=no ;; +esac +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_RIPENCC, ,[RIPE NCC Trimble clock]) +fi +AC_MSG_RESULT($ntp_ok) + +# Danny Meyer says SHM compiles (with a few warnings) under Win32. +# For *IX, we need sys/ipc.h and sys/shm.h. +AC_MSG_CHECKING(for SHM clock attached thru shared memory) +AC_ARG_ENABLE(SHM, + AC_HELP_STRING([--enable-SHM], [s SHM clock attached thru shared memory]), + [ntp_ok=$enableval], + [case "$ntp_eac$ntp_canshm" in + *no*) ntp_ok=no ;; + *) ntp_ok=yes ;; +esac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_SHM, 1, [clock thru shared memory]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(Spectracom 8170/Netclock/2 WWVB receiver) +AC_ARG_ENABLE(SPECTRACOM, + AC_HELP_STRING([--enable-SPECTRACOM], [+ Spectracom 8170/Netclock/2 WWVB receiver]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_SPECTRACOM, 1, [Spectracom 8170/Netclock/2 WWVB receiver]) fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(KSI/Odetics TPRO/S GPS receiver/IRIG interface) -AC_ARG_ENABLE(TPRO, [ --enable-TPRO s KSI/Odetics TPRO/S GPS receiver/IRIG interface], +AC_ARG_ENABLE(TPRO, + AC_HELP_STRING([--enable-TPRO], [s KSI/Odetics TPRO/S GPS receiver/IRIG interface]), [ntp_ok=$enableval], [case "$ac_cv_header_sys_tpro_h" in yes) @@ -1884,7 +2216,7 @@ AC_ARG_ENABLE(TPRO, [ --enable-TPRO s KSI/Odetics TPRO/S GPS receive esac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_TPRO) + AC_DEFINE(CLOCK_TPRO, 1, [KSI/Odetics TPRO/S GPS receiver/IRIG interface]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ac_cv_header_sys_tpro" in @@ -1892,55 +2224,21 @@ case "$ntp_ok$ac_cv_header_sys_tpro" in esac AC_MSG_CHECKING(TRAK 8810 GPS receiver) -AC_ARG_ENABLE(TRAK, [ --enable-TRAK + TRAK 8810 GPS receiver], +AC_ARG_ENABLE(TRAK, + AC_HELP_STRING([--enable-TRAK], [+ TRAK 8810 GPS receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_TRAK) -fi -AC_MSG_RESULT($ntp_ok) - -AC_MSG_CHECKING(Chrono-log K-series WWVB receiver) -AC_ARG_ENABLE(CHRONOLOG, [ --enable-CHRONOLOG + Chrono-log K-series WWVB receiver], - [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_CHRONOLOG) -fi -AC_MSG_RESULT($ntp_ok) - -AC_MSG_CHECKING(Dumb generic hh:mm:ss local clock) -AC_ARG_ENABLE(DUMBCLOCK, [ --enable-DUMBCLOCK + Dumb generic hh:mm:ss local clock], - [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_DUMBCLOCK) -fi -AC_MSG_RESULT($ntp_ok) - -AC_MSG_CHECKING(Conrad parallel port radio clock) -AC_ARG_ENABLE(PCF, [ --enable-PCF + Conrad parallel port radio clock], - [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_PCF) -fi -AC_MSG_RESULT($ntp_ok) - -AC_MSG_CHECKING(Spectracom 8170/Netclock/2 WWVB receiver) -AC_ARG_ENABLE(SPECTRACOM, [ --enable-SPECTRACOM + Spectracom 8170/Netclock/2 WWVB receiver], - [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_SPECTRACOM) + AC_DEFINE(CLOCK_TRAK, 1, [TRAK 8810 GPS receiver]) fi AC_MSG_RESULT($ntp_ok) # Not on a vax-dec-bsd AC_MSG_CHECKING(Kinemetrics/TrueTime receivers) -AC_ARG_ENABLE(TRUETIME, [ --enable-TRUETIME s Kinemetrics/TrueTime receivers], +AC_ARG_ENABLE(TRUETIME, + AC_HELP_STRING([--enable-TRUETIME], [s Kinemetrics/TrueTime receivers]), [ntp_ok=$enableval], - [case "$target" in + [case "$host" in vax-dec-bsd) ntp_ok=no ;; @@ -1950,41 +2248,37 @@ AC_ARG_ENABLE(TRUETIME, [ --enable-TRUETIME s Kinemetrics/TrueTime recei esac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_TRUETIME) + AC_DEFINE(CLOCK_TRUETIME, 1, [Kinemetrics/TrueTime receivers]) fi AC_MSG_RESULT($ntp_ok) -case "$ntp_ok$target" in +case "$ntp_ok$host" in yesvax-dec-bsd) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac +AC_MSG_CHECKING(TrueTime 560 IRIG-B decoder) +AC_ARG_ENABLE(TT560, + AC_HELP_STRING([--enable-TT560], [- TrueTime 560 IRIG-B decoder]), + [ntp_ok=$enableval], [ntp_ok=no]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_TT560, , [TrueTime 560 IRIG-B decoder?]) +fi +AC_MSG_RESULT($ntp_ok) + AC_MSG_CHECKING(Ultralink M320 WWVB receiver) -AC_ARG_ENABLE(ULINK, [ --enable-ULINK + Ultralink WWVB receiver], +AC_ARG_ENABLE(ULINK, + AC_HELP_STRING([--enable-ULINK], [+ Ultralink WWVB receiver]), [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ULINK) + AC_DEFINE(CLOCK_ULINK, 1, [Ultralink M320 WWVB receiver?]) fi AC_MSG_RESULT($ntp_ok) -AC_MSG_CHECKING(WWV receiver) -AC_ARG_ENABLE(WWV, [ --enable-WWV + WWV Audio receiver], - [ntp_ok=$enableval], - [case "$ntp_eac$ntp_canaudio" in - *no*) ntp_ok=no ;; - *) ntp_ok=yes ;; - esac]) -if test "$ntp_ok" = "yes"; then - ntp_refclock=yes - AC_DEFINE(CLOCK_WWV) -fi -AC_MSG_RESULT($ntp_ok) -case "$ntp_ok$ntp_canaudio" in - yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;; -esac - # Requires modem control AC_MSG_CHECKING(USNO modem service) -AC_ARG_ENABLE(USNO, [ --enable-USNO s USNO modem service], +AC_ARG_ENABLE(USNO, + AC_HELP_STRING([--enable-USNO], [s USNO modem service]), [ntp_ok=$enableval], [AC_EGREP_CPP(yes, [#include @@ -1997,7 +2291,34 @@ AC_ARG_ENABLE(USNO, [ --enable-USNO s USNO modem service], ], ntp_ok=$ntp_eac, ntp_ok=no)]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_USNO) + AC_DEFINE(CLOCK_USNO, 1, [USNO modem service]) +fi +AC_MSG_RESULT($ntp_ok) + +AC_MSG_CHECKING(WWV receiver) +AC_ARG_ENABLE(WWV, + AC_HELP_STRING([--enable-WWV], [s WWV Audio receiver]), + [ntp_ok=$enableval], + [case "$ntp_eac$ntp_canaudio" in + *no*) ntp_ok=no ;; + *) ntp_ok=yes ;; + esac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_WWV, 1, [WWV audio driver]) +fi +AC_MSG_RESULT($ntp_ok) +case "$ntp_ok$ntp_canaudio" in + yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;; +esac + +AC_MSG_CHECKING(for Zyfer receiver) +AC_ARG_ENABLE(ZYFER, + AC_HELP_STRING([--enable-ZYFER], [+ Zyfer GPStarplus receiver]), + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_ZYFER, 1, [Zyfer GPStarplus]) fi AC_MSG_RESULT($ntp_ok) @@ -2026,12 +2347,13 @@ ntp_parseutil=no ntp_rawdcf=no AC_MSG_CHECKING(Diem Computime Radio Clock) -AC_ARG_ENABLE(COMPUTIME, [ --enable-COMPUTIME s Diem Computime Radio Clock], +AC_ARG_ENABLE(COMPUTIME, + AC_HELP_STRING([--enable-COMPUTIME], [s Diem Computime Radio Clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_COMPUTIME) + AC_DEFINE(CLOCK_COMPUTIME, 1, [Diems Computime Radio Clock?]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2041,12 +2363,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(ELV/DCF7000 clock) -AC_ARG_ENABLE(DCF7000, [ --enable-DCF7000 s ELV/DCF7000 clock], +AC_ARG_ENABLE(DCF7000, + AC_HELP_STRING([--enable-DCF7000], [s ELV/DCF7000 clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_DCF7000) + AC_DEFINE(CLOCK_DCF7000, 1, [ELV/DCF7000 clock?]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2056,12 +2379,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(HOPF 6021 clock) -AC_ARG_ENABLE(HOPF6021, [ --enable-HOPF6021 s HOPF 6021 clock], +AC_ARG_ENABLE(HOPF6021, + AC_HELP_STRING([--enable-HOPF6021 ], [s HOPF 6021 clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_HOPF6021) + AC_DEFINE(CLOCK_HOPF6021, 1, [HOPF 6021 clock?]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2071,12 +2395,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(Meinberg clocks) -AC_ARG_ENABLE(MEINBERG, [ --enable-MEINBERG s Meinberg clocks], +AC_ARG_ENABLE(MEINBERG, + AC_HELP_STRING([--enable-MEINBERG], [s Meinberg clocks]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_MEINBERG) + AC_DEFINE(CLOCK_MEINBERG, 1, [Meinberg clocks]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2086,14 +2411,15 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(DCF77 raw time code) -AC_ARG_ENABLE(RAWDCF, [ --enable-RAWDCF s DCF77 raw time code], +AC_ARG_ENABLE(RAWDCF, + AC_HELP_STRING([--enable-RAWDCF], [s DCF77 raw time code]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_parseutil=yes ntp_refclock=yes ntp_rawdcf=yes - AC_DEFINE(CLOCK_RAWDCF) + AC_DEFINE(CLOCK_RAWDCF, 1, [DCF77 raw time code]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2107,14 +2433,14 @@ case "$ntp_rawdcf" in AC_CACHE_CHECK(if we must enable parity for RAWDCF, ac_cv_var_rawdcf_parity, [ans=no - case "$target" in + case "$host" in *-*-linux*) ans=yes ;; esac ac_cv_var_rawdcf_parity=$ans]) case "$ac_cv_var_rawdcf_parity" in - yes) AC_DEFINE(RAWDCF_NO_IGNPAR) ;; + yes) AC_DEFINE(RAWDCF_NO_IGNPAR, 1, [Should we not IGNPAR (Linux)?]) ;; esac ;; @@ -2124,12 +2450,13 @@ case "$ntp_rawdcf" in esac AC_MSG_CHECKING(RCC 8000 clock) -AC_ARG_ENABLE(RCC8000, [ --enable-RCC8000 s RCC 8000 clock], +AC_ARG_ENABLE(RCC8000, + AC_HELP_STRING([--enable-RCC8000], [s RCC 8000 clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_RCC8000) + AC_DEFINE(CLOCK_RCC8000, 1, [RCC 8000 clock]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2139,12 +2466,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(Schmid DCF77 clock) -AC_ARG_ENABLE(SCHMID, [ --enable-SCHMID s Schmid DCF77 clock], +AC_ARG_ENABLE(SCHMID, + AC_HELP_STRING([--enable-SCHMID ], [s Schmid DCF77 clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_SCHMID) + AC_DEFINE(CLOCK_SCHMID, 1, [Schmid DCF77 clock]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2154,12 +2482,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(Trimble GPS receiver/TAIP protocol) -AC_ARG_ENABLE(TRIMTAIP, [ --enable-TRIMTAIP s Trimble GPS receiver/TAIP protocol], +AC_ARG_ENABLE(TRIMTAIP, + AC_HELP_STRING([--enable-TRIMTAIP], [s Trimble GPS receiver/TAIP protocol]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_TRIMTAIP) + AC_DEFINE(CLOCK_TRIMTAIP, 1, [Trimble GPS receiver/TAIP protocol]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2169,12 +2498,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(Trimble GPS receiver/TSIP protocol) -AC_ARG_ENABLE(TRIMTSIP, [ --enable-TRIMTSIP s Trimble GPS receiver/TSIP protocol], +AC_ARG_ENABLE(TRIMTSIP, + AC_HELP_STRING([--enable-TRIMTSIP], [s Trimble GPS receiver/TSIP protocol]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_TRIMTSIP) + AC_DEFINE(CLOCK_TRIMTSIP, 1, [Trimble GPS receiver/TSIP protocol]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2184,12 +2514,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(WHARTON 400A Series clock) -AC_ARG_ENABLE(WHARTON, [ --enable-WHARTON s WHARTON 400A Series clock], +AC_ARG_ENABLE(WHARTON, + AC_HELP_STRING([--enable-WHARTON], [s WHARTON 400A Series clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_WHARTON_400A) + AC_DEFINE(CLOCK_WHARTON_400A, 1, [WHARTON 400A Series protocol]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2199,12 +2530,13 @@ case "$ntp_ok$ntp_canparse" in esac AC_MSG_CHECKING(VARITEXT clock) -AC_ARG_ENABLE(VARITEXT, [ --enable-VARITEXT s VARITEXT clock], +AC_ARG_ENABLE(VARITEXT, + AC_HELP_STRING([--enable-VARITEXT], [s VARITEXT clock]), [ntp_ok=$enableval], [ntp_ok=$ntp_eapc]) if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - AC_DEFINE(CLOCK_VARITEXT) + AC_DEFINE(CLOCK_VARITEXT, 1, [VARITEXT protocol]) fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canparse" in @@ -2221,40 +2553,153 @@ ans=no case "$ntp_libparse" in yes) ans=yes - AC_DEFINE(CLOCK_PARSE) + AC_DEFINE(CLOCK_PARSE, 1, [PARSE driver interface]) LIBPARSE=../libparse/libparse.a MAKE_LIBPARSE=libparse.a MAKE_CHECK_Y2K=check_y2k - AC_DEFINE(PPS_SAMPLE) + AC_DEFINE(PPS_SAMPLE, 1, [PPS auxiliary interface for ATOM?]) AC_DEFINE(CLOCK_ATOM) ;; esac AC_MSG_RESULT($ans) -AC_SUBST(RSAREF) -AC_SUBST(LIBRSAREF) -AC_SUBST(MAKE_LIBRSAREF) -AC_SUBST(MAKE_NTP_GENKEYS) -AC_MSG_CHECKING(if we need to make and use the RSAREF library) -AC_ARG_WITH(rsaref, [ --with-rsaref + Use rsaref if possible], -[ans=yes -case "$withval" in - no) ans=no ;; -esac], [ans=yes]) +# AC_SUBST(RSAOBJS) +# AC_SUBST(RSASRCS) +# AC_SUBST(RSADIR) +# AC_SUBST(RSAREF) +# AC_SUBST(LIBRSAREF) +# AC_SUBST(MAKE_LIBRSAREF) + +AC_SUBST(OPENSSL) +AC_SUBST(OPENSSL_INC) +AC_SUBST(OPENSSL_LIB) + +AC_SUBST(MAKE_NTP_KEYGEN) + +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 - yes) - ans=no - if test -f $srcdir/rsaref2/source/rsa.c + no) ;; + yes) # Look in: + ans="/usr/lib /usr/lib/openssl /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 + case "$host" in + *-*-darwin*) + test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break + ;; + *) + test -f $i/libcrypto.a -a -f $i/libssl.a && break + ;; + esac + 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_ARG_WITH(crypto, + AC_HELP_STRING([--with-crypto], [+ =openssl]), +[ans=$withval], [ans=yes]) +case "$ans" in + no) ;; + yes|openssl) + if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC" then - ans=yes - LIBRSAREF=../librsaref/librsaref.a - MAKE_LIBRSAREF=librsaref.a - MAKE_NTP_GENKEYS=ntp_genkeys - AC_DEFINE(DES) - AC_DEFINE(PUBKEY, , [Public key?]) + ans=no + else + # We have OpenSSL inc/lib - use them. + ans=openssl + CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC" + LDFLAGS="$LDFLAGS -L$OPENSSL_LIB" + AC_SUBST(LCRYPTO, [-lcrypto]) + MAKE_NTP_KEYGEN=ntp-keygen + AC_DEFINE(OPENSSL, , [Use OpenSSL?]) + AC_CHECK_FUNCS(EVP_md2 EVP_mdc2) fi ;; esac +AC_MSG_CHECKING(for the level of crypto support) +AC_MSG_RESULT($ans) + +AC_MSG_CHECKING(if we want to compile with ElectricFence) +AC_ARG_WITH(electricfence, + AC_HELP_STRING([--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 + ;; +esac +AC_MSG_RESULT($ans) + +AC_MSG_CHECKING(if we want to try SNTP) +AC_ARG_WITH(sntp, + AC_HELP_STRING([--with-sntp], [- Build SNTP?]), +[ans=$withval], [ans=no]) +case "$ans" in + no) ;; + *) + MAKE_SNTP="sntp" + AC_SUBST(MAKE_SNTP) + ans=yes + ;; +esac AC_MSG_RESULT($ans) AC_SUBST(TESTDCF) @@ -2263,7 +2708,7 @@ AC_SUBST(DCFD) AC_MSG_CHECKING(if we can make dcf parse utilities) ans=no if test "$ntp_parseutil" = "yes"; then - case "$target" in + case "$host" in *-*-sunos4*|*-*-solaris2*|*-*-linux*) ans="dcfd testdcf" DCFD=dcfd @@ -2278,11 +2723,11 @@ AC_MSG_CHECKING(if we can build kernel streams modules for parse) ans=no case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in yesyes) - case "$target" in + case "$host" in sparc-*-sunos4*) case "$ac_cv_var_kernel_pll" in yes) - AC_DEFINE(PPS_SYNC) + AC_DEFINE(PPS_SYNC, 1, [PARSE kernel PLL PPS support]) ;; esac ans=parsestreams @@ -2299,7 +2744,7 @@ AC_MSG_RESULT($ans) AC_MSG_CHECKING(if we need basic refclock support) if test "$ntp_refclock" = "yes"; then - AC_DEFINE(REFCLOCK) + AC_DEFINE(REFCLOCK, 1, [Basic refclock support?]) fi AC_MSG_RESULT($ntp_refclock) @@ -2310,7 +2755,7 @@ AC_SUBST(CLKTEST) dnl Set to "clktest" AC_SUBST(MAKE_ADJTIMED) AC_MSG_CHECKING(if we want HP-UX adjtimed support) -case "$target" in +case "$host" in *-*-hpux[[56789]]*) ans=yes ;; @@ -2319,7 +2764,20 @@ case "$target" in esac if test "$ans" = "yes"; then MAKE_ADJTIMED=adjtimed - AC_DEFINE(NEED_HPUX_ADJTIME) + AC_DEFINE(NEED_HPUX_ADJTIME, 1, [Do we need HPUX adjtime() library support?]) +fi +AC_MSG_RESULT($ans) + +AC_MSG_CHECKING(if we want QNX adjtime support) +case "$host" in + *-*-qnx*) + ans=yes + ;; + *) ans=no + ;; +esac +if test "$ans" = "yes"; then + AC_DEFINE(NEED_QNX_ADJTIME, 1, [Do we need the qnx adjtime call?]) fi AC_MSG_RESULT($ans) @@ -2333,7 +2791,7 @@ AC_CACHE_CHECK(if we can read kmem, ac_cv_var_can_kmem, *) ans=no ;; esac - case "$target" in + case "$host" in *-*-aix*) #ans=no ;; @@ -2352,20 +2810,23 @@ AC_CACHE_CHECK(if we can read kmem, ac_cv_var_can_kmem, *-*-winnt3.5) ans=no ;; + *-*-unicosmp*) + ans=no + ;; esac ]) ac_cv_var_can_kmem=$ans]) case "$ac_cv_var_can_kmem" in *yes*) ;; - *) AC_DEFINE(NOKMEM) ;; + *) AC_DEFINE(NOKMEM, 1, [Should we NOT read /dev/kmem?]) ;; esac 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], - [case "$target" in + [case "$host" in i386-sequent-ptx*) ans=no ;; @@ -2378,31 +2839,34 @@ AC_CACHE_CHECK(if adjtime is accurate, ac_cv_var_adjtime_is_accurate, *-fujitsu-uxp*) ans=yes ;; - *-ibm-aix4*) + *-ibm-aix[[45]]*) ans=yes ;; *-*-linux*) ans=yes ;; - *-*-solaris2.[[01]]*) + *-*-solaris2.[[01]]) ans=no ;; *-*-solaris2*) ans=yes ;; + *-*-unicosmp*) + ans=yes + ;; *) ans=no ;; esac ]) ac_cv_var_adjtime_is_accurate=$ans]) case "$ac_cv_var_adjtime_is_accurate" in - yes) AC_DEFINE(ADJTIME_IS_ACCURATE) ;; + yes) AC_DEFINE(ADJTIME_IS_ACCURATE, 1, [Is adjtime() accurate?]) ;; esac AC_CACHE_CHECK([the name of 'tick' in the kernel], ac_cv_var_nlist_tick, [ans=_tick -case "$target" in +case "$host" in m68*-hp-hpux*) # HP9000/300? ans=_old_tick ;; @@ -2412,7 +2876,10 @@ case "$target" in *-hp-hpux*) ans=old_tick ;; - *-ibm-aix[[34]]*) + *-ibm-aix[[345]]*) + ans=no + ;; + *-*-mpeix*) ans=no ;; *-*-ptx*) @@ -2431,13 +2898,13 @@ esac ac_cv_var_nlist_tick=$ans]) case "$ac_cv_var_nlist_tick" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) AC_DEFINE_UNQUOTED(K_TICK_NAME, "$ac_cv_var_nlist_tick") ;; + *) AC_DEFINE_UNQUOTED(K_TICK_NAME, "$ac_cv_var_nlist_tick", [What is the name of TICK in the kernel?]) ;; esac # AC_CACHE_CHECK([for the units of 'tick'], ac_cv_var_tick_nano, [ans=usec -case "$target" in +case "$host" in *-*-solaris2*) ans=nsec ;; @@ -2445,14 +2912,14 @@ esac ac_cv_var_tick_nano=$ans]) case "$ac_cv_var_tick_nano" in nsec) - AC_DEFINE(TICK_NANO) + AC_DEFINE(TICK_NANO, 1, [Is K_TICK_NAME in nanoseconds?]) ;; esac # AC_CACHE_CHECK([the name of 'tickadj' in the kernel], ac_cv_var_nlist_tickadj, [ans=_tickadj -case "$target" in +case "$host" in m68*-hp-hpux*) # HP9000/300? ans=_tickadj ;; @@ -2471,6 +2938,9 @@ case "$target" in *-*-aix*) ans=tickadj ;; + *-*-mpeix*) + ans=no + ;; *-*-ptx*) ans=tickadj ;; @@ -2490,13 +2960,13 @@ esac ac_cv_var_nlist_tickadj=$ans]) case "$ac_cv_var_nlist_tickadj" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) AC_DEFINE_UNQUOTED(K_TICKADJ_NAME, "$ac_cv_var_nlist_tickadj") ;; + *) AC_DEFINE_UNQUOTED(K_TICKADJ_NAME, "$ac_cv_var_nlist_tickadj", [What is the name of TICKADJ in the kernel?]) ;; esac # AC_CACHE_CHECK([for the units of 'tickadj'], ac_cv_var_tickadj_nano, [ans=usec -case "$target" in +case "$host" in *-*-solaris2*) ans=nsec ;; @@ -2504,13 +2974,13 @@ esac ac_cv_var_tickadj_nano=$ans]) case "$ac_cv_var_tickadj_nano" in nsec) - AC_DEFINE(TICKADJ_NANO) + AC_DEFINE(TICKADJ_NANO, 1, [Is K_TICKADJ_NAME in nanoseconds?]) ;; esac # AC_CACHE_CHECK([half-heartedly for 'dosynctodr' in the kernel], ac_cv_var_nlist_dosynctodr, -[case "$target" in +[case "$host" in *-apple-aux[[23]]*) ans=no ;; @@ -2523,6 +2993,9 @@ ac_cv_var_nlist_dosynctodr, *-*-hpux*) ans=no ;; + *-*-mpeix*) + ans=no + ;; *-*-nextstep*) ans=_dosynctodr ;; @@ -2548,13 +3021,13 @@ esac ac_cv_var_nlist_dosynctodr=$ans]) case "$ac_cv_var_nlist_dosynctodr" in no) ;; - *) AC_DEFINE_UNQUOTED(K_DOSYNCTODR_NAME, "$ac_cv_var_nlist_dosynctodr") + *) AC_DEFINE_UNQUOTED(K_DOSYNCTODR_NAME, "$ac_cv_var_nlist_dosynctodr", [What is (probably) the name of DOSYNCTODR in the kernel?]) ;; esac # AC_CACHE_CHECK([half-heartedly for 'noprintf' in the kernel], ac_cv_var_nlist_noprintf, -[case "$target" in +[case "$host" in *-apple-aux[[23]]*) ans=no ;; @@ -2567,6 +3040,9 @@ ac_cv_var_nlist_noprintf, *-*-hpux*) ans=no ;; + *-*-mpeix*) + ans=no + ;; *-*-ptx*) ans=noprintf ;; @@ -2586,7 +3062,7 @@ esac ac_cv_var_nlist_noprintf=$ans]) case "$ac_cv_var_nlist_noprintf" in no) ;; - *) AC_DEFINE_UNQUOTED(K_NOPRINTF_NAME, "$ac_cv_var_nlist_noprintf") + *) AC_DEFINE_UNQUOTED(K_NOPRINTF_NAME, "$ac_cv_var_nlist_noprintf", [What is (probably) the name of NOPRINTF in the kernel?]) ;; esac @@ -2611,7 +3087,7 @@ AC_CACHE_CHECK(for a default value for 'tick', ac_cv_var_tick, [AC_ARG_ENABLE(tick, [ --enable-tick=VALUE s force a value for 'tick'], [ans=$enableval], [ans=no - case "$target" in + case "$host" in XXX-*-pc-cygwin*) ;; *-univel-sysv*) @@ -2623,9 +3099,15 @@ AC_CACHE_CHECK(for a default value for 'tick', ac_cv_var_tick, *-*-linux*) ans=txc.tick ;; + *-*-mpeix*) + ans=no + ;; *-*-winnt3.5) ans='(every / 10)' ;; + *-*-unicosmp*) + ans=10000 + ;; *) ans='1000000L/hz' ;; @@ -2633,14 +3115,14 @@ AC_CACHE_CHECK(for a default value for 'tick', ac_cv_var_tick, ac_cv_var_tick=$ans]) case "$ac_cv_var_tick" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) AC_DEFINE_UNQUOTED(PRESET_TICK, $ac_cv_var_tick) ;; + *) AC_DEFINE_UNQUOTED(PRESET_TICK, $ac_cv_var_tick, [Preset a value for 'tick'?]) ;; esac AC_CACHE_CHECK(for a default value for 'tickadj', ac_cv_var_tickadj, [AC_ARG_ENABLE(tickadj, [ --enable-tickadj=VALUE s force a value for 'tickadj'], [ans=$enableval], [ans='500/hz' - case "$target" in + case "$host" in *-fujitsu-uxp*) case "$ac_cv_var_adjtime_is_accurate" in yes) ans='tick/16' ;; @@ -2670,6 +3152,9 @@ AC_CACHE_CHECK(for a default value for 'tickadj', ac_cv_var_tickadj, *-*-irix*) ans=150 ;; + *-*-mpeix*) + ans=no + ;; *-*-sco3.2v5.0*) ans=10000L/hz ;; @@ -2683,23 +3168,26 @@ AC_CACHE_CHECK(for a default value for 'tickadj', ac_cv_var_tickadj, *-*-winnt3.5) ans=50 ;; + *-*-unicosmp*) + ans=150 + ;; esac]) ac_cv_var_tickadj=$ans]) case "$ac_cv_var_tickadj" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) AC_DEFINE_UNQUOTED(PRESET_TICKADJ, $ac_cv_var_tickadj) ;; + *) AC_DEFINE_UNQUOTED(PRESET_TICKADJ, $ac_cv_var_tickadj, [Preset a value for 'tickadj'?]) ;; esac # Newer versions of ReliantUNIX round adjtime() values down to # 1/100s (system tick). Sigh ... # 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*) AC_DEFINE(RELIANTUNIX_CLOCK) ;; +case "$host" in + mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX_CLOCK, 1, [Do we want the ReliantUNIX clock hacks?]) ;; esac -case "$target" in - *-*-sco3.2v5*) AC_DEFINE(SCO5_CLOCK) ;; +case "$host" in + *-*-sco3.2v5*) AC_DEFINE(SCO5_CLOCK, 1, [Do we want the SCO clock hacks?]) ;; esac ac_cv_make_tickadj=yes @@ -2732,33 +3220,9 @@ case "$ac_cv_var_can_kmem$ac_cv_var_tick$ac_cv_var_tickadj" in ;; esac -case "$target" in - mips-sni-sysv4*) - # tickadj is pretty useless on newer versions of ReliantUNIX - # Do not bother - 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 - yes) - MAKE_TICKADJ=tickadj - ;; -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 "$host" in *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in yesyes) ans=yes @@ -2776,11 +3240,76 @@ case "$ac_cv_make_ntptime" in ;; esac +AC_SUBST(MAKE_TICKADJ) +case "$host" 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 "$host" in + *-*-solaris2.1[[0-9]]*) + ac_cv_make_tickadj=no + ;; + *-*-solaris2.[[0-4]]*) ;; + *) ac_cv_make_tickadj=no ;; + esac + ;; + *-*-unicosmp*) + ac_cv_make_tickadj=no + ;; +esac +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 + yes) + MAKE_TICKADJ=tickadj + ;; +esac + +AC_SUBST(MAKE_TIMETRIM) +AC_CACHE_CHECK(if we want and can make the timetrim utility, ac_cv_make_timetrim, +[case "$host" in + *-*-irix*) + ac_cv_make_timetrim=yes + ;; + *-*-unicosmp*) + ac_cv_make_timetrim=yes + ;; + *) + ac_cv_make_timetrim=no + ;; +esac]) +case "$ac_cv_make_timetrim" in + yes) + MAKE_TIMETRIM=timetrim + ;; +esac + +AC_SUBST(MAKE_LIBNTPSIM) +AC_SUBST(MAKE_NTPDSIM) +AC_CACHE_CHECK([if we want to build the NTPD simulator], ac_cv_var_ntpd_sim, +[AC_ARG_ENABLE(simulator, + AC_HELP_STRING([--enable-simulator], [- build/install the NTPD simulator?]), + [ans=$enableval], [ans=no]) +ac_cv_var_ntpd_sim=$ans]) +case "$ac_cv_var_ntpd_sim" in + yes) + MAKE_NTPDSIM=ntpdsim + MAKE_LIBNTPSIM=libntpsim.a + ;; +esac + AC_CACHE_CHECK(if we want UDP wildcard delivery, ac_cv_var_udp_wildcard_delivery, [AC_ARG_ENABLE(udp-wildcard, [ --enable-udp-wildcard s use UDP wildcard delivery], [ans=$enableval], [ans=no - case "$target" in + case "$host" in *-fujitsu-uxp*) ans=yes ;; @@ -2790,7 +3319,7 @@ AC_CACHE_CHECK(if we want UDP wildcard delivery, ac_cv_var_udp_wildcard_delivery *-*-aix3.2*) ans=yes ;; - *-*-aix4*) + *-*-aix[[45]]*) ans=yes ;; *-*-bsdi*) @@ -2811,6 +3340,9 @@ AC_CACHE_CHECK(if we want UDP wildcard delivery, ac_cv_var_udp_wildcard_delivery *-*-linux*) ans=yes ;; + *-*-mpeix*) + ans=yes + ;; *-*-osf*) ans=yes ;; @@ -2823,16 +3355,19 @@ AC_CACHE_CHECK(if we want UDP wildcard delivery, ac_cv_var_udp_wildcard_delivery *-*-sunos4*) ans=yes ;; + *-*-unicosmp*) + ans=yes + ;; esac]) ac_cv_var_udp_wildcard_delivery=$ans]) case "$ac_cv_var_udp_wildcard_delivery" in - yes) AC_DEFINE(UDP_WILDCARD_DELIVERY) ;; + yes) AC_DEFINE(UDP_WILDCARD_DELIVERY, 1, [use UDP Wildcard Delivery?]) ;; esac -case "$host" in - $target) +case "$build" in + $host) ;; - *) case "$target" in + *) case "$host" in *-*-vxworks*) LDFLAGS="$LDFLAGS -r" ;; @@ -2843,7 +3378,7 @@ 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], - [case "$target" in + [case "$host" in *-apple-aux[[23]]*) ans=yes ;; @@ -2862,13 +3397,13 @@ AC_CACHE_CHECK(if we should always slew the time, ac_cv_var_slew_always, ]) ac_cv_var_slew_always=$ans]) case "$ac_cv_var_slew_always" in - yes) AC_DEFINE(SLEWALWAYS) ;; + yes) AC_DEFINE(SLEWALWAYS, 1, [Slew always?]) ;; 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], - [case "$target" in + [case "$host" in *-sni-sysv*) ans=yes ;; @@ -2878,6 +3413,9 @@ AC_CACHE_CHECK(if we should step and slew the time, ac_cv_var_step_slew, *-*-ptx*) ans=yes ;; + *-*-solaris2.1[[0-9]]*) + ans-no + ;; *-*-solaris2.[[012]]*) ans=yes ;; @@ -2890,13 +3428,13 @@ AC_CACHE_CHECK(if we should step and slew the time, ac_cv_var_step_slew, ]) ac_cv_var_step_slew=$ans]) case "$ac_cv_var_step_slew" in - yes) AC_DEFINE(STEP_SLEW) ;; + yes) AC_DEFINE(STEP_SLEW, 1, [Step, then slew the clock?]) ;; 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], - [case "$target" in + [case "$host" in *-apple-aux[[23]]*) ans=yes ;; @@ -2906,14 +3444,14 @@ AC_CACHE_CHECK(if ntpdate should step the time, ac_cv_var_ntpdate_step, ]) ac_cv_var_ntpdate_step=$ans]) case "$ac_cv_var_ntpdate_step" in - yes) AC_DEFINE(FORCE_NTPDATE_STEP) ;; + yes) AC_DEFINE(FORCE_NTPDATE_STEP, 1, [force ntpdate to step the clock if !defined(STEP_SLEW) ?]) ;; esac AC_CACHE_CHECK(if we should sync TODR clock every hour, ac_cv_var_sync_todr, [AC_ARG_ENABLE(hourly-todr-sync, [ --enable-hourly-todr-sync s if we should sync TODR hourly], [ans=$enableval], - [case "$target" in + [case "$host" in *-*-nextstep*) ans=yes ;; @@ -2925,29 +3463,48 @@ AC_CACHE_CHECK(if we should sync TODR clock every hour, ac_cv_var_sync_todr, esac]) ac_cv_var_sync_todr=$ans]) case "$ac_cv_var_sync_todr" in - yes) AC_DEFINE(DOSYNCTODR) ;; + yes) AC_DEFINE(DOSYNCTODR, 1, [synch TODR hourly?]) ;; 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], - [case "$target" in + [case "$host" in *-*-solaris2.6) - case "`uname -v`" in - Generic_105181-17) - ans=no + 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 - ;; - Generic_106541-08) - 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 ;; @@ -2959,13 +3516,134 @@ AC_CACHE_CHECK(if we should avoid kernel FLL bug, ac_cv_var_kernel_fll_bug, ]) ac_cv_var_kernel_fll_bug=$ans]) case "$ac_cv_var_kernel_fll_bug" in - yes) AC_DEFINE(KERNEL_FLL_BUG) ;; + yes) AC_DEFINE(KERNEL_FLL_BUG, 1, [Does the kernel have an FLL bug?]) ;; esac -case "$host" in - $target) +AC_CACHE_CHECK(if we should use the IRIG sawtooth filter, ac_cv_var_irig_sucks, +[AC_ARG_ENABLE(irig-sawtooth, + AC_HELP_STRING([--enable-irig-sawtooth], [s if we should enable the IRIG sawtooth filter]), + [ans=$enableval], + [case "$host" in + *-*-solaris2.[[89]]) + ans=yes + ;; + *-*-solaris2.1[[0-9]]*) + ans=yes + ;; + *) ans=no + ;; + esac + ]) +ac_cv_var_irig_sucks=$ans]) +case "$ac_cv_var_irig_sucks" in + yes) AC_DEFINE(IRIG_SUCKS, 1, [Should we use the IRIG sawtooth filter?]) ;; +esac + +AC_CACHE_CHECK(if we should enable NIST lockclock scheme, ac_cv_var_nist_lockclock, +[AC_ARG_ENABLE(nist, + AC_HELP_STRING([--enable-nist], [- if we should enable the NIST lockclock scheme]), + [ans=$enableval],[ans=no]) +ac_cv_var_nist_lockclock=$ans]) +case "$ac_cv_var_nist_lockclock" in + yes) AC_DEFINE(LOCKCLOCK, 1, [Should we align with the NIST lockclock scheme?]) ;; +esac + +# +# ISC stuff +# + +if test $ac_cv_struct_sockaddr_has_sa_len = yes; then + AC_DEFINE(ISC_PLATFORM_HAVESALEN, ,[ISC: struct sockaddr as sa_len?]) +fi + +AC_MSG_CHECKING(for IPv6 structures) +AC_TRY_COMPILE([ +#include +#include +#include ], +[struct sockaddr_in6 sin6; return (0);], + [AC_MSG_RESULT(yes) + found_ipv6=yes], + [AC_MSG_RESULT(no) + found_ipv6=no]) + +AC_MSG_CHECKING([for struct if_laddrconf]) +AC_TRY_LINK([ +#include +#include +],[ struct if_laddrconf a; ], + [AC_MSG_RESULT(yes) + AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRCONF, , + [ISC: have struct if_laddrconf?])], + [AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING([for struct if_laddrreq]) +AC_TRY_LINK([ +#include +#include +],[ struct if_laddrreq a; ], + [AC_MSG_RESULT(yes) + AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRREQ, , + [ISC: have struct if_laddrreq?])], + [AC_MSG_RESULT(no)]) + +case "$found_ipv6" in + yes) + AC_DEFINE(ISC_PLATFORM_HAVEIPV6, ,[ISC: Have IPv6?]) + AC_DEFINE(WANT_IPV6, ,[ISC: Want IPv6?]) + + AC_MSG_CHECKING(for in6_pktinfo) + AC_TRY_COMPILE([ +#include +#include +#include +$isc_netinetin6_hack +$isc_netinet6in6_hack +], + [struct in6_pktinfo xyzzy; return (0);], + [AC_MSG_RESULT(yes) + AC_DEFINE(ISC_PLATFORM_HAVEIN6PKTINFO, , + [ISC: Have struct in6_pktinfo?])], + [AC_MSG_RESULT(no -- disabling runtime ipv6 support)]) + + AC_MSG_CHECKING(for in6addr_any) + AC_TRY_LINK([ +#include +#include +#include +$isc_netinetin6_hack +$isc_netinet6in6_hack +$isc_in_addr6_hack +], + [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_DEFINE(ISC_PLATFORM_NEEDIN6ADDRANY, , + [ISC: Need in6addr_any?])] + ) ;; - *) case "$target" in +esac + +# +# Look for a sysctl call to get the list of network interfaces. +# +AC_MSG_CHECKING(for interface list sysctl) +AC_EGREP_CPP(found_rt_iflist, [ +#include +#include +#include +#ifdef NET_RT_IFLIST +found_rt_iflist +#endif +], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IFLIST_SYSCTL,1,[ISC: Use iflist_sysctl?])], + [AC_MSG_RESULT(no)]) + +case "$build" in + $host) + ;; + *) case "$host" in *-*-vxworks*) LDFLAGS="$LDFLAGS -r" ;; @@ -2973,17 +3651,57 @@ case "$host" in ;; esac -# 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_DEFINE_DIR(NTP_KEYSDIR, sysconfdir, [Default location of crypto key info]) + +AC_SUBST(ARLIB_DIR) +if test -d $srcdir/arlib +then + AC_ARG_WITH(arlib, + AC_HELP_STRING([--with-arlib], [- Compile the async resolver library?]), + [ans=$withval], [ans=no]) + + case "$ans" in + yes) + ARLIB_DIR=arlib + AC_CONFIG_SUBDIRS(arlib) + ;; + esac +fi + +AC_CONFIG_FILES(Makefile) +AC_CONFIG_FILES(ElectricFence/Makefile) +AC_CONFIG_FILES(adjtimed/Makefile) +AC_CONFIG_FILES(clockstuff/Makefile) +AC_CONFIG_FILES(include/Makefile) +AC_CONFIG_FILES(include/isc/Makefile) +AC_CONFIG_FILES(kernel/Makefile) +AC_CONFIG_FILES(kernel/sys/Makefile) +AC_CONFIG_FILES(libntp/Makefile) +AC_CONFIG_FILES(libparse/Makefile) +AC_CONFIG_FILES(ntpd/Makefile) +AC_CONFIG_FILES(ntpdate/Makefile) +AC_CONFIG_FILES(ntpdc/Makefile) +AC_CONFIG_FILES(ntpdc/nl.pl, [chmod +x ntpdc/nl.pl]) +AC_CONFIG_FILES(ntpq/Makefile) +AC_CONFIG_FILES(parseutil/Makefile) +AC_CONFIG_FILES(scripts/Makefile) +AC_CONFIG_FILES(scripts/calc_tickadj, [chmod +x scripts/calc_tickadj]) +AC_CONFIG_FILES(scripts/checktime, [chmod +x scripts/checktime]) +AC_CONFIG_FILES(scripts/freq_adj, [chmod +x scripts/freq_adj]) +AC_CONFIG_FILES(scripts/mkver, [chmod +x scripts/mkver]) +AC_CONFIG_FILES(scripts/ntp-wait, [chmod +x scripts/ntp-wait]) +AC_CONFIG_FILES(scripts/ntpsweep, [chmod +x scripts/ntpsweep]) +AC_CONFIG_FILES(scripts/ntptrace, [chmod +x scripts/ntptrace]) +AC_CONFIG_FILES(scripts/ntpver, [chmod +x scripts/ntpver]) +AC_CONFIG_FILES(scripts/plot_summary, [chmod +x scripts/plot_summary]) +AC_CONFIG_FILES(scripts/summary, [chmod +x scripts/summary]) +AC_CONFIG_FILES(util/Makefile) + +case "$MAKE_SNTP" in + '') ;; + *) + AC_CONFIG_SUBDIRS(sntp) + ;; +esac -AC_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/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/dist/ntp/html/Oncore-SHMEM.htm b/dist/ntp/html/Oncore-SHMEM.htm deleted file mode 100644 index 3148f6a9a7b9..000000000000 --- a/dist/ntp/html/Oncore-SHMEM.htm +++ /dev/null @@ -1,257 +0,0 @@ - - - ONCORE - SHMEM - - -

-Motorola ONCORE - The Shared Memory Interface -

-
- -

-Introduction -

- -

-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. -

-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. -

-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. -

-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. -

-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. -

-Activating the Interface -

-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 STATUS line in the /etc/ntp.oncore data file that looks like -
-        STATUS < file_name >
-
-Thus a line like -
-        STATUS /var/adm/ntpstats/ONCORE
-
-would be acceptable. -This file name will be used to access the Shared Memory. -

-In addition, one the two keywords Posn2D and Posn3D 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 -

-        STATUS /var/adm/ntpstats/ONCORE
-        Posn3D
-
-would be required. -

-Storage of Messages in Shared Memory -

-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. -

-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>. -

-The data starts at location ONE of SHMEM (NOT location ZERO). -

-The messages are stacked in a series of variable length structures, that look like -

-        struct message {
-                u_int   length;
-                u_char  sequence;
-                u_char  message[length];
-        }
-
-

-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. -

-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. -

-Following the last structure, is a u_int containing a zero length to indicate the end -of the data. -

-The messages are recognized by reading the headers in the data itself, viz @@Ea or whatever. -

-There are two special cases. -

-(1) The almanac takes a total of 34 submessages all starting with @@Cb.
-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. -

-(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. -

-When the SHMEM option is active, -and if one of Posn2D or Posn3D 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. -

-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. -

-Opening the Shared Memory File -

-The shared memory segment is accessed through a file name given on a ACCESS card in the -/etc/ntp.oncore input file. -The following code could be used to open the Shared Memory Segment: - -
-        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);
-        }
-
- -

-Accessing the data -

-The following code shows how to get to the individual records. - -
-        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 */
-        }
-
- -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. -

-Examples -

-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 - -ftp://ftp.udel.edu/pub/ntp/software/OncorePlot.tar.gz. -

-Try the new interface, enjoy. -


-
-Reg.Clemens (reg@dwf.com), -Poul-Henning Kamp (phk@FreeBSD.org) -
- - diff --git a/dist/ntp/html/accopt.htm b/dist/ntp/html/accopt.htm deleted file mode 100644 index 5d06ef292af3..000000000000 --- a/dist/ntp/html/accopt.htm +++ /dev/null @@ -1,144 +0,0 @@ - -Access Control Options -

-Access Control Options -


- -

Access Control Support

- -ntpd 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 Notes on Configuring -NTP and Setting up a NTP Subnet page. - -

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. - -

Access Control Commands

- -
- -
restrict numeric_address [mask numeric_mask] -[flag][...]
-
The numeric_address argument, expressed in dotted- -quad form, is the address of an host or network. The -mask argument, also expressed in dotted-quad form, -defaults to 255.255.255.255, meaning that the -numeric_address is treated as the address of an -individual host. A default entry (address 0.0.0.0, mask -0.0.0.0) is always included and, given the sort algorithm, is -always the first entry in the list. Note that, while -numeric_address is normally given in dotted-quad format, -the text string default, with no mask option, may be used to -indicate the default entry.
- -
In the current implementation, flag 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:
- -
- -
ignore
-
Ignore all packets from hosts which match this entry. If this flag -is specified neither queries nor time server polls will be responded -to.
- -
noquery
-
Ignore all NTP mode 6 and 7 packets (i.e. information queries and -configuration requests) from the source. Time service is not -affected.
-
nomodify
-
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.
- -
notrap
-
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.
- -
lowpriotrap
-
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.
- -
noserve
-
Ignore NTP packets whose mode is other than 6 or 7. In effect, time -service is denied, though queries may still be permitted.
- -
nopeer
-
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.
- -
notrust
-
Treat these hosts normally in other respects, but never use them as -synchronization sources.
- -
limited
-
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 client_limit hosts that -have shown up at the server and that have been active during the last -client_limit_period 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 ntpq and -ntpdc programs are not subject to these limits. A history of -clients is kept using the monitoring capability of ntpd. Thus, -monitoring is always active as long as there is a restriction entry with -the limited flag.
- -
ntpport
-
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 ntpport and non-ntpport may be -specified. The ntpport is considered more specific and is -sorted later in the list.
- -
- -
Default restriction list entries, with the flags ignore, -ntpport, 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).
- -
clientlimit limit
-
Set the client_limit variable, which limits the number of -simultaneous access-controlled clients. The default value for this -variable is 3.
- -
clientperiod period
-
Set the client_limit_period 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.
- -
- -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/assoc.htm b/dist/ntp/html/assoc.htm deleted file mode 100644 index 69cb7bc5b1f2..000000000000 --- a/dist/ntp/html/assoc.htm +++ /dev/null @@ -1,170 +0,0 @@ - - - - - Release Notes - - - - -

-Association Management

- -
-

-Association Modes

-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.. - -

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. - -

The one exception to (a) and (b) above is when -autokey 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. - -

Following is a summary of the protocol operations for each mode. - -

Peer Modes (Active and Passive) -

    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.
-Client/Server Modes -
    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.
-Broadcast/Multicast Modes -
    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.
-Manycast Mode -
    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.
- -

-Burst Mode

-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. -

-Revised Error Checking

-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. -
    -
  1. -Duplicate packet. This message is a duplicate of one previously received.
  2. - -
      -
  3. -Bogus packet. This message did not result from a message previously sent, -or messages have been received out of order.
  4. - -
      -
  5. -Unsynchronized. The server has not yet stored the previous timestamps.
  6. - -
      -
  7. -Invalid delay or dispersion. Either the delay or dispersion or both computed -from the message timestamps are above the normal range.
  8. - -
      -
  9. -Authentication failed. The sent MAC does not match the received MAC, either -due to the wrong key material or damaged message.
  10. - -
      -
  11. -Server unsynchronized. The server indicates unsynchronized in the leap -bits included in the packet.
  12. - -
      -
  13. -Server stratum check. The server is operating at a stratum above the normal -range.
  14. - -
      -
  15. -Delay/dispersion check. The related server packet data values are above -the normal range.
  16. - -
      -
  17. -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.)
  18. - -
      -
  19. -Access denied. The sender has been blocked by the access control list.
  20. - -
      -
  21. -Key not found. The key identifier does not match any identifier in the -key list or the key has expired or been revoked.
  22. -
-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. -
-
-
-David L. Mills (mills@udel.edu)
- -
  - - diff --git a/dist/ntp/html/audio.htm b/dist/ntp/html/audio.htm deleted file mode 100644 index 655ccbba585b..000000000000 --- a/dist/ntp/html/audio.htm +++ /dev/null @@ -1,153 +0,0 @@ - -Reference Clock Audio Drivers -

-Reference Clock Audio Drivers -


- -

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 -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. - -

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. - -

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. - -

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 ntpq program. - -

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. - -

The drivers include provisions to select the input port and to -monitor the input signal. The fudge flag 2 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 -fudge flag 3 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 ntpdc -utility program. - -

Shortwave Radio Drivers

- -

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. - -

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. - -

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. - -

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. - -

Shortwave (3-30 MHz) radio propagation phenomena are well known to -shortwave enthusiasts. The phenomena generally obey the following rules: - -

    - -

  • The optimum frequency is higher in daytime than nighttime, stays -high longer on summer days and low longer on winter nights. - -

  • Transitions between daytime and nightime conditions generally -occur somewhat after sunrise and sunset at the midpoint of the path from -transmitter to receiver. - -

  • Ambient noise (static) on the lower frequencies follows the -thunderstorm season, so is higher on summer afternoons and evenings. - -

  • The lower frequency bands are best for shorter distances, while -the higher bands are best for longer distances. - -

  • 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. - -
- -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. - -

Debugging Aids

- -

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 clockstats file for -later analysis. Of particular help in verifying signal connections and -compatibility is a provision to monitor the signal via headphones or -speaker. - - -

The drivers write a synthesized timecode to the clockstats -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. - -

Additional Information

- -Reference Clock Drivers -
Radio CHU Audio Demodulator/Decoder -
Radio WWV/H Audio Demodulator/Decoder -
IRIG Audio Decoder - -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/authopt.htm b/dist/ntp/html/authopt.htm deleted file mode 100644 index 3e56b08f4ca7..000000000000 --- a/dist/ntp/html/authopt.htm +++ /dev/null @@ -1,278 +0,0 @@ - -Authentication Options -

-Authentication Options -


- -

Authentication Support

- -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 the NTPv3 schemes and, in addition, provides a new -autokey scheme based on reverse hashing and public key -cryptography. Authentication can be configured separately for each -association using the key or autokey subcommands on -the peer, server, broadcast and -manycastclient commands as described in the Configuration Options page. - -

The authentication options specify the suite of keys, select the key -for each configured association and manage the configuration operations, -as described below. The auth flag which controls these -functions can be set or reset by the enable and -disable configuration commands and also by remote configuration -commands sent by a ntpdc 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 timekeeping. - -

The auth flag affects all authentication procedures -described below; however, it operates differently if cryptographic -support (AUTOKEY) is compiled in the distribution, which is -normally the case. If this support is available and the flag is enabled, -then persistent associations are mobilized in multicast client and -symmetric passive modes 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 auth flag normally defaults to set if -cryptographic support is available and to reset otherwise. - -

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 auth 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. - -

Private Key Scheme

- -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 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 ntp.keys, 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 ntpq and ntpdc -utility programs. - -

When ntpd 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 trusted command. This allows, -for instance, the installation of possibly several batches of keys and -then activating or deactivating each batch remotely using -ntpdc. This also provides a revocation capability that can be -used if a key becomes compromised. The requestkey command -selects the key used as the password for the ntpdc utility, -while the controlkey command selects the key used as the -password for the ntpq utility. - -

Autokey Schemes

- -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 rsaref20 package -must be installed as described in the README.rsa file. Once -installed, the configure and build process automatically detects it and -compiles the routines required. - -The scheme has several modes of operation corresponding to the various -NTP modes supported. RSA signatures and 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. Multicast and -symmetric 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 Autonomous -Authentication page. - -

The cryptographic values used by the autokey scheme are -incorporated as a set of files generated by the ntp_genkeys program, including the DES/MD5 -private keys, RSA public/private key pair, and the Diffie-Hellman -parameters. See the ntp_genkeys page for a description of the -format and use of these files. They contain cryptographic values -generated by the algorithms of the rsaref20 package and are in -printable ASCII format. Since the algorithms are seeded by the system -clock, each run of this program will produce a different outcome. - -

The ntp.keys file contains the private DES/MD5 keys. It must -be distributed by secure means to other servers and clients sharing the -same security compartment and made visible only to root. The -ntpkey 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. The -ntp_dh file contains the Diffie-Hellman parameters. It is -necessary that all servers and clients of a security compartment share a -single ntp_dh file, but it does not matter which one. This file -can be distributed using insecure means, since the data are public -values. - -

The ntpkey_host file contains the RSA public key, -where host is the name of the host. Each configured -server or peer association requires the public key -file associated with the particular server or peer to be installed at a -default location or as specified by the commands below. In addition, -public key files are required for associations that might be mobilized -by multicast or symmetric servers. These files can be widely distributed -and stored using insecure means, since the data are public values. - -

Due to the widespread use of interface-specific naming, the host -names used in configured and mobilized associations are determined by -different rules. The ntp_genkeys program uses the name returned -by the Unix gethostname() library routine and this is the name -normally used when installing the file on some other host. However, the -default name used when configuring an association at run time is the -canonical name returned by the DNS resolver, and this might not be the -same name. The preferred workaround on the host installing the file is -to use the Unix nslookup command to determined the canonical -name and install a link from that name to the actual name. -Alternatively, the default can be overriden with by the -publickey subcommand of the server or peer -configuration command. - -

For other than configured associations that might be mobilized by -multicast servers or symmetric peers, the name is determined directly -from the server or peer as part of the protocol dance that authenticates -the source. The server or peer uses the same gethostname() -library routine as the ntp_genkeys program, so there is no -confusion. - -

All key files are installed by default in /usr/local/etc, -which is normally in a shared filesystem in NFS-mounted networks and -avoids installing them in each machine separately. The default can be -overriden by the keysdir configuration file 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 -/etc, which is normally not in a shared filesystem. The default -can be overriden by the subcommand of the crypto -configuration command. - -

Authentication Commands

- -
- -
autokey [logsec] -
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.
- -
controlkey key
-
Specifies the key identifier to use with the ntpq program, -which uses the standard protocol defined in RFC-1305. This program is -useful to diagnose and repair problems that affect ntpd -operation. The key argument to this command is a key -identifier for a trusted key, where the value can be in the range 1 to -65534, inclusive.
- -
crypto [privatekey file] [publickey file] [dhparms -file]
-
This command requires the NTP daemon build process be configured -with the RSA library. The presence of this command causes the daemon to -load the host RSA private key file, public key file and Diffie-Hellman -parameter file. If one or more files are left unspecified, the default -names are used as described above. Following are the subcommands:
- -
- -
privatekey file -
Specifies the directory for the RSA private key file, which -otherwise defaults to /usr/local/etc.
- -
publickey file -
Specifies the directory for the RSA public key file, which otherwise -defaults to /usr/local/etc.
- -
dhparms file -
Specifies the directory for the Diffie-Hellman parameters file, -which otherwise defaults to /usr/local/etc.
- -
- -
keys keyfile
-
Specifies the file name containing the private encryption keys and -key identifiers used by ntpd, ntpq and ntpdc -when operating in authenticated mode.
- -
keysdir path
-
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, parameters file and one or more public key files. The -default when this command does not appear in the configuration file is -/usr/local/etc/.
- -
requestkey key
-
Specifies the key identifier to use with the ntpdc utility -program, which uses a proprietary protocol specific to this -implementation of ntpd. This program is useful to diagnose and -repair problems that affect ntpd operation. The -key argument to this command is a key identifier for a -trusted key, where the value can be in the range 1 to 65534, inclusive. -
- -
revoke [logsec] -
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.
- -
trustedkey key [...]
-
Specifies the encryption key identifiers which are trusted for the -purposes of authenticating peers suitable for synchronization, as well -as keys used by the ntpq and ntpdc 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 -key arguments are 32-bit unsigned integers with values -from 1 to 65,534.
- -
- -

Files

-ntp.keys private MD5 keys -
ntpkey RSA private key -
ntpkey_host RSA public key -
ntp_dh Diffie-Hellman parameters - -

Bugs

- -The ntpkey_host files are really digital certificates. -These should be obtained via secure directory services when they become -universally available. - -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/biblio.htm b/dist/ntp/html/biblio.htm deleted file mode 100644 index f8877d41163c..000000000000 --- a/dist/ntp/html/biblio.htm +++ /dev/null @@ -1,253 +0,0 @@ - -Protocol Conformance Statement -

-Protocol Conformance Statement -

- -

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. 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 Executive Summary - Computer Network Time -Synchronization page, while issues related to the NTP timescale and -pending century are discussed in the Network Time -Protocol Year 2000 Conformance Statement page, both of which are -included in this document. - -

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 David L. -Mills web page. - -

The NTP architecture, protocol and algorithm models are described in - -

    - -
  • Mills, D.L. Internet time synchronization: the Network Time -Protocol. IEEE Trans. Communications COM-39, 10 (October 1991), -1482-1493. -PostScript | -PDF. Also in: Yang, Z., and T.A. Marsland (Eds.). Global States -and Time in Distributed Systems. IEEE Computer Society Press, Los -Alamitos, CA, 1994, 91-102. -
- -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 -

    - -
  • 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: -PostScript) | -PDF, Body: -PostScript) | -PDF, Appendices: -PostScript | -PDF. - -
- -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: - -
    - -

  1. Support for precision-time kernel modifications, as described -in
  2. - -

    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: -PostScript | -PDF, Body: -PostScript | -PDF. Major revision and update of: Network Working Group Report -RFC-1589, University of Delaware, March 1994. 31 pp. ASCII - -

  3. Support for IP Multicasting, as described in
  4. - -

    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: -PostScript | -PDF, Body: -PostScript | -PDF - -

  5. A new hybrid phase/frequency-lock clock discipline, which -replaces the RFC-1305 local clock algorithm, as described in
  6. - - -

    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: -PostScript | -PDF, Body: -PostScript | -PDF - -

    Mills, D.L. Improved algorithms for synchronizing computer network -clocks. IEEE/ACM Trans. Networks 3, 3 (June 1995), 245-254. -PostScript | -PDF - -

  7. Engineered refinements to radio clock drivers and interface code, -as describedin:
  8. - -

    Mills, D.L. Precision synchronization of computer network clocks. -ACM Computer Communication Review 24, 2 (April 1994). 28-43. -PostScript | -PDF - -

  9. 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 Reference -Clock Drivers page.
  10. - -

  11. A new security model and authentication scheme based on public- -key cryptography called autokey, as described in
  12. - -

    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. ASCII - -

    Mills, D.L. Authentication scheme for distributed, ubiquitous, real- -time protocols. Proc. Advanced Telecommunications/Information -Distribution Research Program (ATIRP) Conference (College Park MD, -January 1997), 293-298. -PostScript | -PDF - -

    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: -PostScript | -PDF, Body: -PostScript | -PDF - -

  13. Support for the MD5 cryptographic hash algorithm, in addition to -the DES-CBC algorithm described in RFC-1305, as described in the ntpd - Network Time Protocol (NTP) daemon -page.
  14. - -

  15. The prefer-peer scheme, as described in the Mitigation Rules and the prefer Keyword -page.
  16. - -

  17. Specification for the Simple Network Time Protocol (SNTP), as -described in
  18. - -

    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. -ASCII. Obsoletes RFC-1769 and RFC-1361. - -

  19. Performance surveys for NTP Version 4 can be found in
  20. - -

  21. Mills, D.L., A. Thyagarajan and B.C. Huffman. Internet -timekeeping around the globe. Proc. Precision Time and Time Interval -(PTTI) Applications and Planning Meeting (Long Beach CA, December -1997), 365-371. Paper: -PostScript | -PDF, Slides: -HTML | -PostScript | -PowerPoint | -PDF
  22. - -

  23. Mills, D.L. The network computer as precision timekeeper. -Proc. Precision Time and Time Interval (PTTI) Applications and -Planning Meeting (Reston VA, December 1996), 96-108. Paper: -PostScript | -PDF, Slides: -HTML | -PostScript | -PowerPoint | -PDF
  24. - -
- -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/build.htm b/dist/ntp/html/build.htm deleted file mode 100644 index e7aa4004509b..000000000000 --- a/dist/ntp/html/build.htm +++ /dev/null @@ -1,180 +0,0 @@ - -Building and Installing the Distribution -

-Building and Installing the Distribution -

- -

Building and Installing the Distribution

- -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. - -

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. - -

The NTP authentication routines conform to the interface used by RSA -Laboratories in the rsaref20.zip package, which is downloadable -from ftp.rsa.com or via the web at www.rsa.com. -Outside the U.S. and Canada, the functionally identical -rsaeuro.zip 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 desc.c -file from the ./source directory in the package to the -./libntp directory in the distribution. Then copy the header -files rsaref.h, des.h and md2.h in the -./source directory to the ./include directory. Do not -copy the global.h header file; the one in the distribution has -been modified. These steps must be completed before the configuration -process described below. - -

Building and Installing under Unix

- -Make sure that you have all necessary tools for building executables. -These tools include cc/gcc, make, awk, sed, tr, sh, grep, egrep -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 gcc -compiler in this case). For a successful build, all of these tools -should be accessible via the current path. - -

Configuration

- -Use the ./configure 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 -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 Configuration -Options page. - -

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 mkdir A.`config.guess`, 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 ../configure command. The remaining steps are the same -whether building in the base directory or in the subdirectory. - -

Compilation

- -Peruse the operating-system-specific information for your architecture -under Hints and Kinks. - -

Use the make command to compile all source modules, -construct the libraries and link the distribution. Expect few or no -warnings using cc and a moderate level of warnings using -gcc. Note: On some Unix platforms the use of gcc 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 -gcc-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. - -

Installation

- -As root, use the make install 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 ntpd (the daemon), ntpdc (an ntpd-dependent query -program), ntpq (a standard query -program), ntpdate (an rdate -replacement for boot time date setting and sloppy time keeping) and -ntptrace (a utility useful to find -the primary (stratum-1) servers). In some systems, the tickadj (a utility useful to adjust kernel -variables) is installed. If the precision time kernel modifications are -present, the ntptime (a utility -useful to debug kernel time functions) is installed. - -

You are now ready to configure the daemon and start it. You will need -to create a NTP configuration file ntp.conf and possibly a -cryptographic key file ntp.keys. Directions for doing that are -in the Notes on Configuring NTP and Setting up a NTP -Subnet. The behavior when the daemon starts for the first time can -be counterintuitive. To reduce the level of angst, see the Quick Start page. A tutorial on debugging technique -is in NTP Debugging Technique. - -

If problems peculiar to the particular hardware and software -environment (e.g. operating system -specific issues) are suspected, -browse the Hints and Kinks page. - -

Bug reports of a general nature can be sent to David Mills <mills@udel.edu>. Bug reports of a -specific nature on features implemented by the programmer corps -mentioned in the Copyright page should be -sent directly to the implementor listed in that page, with copy to -mills@udel.edu. - -

Please include the version of the source distribution (e.g., ntp- -4.0.70a) in your bug report. - -

Please include the output of config.guess in your -bug report. - -

It will look something like: pdp11-dec-fuzzos3.4 - -

Additional make commands - -

- -
make clean
- -
Cleans out object files, programs and temporary files.
- -
make distclean
- -
Does the work of clean, but cleans out all directories in -preparation for a new distribution release.
- -
make dist
- -
-Does the work of make distclean, but constructs compressed tar -files for distribution. You must have GNU automake to perform this -function.
- -
- -

Building and Installing under Windows NT

-See hints/winnt.htm for directions -to compile the sources and install the executables. - -
Home
David L. -Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/clockopt.htm b/dist/ntp/html/clockopt.htm deleted file mode 100644 index ac06e1916642..000000000000 --- a/dist/ntp/html/clockopt.htm +++ /dev/null @@ -1,193 +0,0 @@ - -Reference Clock Options -

-Reference Clock Options -


- -

Reference Clock Support

- -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 Reference Clock Drivers page. Additional -information can be found in the pages referenced there, including the Debugging Hints for Reference Clock Drivers and How To Write a Reference Clock Driver pages. In -many drivers, support for a PPS signal is available as described in Pulse-per-second (PPS) Signal Interfacing page. Many -drivers support special line discipline/streams modules which can -significantly improve the accuracy using the driver. These are described -in the Line Disciplines and Streams Drivers -page. - -

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. - -

For the purposes of configuration, ntpd 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 127.127.t.u, -where t is an integer denoting the clock type and -u 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. - -

The server command is used to configure a reference clock, -where the address argument in that command is the clock -address. The key, version and ttl options are -not used for reference clock support. The mode option is added -for reference clock support, as described below. The prefer -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 Mitigation Rules and the prefer Keyword -page. The minpoll and maxpoll options have meaning -only for selected clock drivers. See the individual clock driver -document pages for additional information. - -

The stratum number of a reference clock is by default zero. Since the -ntpd 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 stratum 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 -refid option is used for this purpose. Except where noted, -these options apply to all clock drivers. - -

Reference Clock Commands

- -
server 127.127.t.u [prefer] [mode int] -[minpoll int] [maxpoll int]
-
This command can be used to configure reference clocks in special -ways. The options are interpreted as follows:
- -
prefer
-
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 Mitigation Rules -and the prefer Keyword page for further information.
- -
mode int
-
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 parse drivers.
- -
minpoll int
-
maxpoll int
-
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 minpoll and -maxpoll default to 6 (64 s). For modem reference clocks, -minpoll defaults to 10 (17.1 m) and maxpoll defaults -to 14 (4.5 h). The allowable range is 4 (16 s) to 17 (36.4 h) -inclusive.
- -
- -
fudge 127.127.t.u [time1 sec] [time2 sec] -[stratum int] [refid string] [mode int] [flag1 0|1] -[flag2 0|1] [flag3 0|1] [flag4 0|1]
-
This command can be used to configure reference clocks in special -ways. It must immediately follow the server command which -configures the driver. Note that the same capability is possible at run -time using the ntpdc program. The -options are interpreted as follows:
- -
- -
time1 sec
-
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.
- -
time2 secs
-
Specifies a fixed-point decimal number in seconds, which is -interpreted in a driver-dependent way. See the descriptions of specific -drivers in the reference clock drivers -page.
- -
stratum int
-
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.
- -
refid string
-
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.
- -
mode int
-
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 parse drivers.
- -
flag1 flag2 flag3 flag4
-
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 -flag4 is used to enable recording monitoring data to the -clockstats file configured with the filegen command. -When a PPS signal is available, a special automatic calibration facility -is provided. If the flag1 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 filegen command can be found in the Monitoring Options page.
- -
- -
pps device [assert|clear] [hardpps]
-
Specifies the name and options for the serial port device to which -the PPS signal is connected. Note, this command replaces use of -fudge flag3, which was used for the same purpose in NTPv3. Note -that this command should preceed the server and fudge -command for the same device. Note also that the assert, -clear and hardpps options are only available if the -ppsapi standard PPS interface is available.
- -
- -
device
-
Specify the device name associated with the PPS signal. The name -must match exactly the link name specified in the driver documentation -page.
- -
assert
-
clear
-
Using assert or clear specifies if the high going -or low going edge of the signal must be used. The default is -assert.
- -
hardpps
-
This flag is used to tell the kernel that the signal from this -device must be used to drive hardpps().
- -
The assert, clear and hardpps options -are only available if the PPSAPI is used.
- -
- -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/config.htm b/dist/ntp/html/config.htm deleted file mode 100644 index aadd96da25b8..000000000000 --- a/dist/ntp/html/config.htm +++ /dev/null @@ -1,288 +0,0 @@ - -Configuration Options -

-Configuration Options -

- -

Basic Configuration Options - the configure utility

- -The following options are for compiling and installing a working version -of the NTP distribution. In most cases, the build process is completely -automatic. In some cases where memory space is at a premium, or the -binaries are to be installed in a different place, it is possible to -tailor the configuration to remove such features as reference clock -driver support, debugging support, and so forth. - -

Configuration options are specified as arguments to the -configure script. Following is a summary of the current -options: - -

Usage: configure [options] [host] -
Options: [defaults in brackets after descriptions] -

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
-            
-            
-configure
-Directory and file names
-
-  --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
-            
-            
-[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
-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]
- -
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
-            
-            
-[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
- -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/confopt.htm b/dist/ntp/html/confopt.htm deleted file mode 100644 index 30fc836c3ab0..000000000000 --- a/dist/ntp/html/confopt.htm +++ /dev/null @@ -1,215 +0,0 @@ - -Configuration Options -

-Configuration Options -


- -

Configuration Support

- -

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 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. - -

Configuration Commands

- -

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 some options are not -supported by all these commands while autokey and burst modes are -supported by these commands, -their effect in some weird mode combinations can be meaningless -or even destructive. - -

- -
peer address [key key | autokey | publickey -keyfile] [burst] [version version] [prefer] [minpoll -minpoll] [maxpoll maxpoll]
- -

server address [key key | autokey | publickey -keyfile] [burst] [version version] [prefer] [minpoll -minpoll] [maxpoll maxpoll] [publickey -keyfile]
- -

broadcast address [key key | autokey] [burst] -[version version] [minpoll minpoll] [maxpoll -maxpoll] [ttl ttl]
- -

manycastclient address [key key | autokey | -publickey keyfile] [burst] [version version] [minpoll -minpoll [maxpoll maxpoll] [ttl ttl] [publickey -file]
- -

<

These four commands specify the time server name or address to -be used and the mode in which to operate. The address can be -either a DNS name or a IP address in dotted-quad notation. Additional -information on association behavior can be found in the Association Management page.
- -
- -
server
-
For type s and r addresses, this operates as the NTPv3 server -command, which mobilizes a persistent client mode association. The -server 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.
- -
peer
-
For type s addresses (only), this operates as the current peer -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.
- -

The peer 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.
- -
broadcast
-
For type b and m addresses (only), this operates -as the current NTPv3 broadcast 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.
- -

In broadcast mode, the local server sends periodic broadcast -messages to a client population at the addressspecified, -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 broadcastclient or multicastclient -commands below.
- -
manycastclient -
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 manycastserver 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.
- -

The manycast 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 -address and specifically enabled servers respond to -these messages. The client selects the servers providing the best time -and continues as with the server command. The remaining servers -are discarded as if never heard.
- -
- -
Options
- -
- -
autokey
-
All packets sent to and received from the server or peer are to -include authentication fields encrypted using the autokey scheme -described in the Authentication Options -page.
-
burst
-
At each poll interval, send a burst of eight packets spaced, instead -of the usual one.
- -
key key
-
All packets sent to and received from the server or peer are to -include authentication fields encrypted using the specified key -identifier with values from 1 to 65534, inclusive. The default is to -include no encryption field.
- -
minpoll minpoll -
maxpoll maxpoll -
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.
- -
prefer
-
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 Mitigation Rules and the -prefer Keyword page for further information.
- -
publickey file
-
This command requires the NTP daemon build process be configured -with the RSA library. The command specifies the name of the public key -file for the server or peer. The default name for this file is -ntpkey_host, where host is the DNS canonical name -of the server or peer. See the Authentication -Options page for further information.
- -
ttl ttl
-
This option is used only with broadcast mode. It specifies the -time-to-live ttl 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.
- -
version version
-
Specifies the version number to be used for outgoing NTP packets. -Versions 1-4 are the choices, with version 4 the default.
- -
- -

Auxilliary Commands

- -
- -
broadcastclient -
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.
- -
manycastserver address [...] -
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.
-
multicastclient [address] [...] -
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 broadcastclient -command, but uses IP multicasting. Support for this command requires -multicast kernel support.
- -
- -

Bugs

- -

The syntax checking is not picky; some combinations of ridiculous and -even hilarious options and modes may not be detected. - -


Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/copyright.htm b/dist/ntp/html/copyright.htm deleted file mode 100644 index dbd6289501f9..000000000000 --- a/dist/ntp/html/copyright.htm +++ /dev/null @@ -1,209 +0,0 @@ - -Copyright Notice - - - -

Copyright Notice

- -

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.                                                           *
- *                                                                     *
- ***********************************************************************
- */
-
- -The following individuals contributed in part to the Network Time -Protocol Distribution Version 4 and are acknowledged as authors of this -work. - -
    - -
  1. Mark Andrews -<marka@syd.dms.csiro.au> Leitch atomic clock controller
  2. - -
  3. Viraj Bais -<vbais@mailman1.intel.com> and Clayton Kirkwood -<kirkwood@striderfm.intel.com> port to WindowsNT 3.5
  4. - -
  5. Michael Barone -<michael,barone@lmco.com> GPSVME fixes
  6. - -
  7. Karl Berry -<karl@owl.HQ.ileaf.com> syslog to file option
  8. - -
  9. Greg Brackley -<greg.brackley@bigfoot.com> Major rework of WINNT port. Clean -up recvbuf and iosignal code into separate modules.
  10. - -
  11. Marc Brett -<Marc.Brett@westgeo.com> Magnavox GPS clock driver
  12. - -
  13. Piete Brooks -<Piete.Brooks@cl.cam.ac.uk> MSF clock driver, Trimble PARSE -support
  14. - -
  15. Steve Clift -<clift@ml.csiro.au> OMEGA clock driver
  16. - -
  17. Casey Crellin -<casey@csc.co.za> vxWorks (Tornado) port and help with target -configuration
  18. - -
  19. Sven Dietrich -<sven_dietrich@trimble.com> Palisade reference clock driver, -NT adj. residuals, integrated Greg's Winnt port.
  20. - -
  21. John A. Dundas III -<dundas@salt.jpl.nasa.gov> Apple A/UX port
  22. - -
  23. Torsten Duwe -<duwe@immd4.informatik.uni-erlangen.de> Linux port
  24. - -
  25. Dennis Ferguson -<dennis@mrbill.canet.ca> foundation code for NTP Version 2 as -specified in RFC-1119
  26. - -
  27. Glenn Hollinger -<glenn@herald.usask.ca> GOES clock driver
  28. - -
  29. Mike Iglesias -<iglesias@uci.edu> DEC Alpha port
  30. - -
  31. Jim Jagielski -<jim@jagubox.gsfc.nasa.gov> A/UX port
  32. - -
  33. Jeff Johnson -<jbj@chatham.usdesign.com> massive prototyping overhaul
  34. - -
  35. William L. Jones -<jones@hermes.chpc.utexas.edu> RS/6000 AIX modifications, HPUX -modifications
  36. - -
  37. Hans Lambermont -<Hans.Lambermont@nl.origin-it.com> or <H.Lambermont@chello.nl> -ntpsweep
  38. - -
  39. Frank -Kardel -<Frank.Kardel@informatik.uni-erlangen.de> PARSE -<GENERIC> driver (14 reference clocks), STREAMS modules for PARSE, -support scripts, syslog cleanup
  40. - -
  41. Dave Katz -<dkatz@cisco.com> RS/6000 AIX port
  42. - -
  43. Craig Leres -<leres@ee.lbl.gov> 4.4BSD port, ppsclock, Magnavox GPS clock -driver
  44. - -
  45. George Lindholm -<lindholm@ucs.ubc.ca> SunOS 5.1 port
  46. - -
  47. Louis A. Mamakos -<louie@ni.umd.edu> MD5-based authentication
  48. - -
  49. Lars H. Mathiesen -<thorinn@diku.dk> adaptation of foundation code for Version 3 -as specified in RFC-1305
  50. - -
  51. 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
  52. - -
  53. Wolfgang Moeller -<moeller@gwdgv1.dnet.gwdg.de> VMS port
  54. - -
  55. Jeffrey Mogul -<mogul@pa.dec.com> ntptrace utility
  56. - -
  57. Tom Moore -<tmoore@fievel.daytonoh.ncr.com> i386 svr4 port
  58. - -
  59. Kamal A Mostafa -<kamal@whence.com> SCO OpenServer port
  60. - -
  61. Derek Mulcahy -<derek@toybox.demon.co.uk> and Damon Hart-Davis <d@hd.org> ARCRON MSF clock -driver
  62. - -
  63. Rainer Pruy -<Rainer.Pruy@informatik.uni-erlangen.de> monitoring/trap -scripts, statistics file handling
  64. - -
  65. Dirce Richards -<dirce@zk3.dec.com> Digital UNIX V4.0 port
  66. - -
  67. Wilfredo Sánchez -<wsanchez@apple.com> added support for NetInfo
  68. - -
  69. Nick Sayer -<mrapple@quack.kfu.com> SunOS streams modules
  70. - -
  71. Jack Sasportas -<jack@innovativeinternet.com> Saved a Lot of space on the -stuff in the html/pic/ subdirectory
  72. - -
  73. Ray Schnitzler -<schnitz@unipress.com> Unixware1 port
  74. - -
  75. Michael Shields -<shields@tembel.org> USNO clock driver
  76. - -
  77. Jeff Steinman -<jss@pebbles.jpl.nasa.gov> Datum PTS clock driver
  78. - -
  79. Harlan Stenn -<harlan@pfcs.com> GNU automake/autoconfigure makeover, various -other bits (see the ChangeLog)
  80. - -
  81. Kenneth Stone -<ken@sdd.hp.com> HP-UX port
  82. - -
  83. Ajit Thyagarajan -<ajit@ee.udel.edu>IP multicast/anycast support
  84. - -
  85. Tomoaki TSURUOKA -<tsuruoka@nc.fukuoka-u.ac.jp>TRAK clock driver
  86. - -
  87. Paul A Vixie -<vixie@vix.com> TrueTime GPS driver, generic TrueTime clock -driver
  88. - -
  89. Ulrich Windl -<Ulrich.Windl@rz.uni-regensburg.de> corrected and validated -HTML documents according to the HTML DTD
  90. - -
- -
-Home -
-David L. Mills <mills@udel.edu> -
- - diff --git a/dist/ntp/html/debug.htm b/dist/ntp/html/debug.htm deleted file mode 100644 index 40c7b044d893..000000000000 --- a/dist/ntp/html/debug.htm +++ /dev/null @@ -1,284 +0,0 @@ - -NTP Debugging Techniques -

-NTP Debugging Techniques -

- -

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 -ntpd page are required. Once started, -the daemon will begin sending messages, as specified in the -configuration file, and interpreting received messages. - -

The best way to verify correct operation is using the ntpq and ntpdc -utility programs, either on the server itself or from another machine -elsewhere in the network. The ntpq program implements the -management functions specified in Appendix A of the NTP specification -RFC-1305, Appendix A. The ntpdc 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 ntpdc, additional ones of interest. In addition, -the ntpdc program can be used to selectively enable and disable -some functions of the daemon while the daemon is running. - -

In extreme cases with elusive bugs, the daemon can operate in two -modes, depending on the presence of the -d command-line debug -switch. If not present, the daemon detaches from the controlling -terminal and proceeds autonomously. If one or more -d 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 -d 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 grep -and specifying the keyword of the trace you want to see. - -

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 /etc/services 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 ping command. - -

When first started, the daemon normally polls the servers listed in -the configuration file at 64-second 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 ntpdate program or -manually be eyeball and wristwatch. - -

After starting the daemon, run the ntpq program using the --n switch, which will avoid possible distractions due to name -resolution problems. Use the pe 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: - -

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
-
- -The host addresses shown in the remote 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 refid -entry shows the current source of synchronization for each peer, while -the st reveals the stratum, t the type (u = -unicast, m = multicast, l = local, - = don't -know), and poll the polling interval in seconds. The -when entry shows the time since the peer was last heard, -normally in seconds, while the reach 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. - -

The tattletale character at the left margin displays the -synchronization status of each peer. The currently selected peer is -marked *, while additional peers designated acceptable for -synchronization, but not currently selected, are marked +. -Peers marked * and + 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 ntpq -documentation for the meaning of these symbols. - -

Additional details for each peer separately can be determined by the -following procedure. First, use the as command to display an -index of association identifiers, such as - -

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
- 
- -Each line in this billboard is associated with the corresponding line -the pe billboard above. Next, use the rv command and -the respective identifier to display a detailed synopsis of the selected -peer, such as - -
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
-
- -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. - -

Finally, the state of the local clock can be determined using the -rv command (without the argument), such as - -

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
-
- -The most useful data in this billboard show when the clock was last -adjusted reftime, together with its status and most recent -exception event. An explanation of these data is in the specification -RFC-1305. - -

When nothing seems to happen in the pe 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 ntpq -program to spy on its own variables in the same way you can spy on your -own. - -

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. - -

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 -tickadj program and the -s -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. - -

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. - -

Debugging Checklist

- -If the ntpq or ntpdc 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: - -
    - -

  1. Verify the /etc/services 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.
  2. - -

  3. Check the system log for ntpd messages about -configuration -errors, name-lookup failures or initialization problems.
  4. - -

  5. Using the ntpdc program and iostats 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.
  6. - -

  7. If both the packets sent counter and received packets counter do -increment, but the rec timestamp in the pe billboard -shows far from the current date, received packets are probably being -discarded for some reason. There is a handy, undocumented state variable -flash visible in the pebillboard. 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 RFC-1305. A bit other than zero indicates the associated sanity -check failed.
  8. - -

  9. If the org, rec and xmt timestamps in the -pe billboard appear current, but the local clock is not set, as -indicated by a stratum number less than 16 in the rv 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.
  10. - - -

  11. 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 -ntpdc program (or temporary configuration file) and disable -pll command to prevent the ntpd daemon from setting the -clock. Using the ntpq or ntpdc 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 tickadj program and the -t -command line argument.
  12. - -
- -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/driver1.htm b/dist/ntp/html/driver1.htm deleted file mode 100644 index 1f88e7de0180..000000000000 --- a/dist/ntp/html/driver1.htm +++ /dev/null @@ -1,157 +0,0 @@ - - - - - Undisciplined Local Clock - - - - -

-Undisciplined Local Clock

- -
-

-Synopsis

-Address: 127.127.1.u -
Reference ID: LCL -
Driver ID: LOCAL -

-Description

-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. - -

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. - -

A third application for this driver is when an external discipline source -is available, such as the NIST lockclock 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. - -

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 adjtime() -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 ntp_adjtime() system call  is available, -that routine can be used for the same purpose as the adjtime() -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. - -

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 prefer keyword of the -server 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 Mitigation -Rules and the prefer Keyword page for a detailed description -of the exact behavior. - -

The stratum for this driver is set at 3 by default, but can be changed -by the fudge configuration command and/or the ntpdc utility. -The reference ID is LCL by default, but can be changed using the -same mechanisms. *NEVER* 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. *NEVER NEVER* configure a server which might devolve to -an undisciplined local clock to use multicast mode. - -

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 fudge -time1 parameter adjusts the time (in seconds) and the fudge time2 -parameter adjusts the frequency (in parts per million). Both parameters -are additive and operate only once; that is, each command (as from ntpdc) -adds signed increments in time or frequency to the nominal local clock -time and frequency. -

-Monitor Data

-No filegen clockstats monitor data are produced by this driver. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Specifies the frequency offset calibration factor, in parts per million, -with default 0.0.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 3.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default LCL.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
- - -

Additional Information - -

Reference Clock Drivers

- -
-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver10.htm b/dist/ntp/html/driver10.htm deleted file mode 100644 index bdf314ae46e2..000000000000 --- a/dist/ntp/html/driver10.htm +++ /dev/null @@ -1,114 +0,0 @@ - - - - - Austron 2200A/2201A GPS Receivers - - - - -

-Austron 2200A/2201A GPS Receivers

- -
-

-Synopsis

-Address: 127.127.10.u -
Reference ID: GPS -
Driver ID: GPS_AS2201 -
Serial Port: /dev/gpsu; 9600 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-This driver supports the Austron 2200A/2201A GPS/LORAN Synchronized Clock -and Timing Receiver connected via a serial port. It supports several special -features of the clock, including the Input Buffer Module, Output Buffer -Module, IRIG-B Interface Module and LORAN Assist Module. It requires the -RS232 Buffered Serial Interface module for communication with the driver. -For operation with multiple computers, it requires the ppsclock -streams module described in the Line Disciplines and -Streams Modules page. The streams module requires a gadget box and -1-PPS level converter, such as described in the Pulse-per-second -(PPS) Signal Interfacing page. - -

For use with a single computer, the receiver can be connected directly -to the receiver. For use with multiple computers, one of them is connected -directly to the receiver and generates the polling messages. The other -computers just listen to the receiver output directly or through a buffer -amplifier. For computers that just listen, fudge flag2 must be -set and the ppsclock streams module configured on each of them. - -

This receiver is capable of a comprehensive and large volume of statistics -and operational data. The specific data collection commands and attributes -are embedded in the driver source code; however, the collection process -can be enabled or disabled using the flag4 flag. If set, collection is -enabled; if not, which is the default, it is disabled. A comprehensive -suite of data reduction and summary scripts is in the ./scripts/stats directory -of the ntp3 distribution. -

-Monitor Data

-When enabled by the flag4 fudge flag, every received timecode -is written as-is to the clockstats file. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Set for computers that listen-only.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Enable verbose clockstats recording if set.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver11.htm b/dist/ntp/html/driver11.htm deleted file mode 100644 index 6e5dd7a3f171..000000000000 --- a/dist/ntp/html/driver11.htm +++ /dev/null @@ -1,150 +0,0 @@ - - - - - Arbiter 1088A/B GPS Receiver - - - - -

-Arbiter 1088A/B GPS Receiver

- -
-

-Synopsis

-Address: 127.127.11.u -
Reference ID: GPS -
Driver ID: GPS_ARBITER -
Serial Port: /dev/gpsu; 9600 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-This driver supports the Arbiter 1088A/B Satellite Controlled Clock. The -claimed accuracy of this clock is 100 ns relative to the PPS output when -receiving four or more satellites. - -

The receiver should be configured before starting the NTP daemon, in -order to establish reliable position and operating conditions. It does -not initiate surveying or hold mode. For use with NTP, the daylight savings -time feature should be disables (D0 command) and the broadcast -mode set to operate in UTC (BU command). - -

The timecode format supported by this driver is selected by the poll -sequence B5, which initiates a line in the following format to -be repeated once per second until turned off by the B0 command. - -

Format B5 (24 ASCII printing characters): -

<cr><lf>i yy ddd hh:mm:ss.000bbb
-
-on-time = <cr>
-i = synchronization flag (' ' = locked, '?' = unlocked)
-yy = year of century
-ddd = day of year
-hh:mm:ss = hours, minutes, seconds
-.000 = fraction of second (not used)
-bbb = tailing spaces for fill
-The alarm condition is indicated by a '?' at i, which indicates the receiver -is not synchronized. In normal operation, a line consisting of the timecode -followed by the time quality character (TQ) followed by the receiver status -string (SR) is written to the clockstats file. - -

The time quality character is encoded in IEEE P1344 standard: - -

Format TQ (IEEE P1344 estimated worst-case time quality) -

0       clock locked, maximum accuracy
-F       clock failure, time not reliable
-4       clock unlocked, accuracy < 1 us
-5       clock unlocked, accuracy < 10 us
-6       clock unlocked, accuracy < 100 us
-7       clock unlocked, accuracy < 1 ms
-8       clock unlocked, accuracy < 10 ms
-9       clock unlocked, accuracy < 100 ms
-A       clock unlocked, accuracy < 1 s
-B       clock unlocked, accuracy < 10 s
-The status string is encoded as follows: - -

Format SR (25 ASCII printing characters) -

V=vv S=ss T=t P=pdop E=ee
-
-vv = satellites visible
-ss = relative signal strength
-t = satellites tracked
-pdop = position dilution of precision (meters)
-ee = hardware errors
-A three-stage median filter is used to reduce jitter and provide a dispersion -measure. The driver makes no attempt to correct for the intrinsic jitter -of the radio itself. -

-Monitor Data

-When enabled by the flag4 fudge flag, an additional line containing -the latitude, longitude, elevation and optional deviation data is written -to the clockstats file. The deviation data operates with an external -pulse-per-second (PPS) input, such as a cesium oscillator or another radio -clock. The PPS input should be connected to the B event channel and the -radio initialized for deviation data on that channel. The deviation data -consists of the mean offset and standard deviation of the external PPS -signal relative the GPS signal, both in microseconds over the last 16 seconds. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Enable verbose clockstats recording if set.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver12.htm b/dist/ntp/html/driver12.htm deleted file mode 100644 index 57dbb71912d1..000000000000 --- a/dist/ntp/html/driver12.htm +++ /dev/null @@ -1,98 +0,0 @@ - - - - - KSI/Odetics TPRO/S IRIG Interface - - - - -

-KSI/Odetics TPRO/S IRIG Interface

- -
-

-Synopsis

-Address: 127.127.12.u -
Reference ID: IRIG -
Driver ID: IRIG_TPRO -
TPRO Device: /dev/tprou -
Requires: KSI/Odetics device driver, /usr/include/sys/tpro.h header file -

-Description

-This driver supports the KSI/Odetics TPRO and TPRO-SAT IRIG-B Decoder, -which is a module connected directly to the SBus of a Sun workstation. -The module works with the IRIG-B signal generated by several radio clocks, -including those made by Arbiter, Austron, Odetics, Spectracom and TrueTime, -among others, although it is generally an add- on option. In the case of -the TPRO-SAT, the module is an integral part of a GPS receiver, which serves -as the primary timing source. - -

Using the TPRO interface as a NTP reference clock provides precision -time only to ntpd and its clients. With suitable kernel modifications, -it is possible to use the TPRO as the CPU system clock, avoiding errors -introduced by the CPU clock oscillator wander. See the A -Kernel Model for Precision Timekeeping page for further details. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default IRIG.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver16.htm b/dist/ntp/html/driver16.htm deleted file mode 100644 index a4b9f0c29bf9..000000000000 --- a/dist/ntp/html/driver16.htm +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - Bancomm bc635VME Time and Frequency Processor - - - -

-bc635VME/bc350VXI Time and Frequency Processor

- -
-

-Synopsis

-Address: 127.127.16.u -
Reference ID: BTFP -
Driver ID: GPS_BANCOMM -
Bancomm Device:  /dev/btfp0 -
Requires: Bancomm bc635 TFP device module driver for -SunOS 4.x/SunOS 5.x -

-Description

-This is the clock driver for the Bancomm bc635VME Time and Frequency Processor. -It requires the BANCOMM bc635VME / -
bc350VXI Time and Frequency Processor Module Driver for SunOS 4.x/SunOS -5.x UNIX Systems. -

Most of this code is originally from refclock_bancomm.c with thanks. -It has been modified and tested on an UltraSparc IIi-cEngine -
running Solaris 2.6. A port for HPUX is not available henceforth. -
  -

-Additional Information

- -


Reference -Clock Drivers -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver18.htm b/dist/ntp/html/driver18.htm deleted file mode 100644 index 5410d9807607..000000000000 --- a/dist/ntp/html/driver18.htm +++ /dev/null @@ -1,235 +0,0 @@ - - - - - NIST Modem Time Service - - - - -

-NIST Modem Time Service

- -
-

-Synopsis

-Address: 127.127.18.u -
Reference ID: NIST -
Driver ID: ACTS_NIST -
Serial Port: /dev/actsu; 1200 baud, 8-bits, no parity -
Features: tty_clk -
Requires: /usr/include/sys/termios.h header file with modem -control -

-Description

-This driver supports the NIST Automated Computer Time Service (ACTS). It -periodically dials a prespecified telephone number, receives the NIST 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. - -

The ACTS is located at NIST Boulder, CO, telephone 303 494 4774. A toll -call from Newark, DE, costs between three and four cents, although it is -not clear what carrier and time of day discounts apply. The modem dial -string will differ depending on local telephone configuration, etc., and -is specified by the phone command in the configuration file. The argument -to this command is an AT command for a Hayes compatible modem. - -

The driver can operate in either of two modes, as determined by the -mode parameter in the server configuration command. In mode 0 the driver -operates continuously at intervals determined by the fudge time1 parameter, -as described above. In mode 1 the driver is enabled only when no other -sources of synchronization are available and when we have gone more than -MAXOUTAGE (3600 s) since last synchronized by other sources of synchronization. - -

The accuracy produced by this driver should be in the range of a millisecond -or two, but may need correction due to the delay characteristics of the -individual modem involved. For undetermined reasons, some modems work with -the ACTS echo-delay measurement scheme and some don't. This driver tries -to do the best it can with what it gets. Initial experiments with a Practical -Peripherals 9600SA modem here in Delaware suggest an accuracy of a millisecond -or two can be achieved without the scheme by using a fudge time1 value -of 65.0 ms. In either case, the dispersion for a single call involving -ten samples is about 1.3 ms. - -

For reliable call management, this driver requires a 1200-bps modem -with a Hayes-compatible command set and control over the modem data terminal -ready (DTR) control line. Present restrictions require the use of a POSIX-compatible -programming interface, although other interfaces may work as well. The -ACTS telephone number and modem setup string are hard-coded in the driver -and may require changes for nonstandard modems or special circumstances. - -

The fudge time1 parameter represents a propagation-delay correction -factor which is added to the value computed by ACTS when the echo-delay -scheme is used. This scheme does not work with all modems; for those that -don't, fudge flag2 should be set to disable the feature. In this case the -fudge time1 parameter represents the total propagation delay due to all -causes and must be determined by external calibration. - -

The ACTS call interval is determined by a counter initially set to the -fudge time2 parameter. At each poll interval, minpoll (usually 64 s) is -subtracted from the counter. When the counter is equal to or less than -zero, the fudge flag1 is set, which causes up to three call attempts to -be made to ACTS. The fudge flag1 is reset after a valid clock update has -been determined or by a device fault, timeout or manually using ntpdc. -After a valid clock update, the counter is reset for the next interval. -Setting the fudge time2 parameter to zero disables automatic call -attempts. Manual call attempts can be made at any time by setting fudge -flag1 using ntpdc. - -

The NIST timecode message is transmitted at 1200 bps in the following -format: -

-jjjjj yy-mm-dd hh:mm:ss tt l uuu mmmmm UTC(NIST) *
-
-jjjjj = modified Julian day
-yy-mm-dd = year, month, day
-hh:mm:ss = hours, minutes, seconds
-tt = DST indicator (see driver listing)
-l = leap-second warning (see driver listing)
-uuu = DUT1 correction (see driver listing)
-mmmmm = modem calibration (see driver listing)
-on-time = '*'
-The timecode message is transmitted continuously after a signon banner, -which this driver ignores. The driver also ignores all but the yy-mm-dd, -hh:mm:ss and on-time character '*' fields, although it checks the format -of all fields of the message. A timestamp is captured at the '*' character, -as required by the ACTS specification, and used as the reference time of -the timecode. If a message with an on-time character of '#' is received, -the driver updates the propagation delay. The driver disconnects when (a) -ten valid messages have been received, (b) no message has been received -for 15 s, (c) an on-time character of '#' is received. These messages are -processed by a trimmed-mean filter to reduce timing noise and then by the -usual NTP algorithms to develop the clock correction. - -

Since the accumulated error grows with the interval between calls, it -is important that the intrinsic frequency error be minimized. This can -be done by observing difference in offsets between two calls placed some -hours apart and calculating the uncorrected frequency error. This error, -as a fixed-point value in parts-per-million, should be installed in the -ntp.drift file before the daemon is started. Some experimentation may be -necessary in order to reduce the intrinsic frequency error to the order -of 1 ppm. - -

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 prefer keyword of the server configuration command, -in which case only this driver will be selected for synchronization and -all other discipline sources will be ignored. - -

Unlike other drivers, each ACTS call generates one clock correction -and that correction is processed immediately. There is no wait to allow -the clock filter to accumulate samples. In addition, the watchdog timeout -of the local clock algorithm is disabled, so that a correction received -from this driver that exceeds CLOCK_MAX (128 ms) causes an immediate step/slew. - -

Since the interval between updates can be much longer than used with -ordinary NTP peers, the local clock procedure has been modified to operate -in either of two modes, depending on whether the interval between updates -is less than or greater than CLOCK_MAXSEC (1200 s). If less than this value, -the local clock procedure operates using the standard NTP phase-lock loop -as with other NTP peers. If greater than this value, the procedure operates -using a modified frequency-lock loop suggested by Judah Levine in his lockclock -algorithm designed specifically for ACTS. -

-Call Management

-Since ACTS will be a toll call in most areas of the country, it is necessary -to carefully manage the call frequency. This can be done in two ways, by -specifying the interval between calls, or by setting a flag bit manually -or via a cron job. The call interval is determined by a counter initially -set to the fudge time2 parameter. At each poll interval, minpoll (usually -64 s) is subtracted from the counter. When the counter is equal to or less -than zero, the fudge flag1 is set, which causes up to three call attempts -to be made. The fudge flag1 is reset after ten offset samples have been -determined in a single call or by a device fault, timeout or manually using -ntpdc. Upon successful completion of a call, the eight samples have been -shifted into the clock filter, the local clock updated and the counter -reset for the next interval. Setting the fudge time2 parameter to zero -disables automatic call attempts. - -

Manual call attempts can be made at any time by setting fudge flag1 -using ntpdc. For example, the ntpdc command -

-fudge 127.127.18.1 flags 1
-will ask for a key identifier and password and, if authenticated by the -server, will set flag1. There may be a short delay until the expiration -of the current poll timeout. - -

The flag1 can be set from a cron job in the following way. Construct -a file with contents -

keyid 11
-passwd dialup
-fudge 127.127.18.1 flags 1
-quit
-Then, run the following program at specified times as required. -
/usr/local/bin/ntpdc <file
- -

-Monitor Data

-When enabled by the flag4 fudge flag, every received timecode -is written as-is to the clockstats file. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default NIST.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver19.htm b/dist/ntp/html/driver19.htm deleted file mode 100644 index a5cd5e0da8bf..000000000000 --- a/dist/ntp/html/driver19.htm +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Heath WWV/WWVH Receiver - - - - -

-Heath WWV/WWVH Receiver

- -
-

-Synopsis

-Address: 127.127.19.u -
Reference ID: WWV -
Driver ID: WWV_HEATH -
Serial Port: /dev/heathu; 1200 baud, 8-bits, no parity -
Features: tty_clk -
Requires: /usr/include/sys/termios.h header file with modem -control -

-Description

-This driver supports the Heath GC-1000 Most Accurate Clock, with RS232C -Output Accessory. This is a WWV/WWVH receiver somewhat less robust than -other supported receivers. Its claimed accuracy is 100 ms when actually -synchronized to the broadcast signal, but this doesn't happen even most -of the time, due to propagation conditions, ambient noise sources, etc. -When not synchronized, the accuracy is at the whim of the internal clock -oscillator, which can wander into the sunset without warning. Since the -indicated precision is 100 ms, expect a host synchronized only to this -thing to wander to and fro, 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. 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 MANUAL mode the clock responds to a rising edge of the request to -send (RTS) modem control line by sending the timecode. Therefore, it is -necessary that the operating system implement the TIOCMBIC and -TIOCMBIS ioctl system calls and TIOCM_RTS control bit. -Present restrictions require the use of a POSIX-compatible programming -interface, although other interfaces may work as well. - -

The clock message consists of 23 ASCII printing characters in the following -format: -

hh:mm:ss.f     dd/mm/yr<cr>
-
-hh:mm:ss.f = hours, minutes, seconds
-f = deciseconds ('?' when out of spec)
-dd/mm/yr = day, month, year
-The alarm condition is indicated by '?', rather than a digit, at A. Note -that 0?:??:??.? is displayed before synchronization is first established -and hh:mm:ss.? once synchronization is established and then lost again -for about a day. - -

A fudge time1 value of .07 s appears to center the clock offset residuals. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default WWV.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver2.htm b/dist/ntp/html/driver2.htm deleted file mode 100644 index 885a1b20211d..000000000000 --- a/dist/ntp/html/driver2.htm +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Trak 8820 GPS Receiver - - - - -

-Trak 8820 GPS Receiver

- -
-

-Synopsis

-Address: 127.127.2.u -
Reference ID: GPS -
Driver ID: GPS_TRAK -
Serial Port: /dev/traku; 9600 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-This driver supports the Trak 8820 GPS Station Clock. The claimed accuracy -at the 1-PPS output is 200-300 ns 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. - -

For best accuracy, this radio requires the tty_clk line discipline, -which captures a timestamp at the * on-time character of the timecode. -Using this discipline the jitter is in the order of 1 ms and systematic -error about 0.5 ms. If unavailable, the buffer timestamp is used, which -is captured at the \r ending the timecode message. This introduces -a systematic error of 23 character times, or about 24 ms at 9600 bps, together -with a jitter well over 8 ms on Sun IPC-class machines. - -

Using the menus, the radio should be set for 9600 bps, one stop bit -and no parity. It should be set to operate in computer (no echo) mode. -The timecode format includes neither the year nor leap-second warning. - -

In operation, this driver sends a RQTS\r request to the radio -at initialization in order to put it in continuous time output mode. The -radio then sends the following message once each second: -

*RQTS U,ddd:hh:mm:ss.0,q<cr><lf>
-
-on-time = '*'
-ddd = day of year
-hh:mm:ss = hours, minutes, seconds
-q = quality indicator (phase error), 0-6:
-     0 > 20 us
-     6 > 10 us
-     5 > 1 us
-     4 > 100 ns
-     3 > 10 ns
-     2 < 10 ns
-The alarm condition is indicated by 0 at Q, which means -the radio has a phase error greater than 20 us relative to the broadcast -time. The absence of year, DST and leap-second warning in this format is -also alarmed. - -

The continuous time mode is disabled using the RQTX\r request, -following which the radio sends a RQTX DONE<cr><lf> response. -In the normal mode, other control and status requests are effective, including -the leap-second status request RQLS<cr>. The radio responds -with RQLS yy,mm,dd<cr><lf>, where yy,mm,dd are -the year, month and day. Presumably, this gives the epoch of the next leap -second, RQLS 00,00,00 if none is specified in the GPS message. -Specified in this form, the information is generally useless and is ignored -by the driver. -

-Monitor Data

-When enabled by the flag4 fudge flag, every received timecode -is written as-is to the clockstats file. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
- - -

Additional Information - -

Reference Clock Drivers

- -
-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver20.htm b/dist/ntp/html/driver20.htm deleted file mode 100644 index e6a4bd2a83d1..000000000000 --- a/dist/ntp/html/driver20.htm +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Generic NMEA GPS Receiver - - - - -

-Generic NMEA GPS Receiver

- -
-

-Synopsis

-Address: 127.127.20.u -
Reference ID: GPS -
Driver ID: GPS_NMEA -
Serial Port: /dev/gpsu; 4800 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-This driver supports GPS receivers with the $GPRMC NMEA output string. -The driver expect the receiver to be set up to transmit a $GPRMC -message every second. - -

The accuracy depend on the receiver used. Inexpesive GPS models are -available with a claimed PPS signal accuracy of 1 ms -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. - -

The $GPRMC message that the GPS transmits look like this: -

$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)
-  POS_STAT - Position status. (A = Data valid, V = Data invalid)
-  LAT      - Latitude (llll.ll)
-  LAT_REF  - Latitude direction. (N = North, S = South)
-  LON      - Longitude (yyyyy.yy)
-  LON_REF  - Longitude direction (E = East, W = West)
-  SPD      - Speed over ground. (knots) (x.x)
-  HDG      - Heading/track made good (degrees True) (x.x)
-  DATE     - Date (ddmmyy)
-  MAG_VAR  - Magnetic variation (degrees) (x.x)
-  MAG_REF  - Magnetic variation (E = East, W = West)
-  CC       - Checksum (optional)
-  <cr><lf> - Sentence terminator.
-The driver will send a $PMOTG,RMC,0000*1D<cr><lf> message -each time a $GPRMC string is needed. This is not needed on most -GPS receivers because they automatically send the $GPRMC string -every second and will only work on GPS receivers that understand the $PMOTG -string. Others will just ignore it. -

-Setting up the Garmin GPS-25XL

-Switch off all output with by sending it the following string. -
"$PGRMO,,2<cr><lf>"
-Now switch only $GPRMC on by sending it the following string. -
"$PGRMO,GPRMC,1<cr><lf>"
-On some systems the PPS signal isn't switched on by default. It can be -switched on by sending the following string. -
"$PGRMC,,,,,,,,,,,,2<cr><lf>"
- -

-Monitor Data

-The $GPRMC string that is used is written to the clockstats file. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
- - -

Additional Information - -

Reference Clock Drivers

- -
-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver22.htm b/dist/ntp/html/driver22.htm deleted file mode 100644 index 313d2b8232b2..000000000000 --- a/dist/ntp/html/driver22.htm +++ /dev/null @@ -1,129 +0,0 @@ - - - - - PPS Clock Discipline - - - - -

-PPS Clock Discipline

- -
-

-Synopsis

-Address: 127.127.22.u -
Reference ID: PPS -
Driver ID: PPS -
Serial Port: /dev/ppsu; 9600 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-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. - -

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 gadget box -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. - -

There are three ways in which this driver can be used. The first way -uses the ppsclock 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 fudge flag3 1 -command following the server command in the configuration file. -This causes the ppsclock 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 ioctl() -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. - -

The second way uses the tty_clk 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 tty_clk 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 tty_clk line -discipline, this produces an ASCII DEL character ('\377') followed by a -timestamp at the on-time transition of the PPS signal. - -

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. -

-Fudge Factors

- -
-
-time1 time
- -
-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.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default PPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
- - -

Additional Information - -

Reference Clock Drivers

- -
-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver23.htm b/dist/ntp/html/driver23.htm deleted file mode 100644 index 8d6fc9d9eb2e..000000000000 --- a/dist/ntp/html/driver23.htm +++ /dev/null @@ -1,178 +0,0 @@ - - - - - PTB Modem Time Service - - - -

PTB Modem Time Service and other European Laboratories Time -Services

- -
- -

Synopsis

- -

Address: 127.127.23.u
-Reference ID: PTB
-Driver ID: ACTS_PTB
-Serial Port: /dev/ptbu; 1200 baud, 8-bits, no -parity
-Requires: /usr/include/sys/termios.h header file with -modem control

- -

Description

- -

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..

- -

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.

- -

The only change between this driver and the NIST one is the -data format. Infact PTB data format is the following:

- -

Data format
-0000000000111111111122222222223333333333444444444455555555556666666666777777777 - 7
-0123456789012345678901234567890123456789012345678901234567890123456789012345678 - 9
-1995-01-23 20:58:51 MEZ 10402303260219950123195849740+40000500 - *
-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>
-A year
-B month
-C day
-D hour
-E : normally
-A for DST to ST switch first hour
-B for DST to ST switch second hour if not marked in H
-F minute
-G second
-H timezone
-I day of week
-J week of year
-K day of year
-L month for next ST/DST changes
-M day
-N hour
-O UTC year
-P UTC month
-Q UTC day
-R UTC hour
-S UTC minute
-T modified julian day (MJD)
-U DUT1
-V direction and month if leap second
-W signal delay (assumed/measured)
-X sequence number for additional text line in Y
-Y additional text
-Z on time marker (* - assumed delay / # measured delay)
- <CR>!<LF> ! is second change !
-

-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: -

- -
    -
  • In Germany by Physikalisch-Technische Bundesanstalt (PTB)'s - timecode service. Phone number: +49 5 31 51 20 38. -
- -
-

For more detail, see http://www.ptb.de/english/org/4/43/433/disse.htm

-
- -
    -
  • In the UK by National Physical Laboratory (NPL)'s TRUETIME - service. Phone number: 0891 516 333 -
- -
-

For more detail, see http://www.npl.co.uk/npl/ctm/truetime.html

-
- -
    -
  • In Italy by Istituto Elettrotecnico Nazionale "Galileo - Ferrais" (IEN)'s CTD service. Phone number: 166 11 46 - 15 -
- -
-

For more detail, see http://www.ien.it/tf/time/Pagina42.html

-
- -
    -
  • In Switzerland by Swiss Federal Office of Metrology 's timecode - service. Phone number: 031 323 32 25 -
- -
-

For more detail, see http://www.ofmet.admin.ch/de/labors/4/Zeitvert.html -

-
- -
    -
  • In Sweden by SP Swedish National Testing and Research Institute - 's timecode service. Phone number: +46 33 415783 -
- -
-

For more detail, see http://www.sp.se/pne/ElectricalMetrology/ElMeteng/frameset.htm
-
-

-
- -

Fudge Factors

- -
-
time1 time -
Specifies the time offset calibration factor, in seconds - and fraction, with default 0.0. -
time2 time -
Not used by this driver. -
stratum number -
Specifies the driver stratum, in decimal from 0 to 15, with - default 0. -
refid string -
Specifies the driver reference identifier, an ASCII string - from one to four characters, with default PTB. -
flag1 0 | 1 -
Not used by this driver. -
flag2 0 | 1 -
Not used by this driver. -
flag3 0 | 1 -
Not used by this driver. -
flag4 0 | 1 -
Not used by this driver. -
- -

Additional Information

- -

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.

- -

Example:

- -

server 127.127.23.1

- -

phone DIRECT

- -

Reference Clock Drivers 


- -
by Marco Mascarello (masca@tf.ien.it) for David L. Mills -(mills@udel.edu)
- - - - diff --git a/dist/ntp/html/driver24.htm b/dist/ntp/html/driver24.htm deleted file mode 100644 index 70c623bbc1d0..000000000000 --- a/dist/ntp/html/driver24.htm +++ /dev/null @@ -1,85 +0,0 @@ - - - - - USNO Modem Time Service - - - - -

-USNO Modem Time Service

- -
-

-Synopsis

-Address: 127.127.24.u -
Reference ID: USNO -
Driver ID: ACTS_USNO -
Serial Port: /dev/cuau; 1200 baud, 8-bits, no parity -
Requires: /usr/include/sys/termios.h header file with modem -control -

-Description

-No information available. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default USNO.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Enable clockstats recording if set.
-
- -
-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver26.htm b/dist/ntp/html/driver26.htm deleted file mode 100644 index eabbc96554e9..000000000000 --- a/dist/ntp/html/driver26.htm +++ /dev/null @@ -1,109 +0,0 @@ - - - - - Hewlett Packard 58503A GPS Receiver - - - - -

-Hewlett Packard 58503A GPS Receiver

- -
-

-Synopsis

-Address: 127.127.26.u -
Reference ID: GPS -
Driver ID: GPS_HP -
Serial Port: /dev/hpgpsu; 9600 baud, 8-bits, no parity -

-Description

-This driver supports the HP 58503A Time and Frequency Reference Receiver. -It uses HP SmartClock (TM) to implement an Enhanced GPS receiver. The receiver -accuracy when locked to GPS in normal operation is better than 1 usec. -The accuracy when operating in holdover is typically better than 10 us -per day. It receiver should be operated with factory default settings. -Initial driver operation: expects the receiver to be already locked to -GPS, configured and able to output timecode format 2 messages. - -

The driver uses the poll sequence :PTIME:TCODE? to get a response -from the receiver. The receiver responds with a timecode string of ASCII -printing characters, followed by a <cr><lf>, followed by a prompt -string issued by the receiver, in the following format: -

T#yyyymmddhhmmssMFLRVcc<cr><lf>
-The driver processes the response at the <cr> and <lf><cr> and -<lf>, so what the driver sees is the prompt from the previous poll, -followed by this timecode. The prompt from the current poll is (usually) -left unread until the next poll. So (except on the very first poll) the -driver sees this: -
T#yyyymmddhhmmssMFLRVcc<cr><lf>
-The T is the on-time character, at 980 msec. before the next 1PPS edge. -The # is the timecode format type. We look for format 2. Without any of -the CLK or PPS stuff, then, the receiver buffer timestamp at the <cr>y -is 24 characters later, which is about 25 msec. at 9600 bps, so the first -approximation for fudge time1 is nominally -0.955 seconds. This number -probably needs adjusting for each machine / OS type, so far: -0.955000 -on an HP 9000 Model 712/80 HP-UX 9.05 -0.953175 on an HP 9000 Model 370 -HP-UX 9.10 -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
- -
-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver27.htm b/dist/ntp/html/driver27.htm deleted file mode 100644 index 686e985b1b77..000000000000 --- a/dist/ntp/html/driver27.htm +++ /dev/null @@ -1,634 +0,0 @@ - - - - - Arcron MSF Receiver - - - - -

-Arcron MSF Receiver

- -
-

-Synopsis

-Address: 127.127.27.u -
Reference ID: MSFa -
Driver ID: MSF_ARCRON -
Serial Port: /dev/arcu; 300 baud, 8-bits, 2-stop, no -parity -
Features: tty_clk -

-Description

-This driver supports the Arcron MSF receiver, and would probably also support -the DCF77 variant of the same clock. The clock reports its ID as ``MSFa'' -to indicate MSF as a source and the use of the ARCRON driver. - -

This documentation describes version V1.1 (1997/06/23) of the source -and has been tested (amongst others) against ntpd3-5.90 on Solaris-1 (SunOS -4.1.3_U1 on an SS1 serving as a router and firewall) and against ntpd3-5.90 -on Solaris-2.5 (on a SS1+ and TurboSPARC 170MHz). This code will probably -work, and show increased stability, reduced jitter and more efficiency -(fewer context switches) with the tty_clk discipline/STREAMS module -installed, but this has not been tested. For a to-do list see the comments -at the start of the code. - -

This code has been significantly slimmed down since the V1.0 version, -roughly halving the memory footprint of its code and data. - -

This driver is designed to allow the unit to run from batteries as designed, -for something approaching the 2.5 years expected in the usual stand-alone -mode, but no battery-life measurements have been taken. - -

Much of this code is originally from the other refclock driver files -with thanks. The code was originally made to work with the clock by Derek -Mulcahy, with modifications by Damon Hart-Davis. -Thanks also to Lyndon David -for some of the specifications of the clock. - -

There is support for a Tcl/Tk monitor written by Derek Mulcahy that -examines the output stats; see the ARC -Rugby MSF Receiver page for more details and the code. - -

Look at the notes at the start of the code for further information; -some of the more important details follow. - -

The driver interrogates the clock at each poll (ie every 64s by default) -for a timestamp. The clock responds at the start of the next second (with -the start bit of the first byte being on-time). The time is in `local' -format, including the daylight savings adjustment when it is in effect. -The driver code converts the time back to UTC. - -

The clock claims to be accurate to within about 20ms of the MSF-broadcast -time, and given the low data transmission speed from clock to host, and -the fact that the clock is not in continuous sync with MSF, it seems sensible -to set the `precision' of this clock to -5 or -4, -4 being used in this -code, which builds in a reported dispersion of over 63ms (ie says ``This -clock is not very good.''). You can improve the reported precision to -4 -(and thus reduce the base dispersion to about 31ms) by setting the fudge -flag3 to 1. - -

Even a busy and slow IP link can yield lower dispersions than this from -polls of primary time servers on the Internet, which reinforces the idea -that this clock should be used as a backup in case of problems with such -an IP link, or in the unfortunate event of failure of more accurate sources -such as GPS. - -

By default this clock reports itself to be at stratum 2 rather than -the usual stratum 0 for a refclock, because it is not really suited to -be used as other than a backup source. The stratum reported can be changed -with the fudge directive to be whatever you like. After careful -monitoring of your clock, and appropriate choice of the time1 -fudge factor to remove systematic errors in the clock's reported time, -you might fudge the clock to stratum 1 to allow a stratum-2 secondary server -to sync to it. - -

The driver code arranges to resync the clock to MSF at intervals of -a little less than an hour (deliberately avoiding the same time each hour -to avoid any systematic problems with the signal or host). Whilst resyncing, -the driver supplements the normal polls for time from the clock with polls -for the reception signal quality reported by the clock. If the signal quality -is too low (0--2 out of a range of 0--5), we chose not to trust the clock -until the next resync (which we bring forward by about half an hour). If -we don't catch the resync, and so don't know the signal quality, we do -trust the clock (because this would generally be when the signal is very -good and a resync happens quickly), but we still bring the next resync -forward and reduce the reported precision (and thus increase reported dispersion). - -

If we force resyncs to MSF too often we will needlessly exhaust the -batteries the unit runs from. During clock resync this driver tries to -take enough time samples to avoid ntpd losing sync in case this -clock is the current peer. By default the clock would only resync to MSF -about once per day, which would almost certainly not be acceptable for -NTP purposes. - -

The driver does not force an immediate resync of the clock to MSF when -it starts up to avoid excessive battery drain in case ntpd is -going to be repeatedly restarted for any reason, and also to allow enough -samples of the clock to be taken for ntpd to sync immediately -to this clock (and not remain unsynchronised or to sync briefly to another -configured peer, only to hop back in a few poll times, causing unnecessary -disturbance). This behaviour should not cause problems because the driver -will not accept the timestamps from the clock if the status flag delivered -with the time code indicates that the last resync attempt was unsuccessful, -so the initial timestamps will be close to reality, even if with up to -a day's clock drift in the worst case (the clock by default resyncs to -MSF once per day). - -

The clock has a peculiar RS232 arrangement where the transmit lines -are powered from the receive lines, presumably to minimise battery drain. -This arrangement has two consequences: -

    -
  • -Your RS232 interface must drive both +ve and -ve
  • - -
  • -You must (in theory) wait for an echo and a further 10ms between characters
  • -
-This driver, running on standard Sun hardware, seems to work fine; note -the use of the send_slow() routine to queue up command characters -to be sent once every two seconds. - -

Three commands are sent to the clock by this driver. Each command consists -of a single letter (of which only the bottom four bits are significant), -followed by a CR (ASCII 13). Each character sent to the clock should be -followed by a delay to allow the unit to echo the character, and then by -a further 10ms. Following the echo of the command string, there may be -a response (ie in the cae of the g and o commands below), -which in the case of the o command may be delayed by up to 1 second -so as the start bit of the first byte of the response can arrive on time. -The commands and their responses are: -

-
-g CR
- -
-Request for signal quality. Answer only valid during (late part of) resync -to MSF signal. The response consists of two characters as follows:
- -
    -
    -
    -bit 7
    - -
    -parity
    - -
    -bit 6
    - -
    -always 0
    - -
    -bit 5
    - -
    -always 1
    - -
    -bit 4
    - -
    -always 1
    - -
    -bit 3
    - -
    -always 0
    - -
    -bit 2
    - -
    -always 0
    - -
    -bit 1
    - -
    -always 1
    - -
    -bit 0
    - -
    -= 0 if no reception attempt at the moment, = 1 if reception attempt (ie -resync) in progress
    -
    - -
    -
    -bit 7
    - -
    -parity
    - -
    -bit 6
    - -
    -always 0
    - -
    -bit 5
    - -
    -always 1
    - -
    -bit 4
    - -
    -always 1
    - -
    -bit 3
    - -
    -always 0
    - -
    -bit 2--0
    - -
    -reception signal quality in the range 0--5 (very poor to very good); if -in the range 0--2 no successful reception is to be expected. The reported -value drops to zero when not resyncing, ie when first returned byte is -not `3'.
    -
    -
- -
-h CR
- -
-Request to resync to MSF. Can take up from about 30s to 360s. Drains batteries -so should not be used excessively. After this the clock time and date should -be correct and the phase within 20ms of time as transmitted from Rugby -MSF (remember to allow for propagation time). By default the clock resyncs -once per day shortly after 2am (presumably to catch transitions to/from -daylight saving time quickly). With this driver code we resync at least -once per hour to minimise clock wander.
- -
-o CR
- -
-Request timestamp. Start bit of first byte of response is on-time, so may -be delayed up to 1 second. Note that when the BST mode is in effect the -time is GMT/UTC +0100, ie an hour ahead of UTC to reflect local time in -the UK. The response data is as follows:
- -
    -
  1. -hours tens (hours range from 00 to 23)
  2. - -
  3. -hours units
  4. - -
  5. -minutes tens (minutes range from 00 to 59)
  6. - -
  7. -minutes units
  8. - -
  9. -seconds tens (seconds presumed to range from 00 to 60 to allow for leap -second)
  10. - -
  11. -seconds units
  12. - -
  13. -day of week 1 (Monday) to 7 (Sunday)
  14. - -
  15. -day of month tens (day ranges from 01 to 31)
  16. - -
  17. -day of month units
  18. - -
  19. -month tens (months range from 01 to 12)
  20. - -
  21. -month units
  22. - -
  23. -year tens (years range from 00 to 99)
  24. - -
  25. -year units
  26. - -
  27. -BST/UTC status
  28. - -
    -
    -bit 7
    - -
    -parity
    - -
    -bit 6
    - -
    -always 0
    - -
    -bit 5
    - -
    -always 1
    - -
    -bit 4
    - -
    -always 1
    - -
    -bit 3
    - -
    -always 0
    - -
    -bit 2
    - -
    -= 1 if UTC is in effect (reverse of bit 1)
    - -
    -bit 1
    - -
    -= 1 if BST is in effect (reverse of bit 2)
    - -
    -bit 0
    - -
    -= 1 if BST/UTC change pending
    -
    - -
  29. -clock status
  30. - -
      -
    -bit 7
    - -
    -parity
    - -
    -bit 6
    - -
    -always 0
    - -
    -bit 5
    - -
    -always 1
    - -
    -bit 4
    - -
    -always 1
    - -
    -bit 3
    - -
    -= 1 if low battery is detected
    - -
    -bit 2
    - -
    -= 1 if last resync failed (though officially undefined for the MSF clock)
    - -
    -bit 1
    - -
    -= 1 if at least one reception attempt since 0230 for the MSF clock was -successful (0300 for the DCF77 clock)
    - -
    -bit 0
    - -
    -= 1 if the clock has valid time---reset to zero when clock is reset (eg -at power-up), and set to 1 after first successful resync attempt.
    -
    -
-The driver only accepts time from the clock if the bottom three bits of -the status byte are 011. The leap-year logic for computing day-in-year -is only valid until 2099, and the clock will ignore stamps from the clock -that claim BST is in effect in the first hour of each year. If the UK parliament -decides to move us to +0100/+0200 time as opposed to the current +0000/+0100 -time, it is not clear what effect that will have on the time broadcast -by MSF, and therefore on this driver's usefulness.
-A typical ntp.conf configuration file for this driver might be: -
# hostname(n) means we expect (n) to be the stratum at which hostname runs.
-
-#------------------------------------------------------------------------------
-# SYNCHRONISATION PARTNERS
-# ========================
-
-# Our betters...
-server 127.127.27.0 # ARCRON MSF radio clock(1).
-# Fudge stratum and other features as required.
-# ADJUST time1 VALUE FOR YOUR HOST, CLOCK AND LOCATION!
-fudge 127.127.27.0 stratum 1 time1 0.016 flag3 1 flag4 1
-
-peer 11.22.33.9 # tick(1--2).
-peer 11.22.33.4 # tock(3), boot/NFS server.
-
-# This shouldn't get swept away unless left untouched for a long time.
-driftfile /var/tmp/ntp.drift
-
-#------------------------------------------------------------------------------
-# RESTRICTIONS
-# ============
-
-# By default, don't trust and don't allow modifications.  Ignore in fact.
-restrict default ignore notrust nomodify
-
-# Allow others in our subnet to check us out...
-restrict 11.22.33.0 mask 255.255.255.0 nomodify notrust
-
-# Trust our peers for time.  Don't trust others in case they are insane.
-restrict 127.127.27.0 nomodify
-restrict 11.22.33.4 nomodify
-restrict 11.22.33.9 nomodify
-
-# Allow anything from the local host.
-restrict 127.0.0.1
-There are a few #defines in the code that you might wish to play -with: -
-
-ARCRON_KEEN
- -
-With this defined, the code is relatively trusting of the clock, and assumes -that you will have the clock as one of a few time sources, so will bend -over backwards to use the time from the clock when available and avoid -ntpd dropping sync from the clock where possible. You may wish -to undefine this, especially if you have better sources of time or your -reception is ropey. However, there are many checks built in even with this -flag defined.
- -
-ARCRON_OWN_FILTER
- -
-When defined, the code uses its own median-filter code rather than that -available in ntp_refclock.c since the latter seems to have a minor -bug, at least in version 3-5.90. If this bug goes away this flag should -be turned off to avoid duplication of code. (The bug, if that's what it -is, causes the last raw offset to be used rather than the median offset.)
- - -

Without this defined (and without ARCRON_MULTIPLE_SAMPLES below) -a typical set of offsets reported and used to drive the clock-filter algorithm -is (oldest last): -

filtoffset=  -4.32  -34.82   -0.78    0.89    2.76    4.58   -3.92   -2.17
-Look at that spike! - -

With this defined a typical set of offsets is: -

filtoffset=  -7.06   -7.06   -2.91   -2.91   -2.91   -1.27   -9.54   -6.70
-with the repeated values being some evidence of outlyers being discarded. -
-ARCRON_MULTIPLE_SAMPLES
- -
-When is defined, we regard each character in the returned timecode as at -a known delay from the start of the second, and use the smallest (most -negative) offset implied by any such character, ie with the smallest kernel-induced -display, and use that. This helps to reduce jitter and spikes.
- -
-ARCRON_LEAPSECOND_KEEN
- -
-When is defined, we try to do a resync to MSF as soon as possible in the -first hour of the morning of the first day of the first and seventh months, -ie just after a leap-second insertion or deletion would happen if it is -going to. This should help compensate for the fact that this clock does -not continuously sample MSF, which compounds the fact that MSF itself gives -no warning of an impending leap-second event. This code did not seem functional -at the leap-second insertion of 30th June 1997 so is by default disabled.
- -
-PRECISION
- -
-Currently set to -4, but you may wish to set it to -5 -if you are more conservative, or to -6 if you have particularly -good experience with the clock and you live on the edge. Note that the -flag3 fudge value will improve the reported dispersion one notch -if clock signal quality is known good. So maybe just leave this alone. -B^)
- -
-NSAMPLES
- -
-Should be at least 3 to help smooth out sampling jitters. Can be more, -but if made too long can make ntpd overshoot on clock corrections -and can hold onto bad samples longer than you would like. With this set -to 4 and NKEEP set to 3 this allows the occasional bad sample -(in my experience less than 1 value in 10) to be dropped. (Note that there -seems to be some sort of `beat' effect in the offset with a periodicity -of about 7 samples as of this writing (1997/05/11) still under investigation; -a filter of approximately this length should be able to almost completely -suppress this effect.) Note that if the fudge-factor flag3 is -set to 1, a larger NSAMPLES is used.
-
- -

-Monitor Data

-Each timecode is written to the clockstats file with a signal -quality value appended (`0'--`5' as reported by the clock, or `6' for unknown). - -

Each resync and result (plus gaining or losing MSF sync) is logged to -the system log at level LOG_NOTICE; note that each resync drains -the unit's batteries, so the syslog entry seems justified. - -

Syslog entries are of the form: -

May 10 10:15:24 oolong ntpd[615]: ARCRON: unit 0: sending resync command
-May 10 10:17:32 oolong ntpd[615]: ARCRON: sync finished, signal quality 5: OK, will use clock
-May 10 11:13:01 oolong ntpd[615]: ARCRON: unit 0: sending resync command
-May 10 11:14:06 oolong ntpd[615]: ARCRON: sync finished, signal quality -1: UNKNOWN, will use clock anyway
-May 10 11:41:49 oolong ntpd[615]: ARCRON: unit 0: sending resync command
-May 10 11:43:57 oolong ntpd[615]: ARCRON: sync finished, signal quality 5: OK, will use clock
-May 10 12:39:26 oolong ntpd[615]: ARCRON: unit 0: sending resync command
-May 10 12:41:34 oolong ntpd[615]: ARCRON: sync finished, signal quality 3: OK, will use clock
- -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0. On a Sun SparcStation 1 running SunOS 4.1.3_U1, with -the receiver in London, a value of 0.020 (20ms) seems to be appropriate.
- -
-time2 time
- -
-Not currently used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0. -It is suggested that the clock be fudged to stratum 1 so this it is used -a backup time source rather than a primary when more accurate sources are -available.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default MSFa.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-If set to 1, better precision is reported (and thus lower dispersion) while -clock's received signal quality is known to be good.
- -
-flag4 0 | 1
- -
-If set to 1, a longer-than-normal (8-stage rather than 4-stage) median -filter is used, to provide some extra smoothing of clock output and reduction -in jitter, at the cost of extra clock overshoot. Probably not advisable -unless the server using this clock has other sources it can use to help -mitigate the overshoot.
-
- -

-Additional Information

-Reference Clock Drivers - -

ARC Rugby MSF Receiver -page  -


-
-Damon Hart-Davis (d@hd.org)
- - - diff --git a/dist/ntp/html/driver28.htm b/dist/ntp/html/driver28.htm deleted file mode 100644 index 787ccb41786d..000000000000 --- a/dist/ntp/html/driver28.htm +++ /dev/null @@ -1,133 +0,0 @@ - - - - - Shared memoy Driver - - - - -

-Shared Memory Driver

- -
-

-Synopsis

-Address: 127.127.28.u -
Reference ID: SHM -
Driver ID: SHM -

-Description

-This driver receives its reference clock info from a shared memory-segment. -The shared memory-segment is created with owner-only access for unit 0 -and 1, and world access for unit 2 and 3 -

-Structure of shared memory-segment

- -
struct shmTime {
-  int    mode; /* 0 - if valid set
-                *       use values, 
-                *       clear valid
-                * 1 - if valid set 
-                *       if count before and after read of 
-                *       values is equal,
-                *         use values 
-                *       clear valid
-                */
-  int    count;
-  time_t clockTimeStampSec;      /* external clock */
-  int    clockTimeStampUSec;     /* external clock */
-  time_t receiveTimeStampSec;    /* internal clock, when external value was received */
-  int    receiveTimeStampUSec;   /* internal clock, when external value was received */
-  int    leap;
-  int    precision;
-  int    nsamples;
-  int    valid;
-  int    dummy[10]; 
-};
- -

-Operation mode=0

-When the poll-method of the driver is called, the valid-flag of the shared -memory-segment is checked: - -

If set, the values in the record (clockTimeStampSec, clockTimeStampUSec, -receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are passed -to ntp, and the valid-flag is cleared. - -

If not set, a timeout is reported to ntp, nothing else happend -

-Operation mode=1

-When the poll-method of the driver is called, the valid-flag of the shared -memory-segment is checked: - -

If set, the count-field of the record is remembered, and the values -in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, -receiveTimeStampUSec, leap, precision) are read. Then, the remembered count -is compared to the count now in the record. If both are equal, the values -read from the record are passed to ntp. If they differ, another process -has modified the record while it was read out (was not able to produce -this case), and failure is reported to ntp. The valid flag is cleared. - -

If not set, a timeout is reported to ntp, nothing else happend -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default SHM.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
- - -

Additional Information - -

Reference Clock Drivers

- - - diff --git a/dist/ntp/html/driver29.htm b/dist/ntp/html/driver29.htm deleted file mode 100644 index 0f43b949a13d..000000000000 --- a/dist/ntp/html/driver29.htm +++ /dev/null @@ -1,1251 +0,0 @@ - - - - - Trimble Palisade Receiver - - - -

-Trimble Palisade Receiver -

- -

-Synopsis

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Address: 
-
127.127.29.u
-
Reference ID:
-
GPS
-
Driver ID:
-
GPS_PALISADE
-
Serial Port:
-
/dev/palisadeu
-
Serial I/O:
-
9600 baud, 8-bits, 1-stop, odd parity
- -

-Description

-The refclock_palisade driver supports Trimble -Navigation's Palisade Smart Antenna GPS receiver. -
Additional software and information about the Palisade GPS is available -from: http://www.trimble.com/oem/ntp. -
Latest NTP driver source, executables and documentation is maintained -at: -ftp://ftp.trimble.com/pub/ntp -

This documentation describes version 7.12 of the GPS Firmware and version -2.46 (July 15, 1999) and later, of the driver source. -
  -

-Operating System Compatibility

-The Palisade driver has been tested on the following software and hardware -platforms: -
  -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PlatformOperating SystemNTP SourcesAccuracy
i386 (PC) LinuxNTP Distribution10 us
i386 (PC) Windows NTftp://ftp.trimble.com/pub/ntp1 ms
SUNSolaris 2.xNTP Distribution50 us
Hewlett-PackardHPUX 9, 10, 11http://us-support.external.hp.com50 us
VariousFree BSDNTP Distribution20 us
- -

-GPS Receiver

-The Palisade GPS receiver is an 8-channel smart antenna, housing the GPS -receiver, antenna and interface in a single unit, and is designed for rooftop -deployment in static timing applications. -

Palisade generates a PPS synchronized to UTC within +/- 100 ns.  -The Palisade's external event input with 40 nanosecond resolution is utilized -by the Palisade NTP driver for asynchronous precision time transfer. -

No user initialization of the receiver is required. This driver is compatible -with the following versions of Palisade: -
  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Version
-
-
Event Input
-
-
Trimble Part Number
-
-
7.02
-
-
No
-
-
26664-00
-
-
7.02E
-
-
Yes
-
-
26664-10
-
-
7.12
-
-
Yes
-
-
38158-00
-
- -
-
Note: When using Palisade 26664-00, you must set fudge flag2 to 1 in -ntp.conf. -See configuration.
- -
-

-GPS Installation

-A location with unobstructed view of the horizon is recommended. Palisade -is designed to be securely mounted atop standard 3/4 inch threaded pipe. -

The 12 conductor (dia. 10 mm)  power and I/O cable must be routed -from the rooftop site to the NTP server and properly strain relieved. -

-GPS Connection

-The Palisade is equipped with dual (A & B) RS-422 serial interfaces -and a differential TTL PPS output. An RS-232 / RS-422 Interface Module -is supplied with the Palisade NTP Synchronization Kit. Palisade port -A must be connected to the NTP host server. Maximum antenna cable length -is 500 meters. See the pinouts table for detailed -connection Information. -

Palisade's port B provides a TSIP (Trimble Standard -Interface Protocol) interface for diagnostics, configuration, and monitoring. -Port B and the PPS output are not currently used by the Palisade NTP reference -clock driver. -
 

-
- -

-O/S Serial Port Configuration

-The driver attempts to open the device /dev/palisadeu -where -u is the NTP refclock unit number as defined by the -LSB of the refclock address.  Valid refclock unit numbers are 0 - -3. -

The user is expected to provide a symbolic link to an available serial -port device.  This is typically performed by a command such as: -

ln -s /dev/ttyS0 /dev/palisade0
-Windows NT does not support symbolic links to device files. COMx: -is used by the driver, based on the refclock unit number, where unit 1 -corresponds to COM1: and unit 3 corresponds to COM3: -
  -

-NTP Configuration

-Palisade NTP configuration file "ntp.conf" with event polling: -
#------------------------------------------------------------------------------ -
# The Primary reference -
server 127.127.29.0 # Trimble Palisade GPS Refclock Unit #0 -
peer terrapin.csc.ncsu.edu # internet server -
# Drift file for expedient re-synchronization after downtime or -reboot. -
driftfile /etc/ntp.drift -
#------------------------------------------------------------------------------ -

Configuration without event polling: -
#------------------------------------------------------------------------------ -
# The Primary reference -
server 127.127.29.0 # Trimble Palisade GPS (Stratum 1). -
# Set packet delay -
fudge 127.127.29.0 time1 0.020 -
# and set flag2 to turn off event polling. -
fudge 127.127.29.0 flag2 1 -
#------------------------------------------------------------------------------ -
  -

-Time Transfer and Polling

-Time transfer to the NTP host is performed via the Palisade's comprehensive -time packet output. The time packets are output once per second, and whenever -an event timestamp is requested. -

The driver requests an event time stamp at the end of each polling interval, -by pulsing the RTS (request to send) line on the serial port. The Palisade -GPS responds with a time stamped event packet. -

Time stamps are reported by the Palisade with respect to UTC time. The -GPS receiver must download UTC offset information from GPS satellites. -After an initial UTC download, the receiver will always start with correct -UTC offset information. -
  -

-Run NTP in Debugging Mode

-The following procedure is recommended for installing and testing a Palisade -NTP driver: -
    -
  1. -Perform initial checkout procedures. Place the GPS receiver outdoors; with -clear view of the sky. Allow the receiver to obtain an UTC almanac.
  2. - -
  3. -Verify presence of timing packets by observing the 1 Hz (PPS) led on the -interface module. It should flash once per second.
  4. - -
  5. -Connect Palisade's port A to the NTP host.
  6. - -
  7. -Configure NTP and the serial I/O port on the host system.
  8. - -
  9. -Initially use fudge flag2 in ntp.conf, -to disable event polling (see configuration).
  10. - -
  11. -Run NTP in debug mode (-d -d), to observe Palisade_receive events.
  12. - -
  13. -The driver reports the tracking status of the -receiver. Make sure it is tracking several satellites.
  14. - -
  15. -Remove fudge flag2 and restart ntpd in debug mode to observe palisade_receive -events.
  16. - -
  17. -If event polling fails, verify the connections and -that the host hardware supports RTS control.
  18. -
- -

-Event Logging

-System and Event log entries are generated by NTP to report significant -system events. Administrators should monitor the system log to observe -NTP error messages. Log entries generated by the Palisade NTP reference -clock driver will be of the form: -
-
Nov 14 16:16:21 terrapin ntpd[1127]: Palisade #0: message
-
- -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0. If event capture is not used, time1 should be set to -20 milliseconds to correct serial line and operating system delays incurred -in capturing time stamps from the synchronous packets.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, GPS.
- -
-flag2 0 -| 1
- -
-When set to 1, driver does not use hardware event capture. The synchronous -packet output by the receiver at the beginning of each second is time stamped -by the driver. If triggering the event pulse fails, the driver falls back -to this mode automatically.
-
- -

-DEFINEs

-The following constants are defined in the driver source code. These defines -may be modified to improve performance or adapt to new operating systems. -
  -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LabelDefinitionDefault Value
DEVICEThe serial port device to be used by the driver/dev/palisadeu
PRECISIONAccuracy of time transfer1 microsecond
CURRENT_UTCValid GPS - UTC offset13
SPEED232Host RS-232 baud rateB9600
TRMB_MINPOLL Minimum polling interval5 (32 seconds)
TRMB_MAXPOLLMaximum interval between polls7 (128 seconds)
- -

-Data Format

-Palisade port A can output two synchronous time packets. The NTP driver -can use either packet for synchronization. Packets are formatted as follows: -

-Packet 8F-AD (Primary NTP Packet)

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteItemTypeMeaning
0Sub-Packet IDBYTESubcode 0xAD
1 - 2Event CountINTEGERExternal event count recorded (0 = PPS)
3 - 10Fractional SecondDOUBLETime elapsed in current second (s)
11HourBYTEHour (0 - 23)
12MinuteBYTEMinute (0 - 59)
13SecondBYTESecond (0 - 59; 60 = leap)
14DayBYTEDate (1 - 31)
15MonthBYTEMonth (1 - 12)
16 - 17YearINTEGERYear (4 digit)
18Receiver StatusBYTETracking Status
19UTC FlagsBYTELeap Second Flags
20ReservedBYTEContains 0xFF
21ReservedBYTEContains 0xFF
- -
-

-Leap Second Flag Definition:

-Bit 0:  (1) UTC Time is available -
Bits 1 - 3: Undefined -
Bit 4:  (1) Leap Scheduled: Leap second pending asserted by GPS -control segment. -
Bit 5:  (1) Leap Pending: set 24 hours before, until beginning -of leap second. -
Bit 6:  (1) GPS Leap Warning: 6 hours before until 6 hours after -leap event -
Bit 7:  (1) Leap In Progress. Only set during the leap second. -

-Tracking Status Flag Definitions:

-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMeaningAccuracyReceiver Mode
0Receiver is Navigating+/- 1 usSelf Survey
1Static 1 Sat. Timing Mode +/- 1 us1-D Timing
2Approximate Time20 - 50 msAcquisition
3StartupN/AInitialization
4StartupN/AInitialization
5Dilution of Position too High 5 ppmSelf Survey
6Static 1 Sat. Timing: Sat. not usable5 ppm1-D Timing
7No Satellites UsableN/ASelf Survey
8Only 1 Satellite Usable20 - 50 msSelf Survey
9Only 2 Satellite Usable20 - 50 msSelf Survey
10Only 3 Satellites Usable20 - 50 msSelf Survey
11Invalid SolutionN/AError
12Differential Corrections N/AN/A
13Overdetermined Fixes+/- 100 nsTiming Steady State
- -

-Packet 8F-0B (Comprehensive Timing Packet)

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteItemTypeMeaning
0Sub-Packet IDBYTESubcode 0x0B
1 - 2Event CountINTEGERExternal event count recorded (0 = PPS)
3 - 10UTC / GPS TOWDOUBLEUTC / GPS time of week (seconds)
11DateBYTEDay of Month
12MonthBYTEMonth of Event
13 - 14YearINTYear of event
15Receiver ModeBYTEReceiver operating dimensions:  -
0: Horizontal (2D)  -
1: Full Position (3D)  -
2: Single Satellite (0D)  -
3: Automatic (2D / 3D)  -
4: DGPS reference  -
5: Clock hold (2D)  -
6: Over determined Clock
15 - 17UTC OffsetINTEGERUTC Offset value (seconds)
18 - 25Oscillator BiasDOUBLEOscillator BIAS (meters)
26 - 33Oscillator Drift RateDOUBLEOscillator Drift (meters / second)
34 - 37Bias UncertaintySINGLEOscillator bias uncertainty (meters)
38 - 41Drift UncertaintySINGLEOscillator bias rate uncertainty (m / sec)
42 - 49LatitudeDOUBLELatitude in radians
50 - 57LongitudeDOUBLELongitude in radians
58 - 65AltitudeDOUBLEAltitude above mean sea level, in meters
66 - 73Satellite IDBYTESV Id No. of tracked satellites
- -

-Pinouts

-The following connections are required when connecting -Palisade with a host: -
  -
  -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DescriptionHostPalisade 
Port ADB-9DB-25RS-232RS-422Palisade Pin
Receive Data 23<-->GreenGreen / Blue8 (T-) & 10 (T+)
Request to Send74<-->GrayGray / White6 (R-) & 7 (R+)
Signal Ground57<-->BlackBlack9 (GND)
Port B
Receive Data 23<-->BrownBrown / Yellow4 (T-) & 5 (T+)
Transmit Data32<-->VioletOrange/ Violet2 (R-) & 3 (R+)
Signal Ground57<-->BlackBlack9 (GND)
- -
Note: If driving the RS-422 inputs on the Palisade single ended, -i.e. using the Green and Gray connections only, does not work on all serial -ports. Use of the Palisade NTP Synchronization Interface Module is recommended.
- -
The 12 pin connector pinout definition: -
Face the round 12 pin connector at the end of the cable, with the notch -turned upwards. -
Pin 1 is to the left of the notch. Pins 2 - 8 wrap around the bottom, -counterclockwise to pin 9 on the right of the notch. Pin 10 is just below -the notch. Pins 10 (top), 11 (bottom left) and 12 (bottom right) form a -triangle in the center of the connector.
- -
Pinouts for the Palisade NTP host adapter -(Trimble PN 37070) DB-25 M connector are as follows:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DB-25MConductor PalisadeDescription
Red1Power
Black9Ground
9Black/White12PPS -
10 Green8Transmit Port A (T-)
11 Brown4Transmit Port B (T-)
12 Gray7Receive Port A (R+)
13Orange3Receive Port B (R+)
21Orange/White11PPS +
22Blue10Transmit Port A (T+)
23Yellow5Transmit Port B (T+)
24White6Receive Port A (R-)
25Violet2Receive Port B (R-)
- -

-


-

Questions or Comments: -
Sven Dietrich -
Trimble Navigation Ltd. -

(last updated July 29, 1999) -
  - - diff --git a/dist/ntp/html/driver3.htm b/dist/ntp/html/driver3.htm deleted file mode 100644 index 47511d85b962..000000000000 --- a/dist/ntp/html/driver3.htm +++ /dev/null @@ -1,131 +0,0 @@ - - - - - PSTI/Traconex 1020 WWV/WWVH Receiver - - - - -

-PSTI/Traconex 1020 WWV/WWVH Receiver

- -
-

-Synopsis

-Address: 127.127.3.u -
Reference ID: WWV -
Driver ID: WWV_PST -
Serial Port: /dev/wwvu; 9600 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-This driver supports the PSTI 1010 and Traconex 1020 WWV/WWVH Receivers. -No specific claim of accuracy is made for these receiver, but actual experience -suggests that 10 ms would be a conservative assumption. - -

The DIP-switches should be set for 9600 bps line speed, 24-hour day-of-year -format and UTC time zone. Automatic correction for DST should be disabled. -It is very important that the year be set correctly in the DIP-switches; -otherwise, the day of year will be incorrect after 28 April of a normal -or leap year. The propagation delay DIP-switches should be set according -to the distance from the transmitter for both WWV and WWVH, as described -in the instructions. While the delay can be set only to within 11 ms, the -fudge time1 parameter can be used for vernier corrections. - -

Using the poll sequence QTQDQM, the response timecode is in -three sections totalling 50 ASCII printing characters, as concatenated -by the driver, in the following format: -

ahh:mm:ss.fffs<cr> yy/dd/mm/ddd<cr>
-frdzycchhSSFTttttuuxx<cr>
-
-on-time = first <cr>
-hh:mm:ss.fff = hours, minutes, seconds, milliseconds
-a = AM/PM indicator (' ' for 24-hour mode)
-yy = year (from DIPswitches)
-dd/mm/ddd = day of month, month, day of year
-s = daylight-saving indicator (' ' for 24-hour mode)
-f = frequency enable (O = all frequencies enabled)
-r = baud rate (3 = 1200, 6 = 9600)
-d = features indicator (@ = month/day display enabled)
-z = time zone (0 = UTC)
-y = year (5 = 91)
-cc = WWV propagation delay (52 = 22 ms)
-hh = WWVH propagation delay (81 = 33 ms)
-SS = status (80 or 82 = operating correctly)
-F = current receive frequency (4 = 15 MHz)
-T = transmitter (C = WWV, H = WWVH)
-tttt = time since last update (0000 = minutes)
-uu = flush character (03 = ^c)
-xx = 94 (unknown)
-The alarm condition is indicated by other than 8 at a, -which occurs during initial synchronization and when received signal is -lost for an extended period; unlock condition is indicated by other than -0000 in the tttt subfield. -

-Monitor Data

-When enabled by the flag4 fudge flag, every received timecode -is written as-is to the clockstats file. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default WWV.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver30.htm b/dist/ntp/html/driver30.htm deleted file mode 100644 index 7a5bbbc114c5..000000000000 --- a/dist/ntp/html/driver30.htm +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - Motorola Oncore GPS Receiver - - - - -

-Motorola Oncore GPS receiver

- -
-

-Synopsis

- -Address: 127.127.30.0
-Reference ID: GPS
-Driver ID: ONCORE
-Serial Port: /dev/oncore.serial.0;  9600 baud, 8-bits, -no parity.
-PPS Port: /dev/oncore.pps.0PPS_CAPTUREASSERT -required,  PPS_OFFSETASSERT supported. -

-Description

-This driver supports various models of the Motorola Oncore GPS -receivers as long as they support the Motorola Binary -Protocol. - -

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 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 -TAPR . - -

The driver requires a standard PPS interface for the -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. - -

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 to determine the antenna position. -

-Monitor Data

-The driver is quite chatty on stdout if ntpd is run with debugging. -

-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 Oncore-SHMEM 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. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default -0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Not used by this driver.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
-Additional Information -

The driver was initially developed on FreeBSD, and has since been tested -on Linux, SunOS and Solaris. - -

There is a driver specific configuration file /etc/ntp.oncore -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. -The offset shifts the PPS signal to avoid interrupt pileups `on' the second, -and adjust the timestamp accordingly. -See the driver source for information on this file. -The default with no file is: no delay, no offset, and a site survey is done -to get the location of the gps receiver. - -

The /etc/ntp.conf file will need a line of the form
-       - pps /dev/oncore.pps.0 [ assert/clear ] hardpps
-if you want the oncore driver to control the kernel PLL. -For more information, see the Reference Clock -Options page. - -

Performance -

Really good.  With the VP/UT+, the generated PPS pulse is referenced -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 -and an ovenized quartz oscillator, that performance has been reproduced. - For more details on this aspect:  Sub-Microsecond -timekeeping under FreeBSD -


-
-Poul-Henning Kamp (phk@FreeBSD.org), -Reg Clemens (reg@dwf.com) -
- - diff --git a/dist/ntp/html/driver32.htm b/dist/ntp/html/driver32.htm deleted file mode 100644 index 208ad5c02e42..000000000000 --- a/dist/ntp/html/driver32.htm +++ /dev/null @@ -1,42 +0,0 @@ - - - -Chrono-log K-series WWVB receiver - - - -

Chrono-log K-series WWVB receiver

- -
-

Synopsis

-Address: 127.127.32.u
-Reference ID: CHRONOLOG
-Driver ID: CHRONOLOG
-Serial Port: /dev/chronologu; 2400 bps, 8-bits, -no parity
-
Features: (none) -

Description

-This driver supports the Chrono-log K-series WWVB receiver. This is a -very old receiver without provisions for leap seconds, quality codes, -etc. It assumes output in the local time zone, and that the C library -mktime()/localtime() routines will correctly convert back and forth -between local and UTC. There is a hack in the driver for permitting -UTC, but it has not been tested. - -

Most of this code is originally from refclock_wwvb.c with thanks. It -has been so mangled that wwvb is not a recognizable ancestor. -

-Timecode format: Y yy/mm/ddCLZhh:mm:ssCL
-Y - year/month/date line indicator
-yy/mm/dd -- two-digit year/month/day
-C - \r (carriage return)
-L - \n (newline)
-Z - timestamp indicator
-hh:mm:ss - local time
-
-
-
- -Last modified: Sun Feb 14 11:57:27 EST 1999 - - diff --git a/dist/ntp/html/driver33.htm b/dist/ntp/html/driver33.htm deleted file mode 100644 index 768cfe72667f..000000000000 --- a/dist/ntp/html/driver33.htm +++ /dev/null @@ -1,38 +0,0 @@ - - - -Dumb Clock - - - -

Dumb Clock

- -
-

Synopsis

-Address: 127.127.33.u
-Reference ID: DUMBCLOCK
-Driver ID: DUMBCLOCK
-Serial Port: /dev/dumbclocku; 9600 bps, 8-bits, -no parity
-
Features: (none) -

Description

-This driver supports a dumb ASCII clock that only emits localtime at a reliable -interval. This has no provisions for leap seconds, quality codes, -etc. It assumes output in the local time zone, and that the C library -mktime()/localtime() routines will correctly convert back and forth -between local and UTC. - -

Most of this code is originally from refclock_wwvb.c with thanks. It -has been so mangled that wwvb is not a recognizable ancestor. -

-Timecode format: hh:mm:ssCL
-hh:mm:ss - local time
-C - \r (carriage return)
-L - \n (newline)
-
-
-
- -Last modified: Sun Feb 14 12:07:01 EST 1999 - - diff --git a/dist/ntp/html/driver34.htm b/dist/ntp/html/driver34.htm deleted file mode 100644 index e9dcdbca4e65..000000000000 --- a/dist/ntp/html/driver34.htm +++ /dev/null @@ -1,54 +0,0 @@ - - - -Dumb Clock - - - -

Ultralink Clock

- -
-

Synopsis

-Address: 127.127.34.u
-Reference ID: ULINK
-Driver ID: ULINK
-Serial Port: /dev/ulinku; 9600 bps, 8-bits, -no parity
-
Features: (none) -

Description

-This driver supports the Ultralink Model 320 RS-232 powered WWVB receiver. PDF specs available on www.linuxfoundary.com. While the unit may support them, this driver does nothing with leap seconds, quality codes, etc. (though it probably should). - -

Most of this code is originally from refclock_wwvb.c with thanks. Any mistakes are mine. Any improvements are welcome. - -

-  The timecode format is:
- 
-   SQRYYYYDDD+HH:MM:SS.mmLT
- 
-  where:
- 
-  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
- 
-  Note that this driver does not do anything with the L or T flags.
- 
-  The M320 also has a 'U' command which returns UT1 correction information.  It
-  is not used in this driver.
-
-
-
-
root
- -Last modified: Tue Sep 14 05:53:08 EDT 1999 - - diff --git a/dist/ntp/html/driver35.htm b/dist/ntp/html/driver35.htm deleted file mode 100644 index d3b77e0e201a..000000000000 --- a/dist/ntp/html/driver35.htm +++ /dev/null @@ -1,82 +0,0 @@ - - - -Conrad parallel port radio clock - - - -

Conrad parallel port radio clock

-
- -

Synopsis

- -

Address: 127.127.35.u
-Reference ID: PCF
-Driver ID: PCF
-Parallel Port: /dev/pcfclocku -

- -

Description

- -

This driver supports the parallel port radio clocks sold by Conrad Electronic 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. - -

The driver requires that the pcfclock device driver be installed. -A device driver for Linux 2.2 is available at -the pcfclock driver -page. -

- -

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 ntpd is -started.

- -

Monitor Data

- -

Each timecode is written to the clockstats file in the format -YYYY MM DD HH MI SS.

- -

Fudge Factors

- -
-
time1 time
-
Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
time2 time
-
Not used by this driver.
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default 0. -
- -
refid string
-
Specifies the driver reference identifier, an ASCII string from one to -four characters, with default PCF.
- -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
Not used by this driver.
- -
flag3 0 | 1
-
Not used by this driver.
- -
flag4 0 | 1
-
Not used by this driver.
-
- -
-
Andreas Voegele (andreas.voegele@gmx.de)
- - - diff --git a/dist/ntp/html/driver36.htm b/dist/ntp/html/driver36.htm deleted file mode 100644 index 80da30b65547..000000000000 --- a/dist/ntp/html/driver36.htm +++ /dev/null @@ -1,844 +0,0 @@ - -Radio WWV/H Audio Demodulator/Decoder -

-Radio WWV/H Audio Demodulator/Decoder -


- -

Synopsis

- -Address: 127.127.36.u -
Reference ID: WWV or WWVH -
Driver ID: WWV_AUDIO -
Autotune Port: /dev/icom; 1200/9600 baud, 8-bits, no parity -
Audio Device: /dev/audio and /dev/audioctl - -

Description

- -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 -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. - -

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 -www.eecis.udel.edu/~mills/reports.htm. 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. - -

This driver incorporates several features in common with other audio -drivers such as described in the Radio CHU Audio -Demodulator/Decoder and the IRIG Audio -Decoder 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 Reference Clock Audio Drivers -page. - -

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. - -

Program Architecture

- -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

Performance

- -

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 ms. The frequency stability characteristic is highly -important, since the clock may have to free-run for several hours before -reacquiring the WWV/H signal. - -

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 ms. 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. - -

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. - -

Program Operation

- -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. - -

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. - -

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-ms 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. - -

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. - -

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 NONE. -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 -fudge time1 (WWV) and fudge time2 (WWVH) commands in -the configuration file, handover from one station to the other will be -seamless. - -

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. - -

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. - -

Autotune

- -

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. - -

Each ICOM radio is assigned a unique 8-bit ID select code, usually -expressed in hex format. To activate the CI-V interface, the -mode keyword of the server 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 mode keyword or a zero argument leaves -the interface disabled. - -

If specified, the driver will attempt to open the device -/dev/icom 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 -/dev/icom 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. - -

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. - -

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 - -

- -

0x0001 -
Jitter exceeded. The difference in epoches between the last minute -sync pulse and the current one exceeds 50 ms (400 samples).
- -
0x0002 -
Minute pulse error. For the minute sync pulse in second 0, either -the amplitude or SNR is below threshold (2000 and 20 dB, -respectively).
- -
0x0004 -
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).
- -
- -

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. - -

Diagnostics

- -

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. - -

wwv5 port agc wwv wwvh - -

where port and agc are the audio port and gain, -respectively, for this frequency and wwv and wwvh are -two sets of fields, one each for WWV and WWVH. Each of the two fields -has the format - -

ident score comp sync/snr/jitr - -

where identencodes the station (C for WWV, -H for WWVH) and frequency (2, 5, 10, 15 and 20), score -is the scoreboard described above, comp is the compare counter, -sync is the minute sync pulse amplitude, snr the SNR -of the pulse and jitr is the sample difference between the -current epoch and the last epoch. An example is: - -

wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0 22/-12.4/8846 - -

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 -(C20) and WWVH (H20). 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. - -

A sequence of five messages, one for each minute, might appear as -follows: - -

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
- -

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. - -

Debugging Aids

- -

The most convenient way to track the driver status is using the -ntpq program and the clockvar 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 (-d on the ntpd command line)is enabled, -the driver produces detailed status messages as it operates. If the -fudge flag 4 is set, these messages are written to the -clockstats file. All messages produced by this driver have the -prefix chu for convenient filtering with the Unix grep -command. - -

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: - -

wwvn ss stat sigl - -

where wwvn is the message code, ss the second of -minute, stat the driver status word and sigl 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. - -

- -

0x0001 -
Minute sync. Set when the decoder has identified a station and -acquired the minute sync pulse.
-

0x0002 -
Second sync. Set when the decoder has acquired the second sync pulse -and within 125 ms of the correct phase.
- -

0x0004 -
Minute unit sync. Set when the decoder has reliably determined the -unit digit of the minute.
- -

0x0008 -
Clock set. Set when the decoder has reliably determined all nine -digits of the timecode and is selectable to discipline the system -clock.
- -
- -

With debugging enabled the driver produces messages in the following -formats: - -

Format wwv8 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. - -

wwv8 port agc ident comp ampl snr epoch jitr offs - -

where port and agc are the audio port and gain, -respectively. The identencodes the station (C for WWV, -H for WWVH) and frequency (2, 5, 10, 15 and 20). For the -encoded frequency, comp is the compare counter, ampl -the pulse amplitude, snr the SNR, epoch the sample -number of the minute pulse in the minute, jitr the change since -the last epoch and offs the minute pulse offset -relative to the second pulse. An example is: - -

wwv8 2 127 C15 2 9247 30.0 18843 -1 1 -
wwv8 2 127 H15 0 134 -2.9 19016 193 174 - -

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. - -

Format wwv3 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. - -

wwv3 ss stat sigl ampl phas snr prob like - -

where ss, stat and sigl are as above, -ampl is the subcarrier amplitude, phas the subcarrier -phase, snr the subcarrier SNR, prob the bit -probability and like the bit likelihood. An example is: - -

wwv3 28 0123 4122 4286 0 24.8 -5545 -1735 - -

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. -

Format wwv4 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. -

wwv4 ss stat sigl radx ckdig mldig diff cnt like snr - -

where ss, stat and sigl are as above, -radx is the digit radix (3, 4, 6, 10), ckdig the -current clock digit, mldig the maximum likelihood digit, -diff the difference between these two digits modulo the radix, -cnt the compare counter, like the digit likelihood and -snr the likelihood ratio. An example is: - -

wwv4 8 010f 5772 10 9 9 0 6 4615 6.1 - -

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. - -

Format wwv2 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. - -

wwv2 ss stat sigl avint avcnt avinc jitr delt freq - -

where ss, stat and sigl are as above, -avint is the averaging interval, avcnt the averaging -interval counter, avinc the interval increment, jitr -the sample change between the beginning and end of the interval, -delt the computed frequency change and freq the -current frequency (PPM). An example is: - -

wwv2 22 030f 5795 256 256 4 0 0.0 66.7 - -

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. - -

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. - -

Monitor Data

- -When enabled by the filegen facility, every received timecode -is written to the clockstats file in the following format: - -
-        sq yy ddd hh:mm:ss.fff ld du lset agc stn rfrq errs freq cons
-
-        s       sync indicator
-        q       quality character
-        yyyy    Gregorian year
-        ddd     day of year
-        hh      hour of day
-        mm      minute of hour
-        fff     millisecond of second
-        l       leap second warning
-        d       DST state
-        dut     DUT sign and magnitude
-        lset    minutes since last set
-        agc     audio gain
-        ident   station identifier and frequency
-        comp    minute sync compare counter
-        errs    bit error counter
-        freq    frequency offset
-        avgt    averaging time
-
- -The fields beginning with year and extending through -dut are decoded from the received data and are in fixed-length -format. The agc and lset fields, as well as the -following driver-dependent fields, are in variable-length format. - -
- -
s -
The sync indicator is initially ? before the clock is set, -but turns to space when all nine digits of the timecode are correctly -set.
- -
q -
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: -
- -
0x8 -
Sync alarm. The decoder may not be in correct second or minute phase -relative to the transmitter.
- -
0x4 -
Error alarm. More than 30 data bit errors occurred in the last -minute.
- -
0x2 -
Symbol alarm. The probability of correct decoding for a digit or -miscellaneous bit has fallen below the threshold.
- -
0x1 -
Decoding alarm. A maximum likelihood digit fails to agree with the -current associated clock digit.
- -
- -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. - -
yyyy ddd hh:mm:ss.fff -
The timecode format itself is self explanatory. Since the driver -latches the on-time epoch directly from the second sync pulse, the -fraction fffis 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.
- -
l -
The leap second warning is normally space, but changes to L -if a leap second is to occur at the end of the month of June or -December.
- -
d -
The DST state is S or D when standard time or -daylight time is in effect, respectively. The state is I or -O when daylight time is about to go into effect or out of -effect, respectively.
-
dut -
The DUT sign and magnitude shows the current UT1 offset relative to -the displayed UTC time, in deciseconds.
- -
lset -
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.
- -
agc -
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. - -
ident -
The station identifier shows the station, C for WWV or -H for WWVH, and frequency being tracked. If neither station is -heard on any frequency, the station identifier shows X.
- -
comp -
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).
- -
errs -
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.
- -
freq -
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.
- -
avgt -
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.
- -
- -

An example timecode is: - -

0 2000 006 22:36:00.000 S +3 1 115 C20 6 5 66.4 1024 - -

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. - -

Modes

- -

The mode keyword of the server 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. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RadioHexDecimalRadioHexDecimal
IC7250x2840IC7810x2638
IC7260x3048R70000x088
IC7350x044R710x1A26
IC7510x1c28R71000x3452
IC7610x1e30R720x3250
IC7650x2c44R85000x4a74
IC7750x4668R90000x2a42
- -

Fudge Factors

- -
- -
time1 time
-
Specifies the propagation delay for WWV (40:40:49.0N 105:02:27.0W), -in seconds and fraction, with default 0.0.dd> - -
time2 time
-
Specifies the propagation delay for WWVH (21:59:26.0N 159:46:00.0W), -in seconds and fraction, with default 0.0. -
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default -0.
- -
refid string
-
Ordinarily, this field specifies the driver reference identifier; -however, the driver sets the reference identifier automatically as -described above. -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
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.
-
flag3 0 | 1
-
Enables audio monitoring of the input signal. For this purpose, the -speaker volume must be set before the driver is started.
- -
flag4 0 | 1
-
Enable verbose clockstats recording if set.
-
-

Additional Information

- -Reference Clock Drivers -
Reference Clock Audio Drivers -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/driver37.htm b/dist/ntp/html/driver37.htm deleted file mode 100644 index 6f6c8b36973b..000000000000 --- a/dist/ntp/html/driver37.htm +++ /dev/null @@ -1,75 +0,0 @@ - - - -Forum Graphic GPS Dating station - - - -

Forum Graphic GPS Dating station

-
- -

Synopsis

- -

Address: 127.127.37.u
-Reference ID: GPS
-Driver ID: GPS
-Parallel Port: /dev/fgclocku -

- -

Description

- -

This driver supports the Forum Graphic GPS Dating station sold by EMR company. - -

Unfortunately sometime FG GPS start continues reporting of the same -date. The only way to fix this problem is GPS power cycling and ntpd -restart after GPS power-up. -

-After Jan,10 2000 my FG GPS unit start send a wrong answer after 10:00am -till 11:00am. It repeat hour value in result string twice. I wroite a small -code to avoid such problem. Unfortunately I have no second FG GPS unit -to evaluate this problem. Please let me know if your GPS has no problems -after Y2K. -

- -

Monitor Data

- -

Each timecode is written to the clockstats file in the format -YYYY YD HH MI SS.

- -

Fudge Factors

- -
-
time1 time
-
Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
time2 time
-
Not used by this driver.
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default 0. -
- -
refid string
-
Specifies the driver reference identifier, an ASCII string from one to -four characters, with default FG.
- -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
Not used by this driver.
- -
flag3 0 | 1
-
Not used by this driver.
- -
flag4 0 | 1
-
Not used by this driver.
-
- -
-
Dmitry Smirnov (das@amt.ru)
- - - diff --git a/dist/ntp/html/driver4.htm b/dist/ntp/html/driver4.htm deleted file mode 100644 index 4f3abd756afe..000000000000 --- a/dist/ntp/html/driver4.htm +++ /dev/null @@ -1,126 +0,0 @@ - -Spectracom 8170 and Netclock/2 WWVB Receivers -

-Spectracom 8170 and Netclock/2 WWVB Receivers -


- -

Synopsis

- -Address: 127.127.4.u -
Reference ID: WWVB -
Driver ID: WWVB_SPEC -
Serial Port: /dev/wwvbu; 9600 baud, 8-bits, no -parity -
Features: tty_clk - -

Description

- -This driver supports all known Spectracom radio and satellite clocks, -including the Model 8170 and Netclock/2 WWVB Synchronized Clocks and the -Netclock/GPS GPS Master Clock. The claimed accuracy of the WWVB clocks -is 100 usec relative to the broadcast signal. These clocks have proven a -reliable source of time, except in some parts of the country with high -levels of conducted RF interference. WIth the GPS clock the claimed -accuracy is 130 ns. 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. - -

The DIPswitches on these clocks should be set to 24-hour display, -AUTO DST off, data format 0 or 2 (see below) and baud rate 9600. If this -clock is used as the source for the IRIG Audio Decoder -(refclock_irig.c in this distribution), set the DIPswitches for -AM IRIG output and IRIG format 1 (IRIG B with signature control). - -

There are two timecode formats used by these clocks. Format 0, which -is available with all clocks, and format 2, which is available with all -clocks except the original (unmodified) Model 8170. - -

Format 0 (22 ASCII printing characters): -
<cr><lf>i ddd hh:mm:ss TZ=zz<cr><lf> - -

on-time = first <cr> -
i = synchronization flag (' ' = in synch, '?' = out synch) -
hh:mm:ss = hours, minutes, seconds - -

The alarm condition is indicated by other than ' ' at i, -which occurs during initial synchronization and when received signal is -lost for about ten hours. - -

Format 2 (24 ASCII printing characters): -
lt;cr>lf>iqyy ddd hh:mm:ss.fff ld - -

on-time = <cr> -
i = synchronization flag (' ' = in synch, '?' = out synch) -
q = quality indicator (' ' = locked, 'A'...'D' = unlocked) -
yy = year (as broadcast) -
ddd = day of year -
hh:mm:ss.fff = hours, minutes, seconds, milliseconds - -

The alarm condition is indicated by other than ' ' at i, -which occurs during initial synchronization and when received signal is -lost for about ten hours. The unlock condition is indicated by other -than ' ' at q. - -

The q is normally ' ' when the time error is less than 1 ms -and a character in the set A...D when the time error is less -than 10, 100, 500 and greater than 500 ms respectively. The l -is normally ' ', but is set to L early in the month of an -upcoming UTC leap second and reset to ' ' on the first day of the -following month. The d is set to S for standard time -S, I on the day preceding a switch to daylight time, -D for daylight time and O on the day preceding a -switch to standard time. The start bit of the first -<cr> is synchronized to the indicated time as returned. - -

This driver does not need to be told which format is in use - it -figures out which one from the length of the message. A three-stage -median filter is used to reduce jitter and provide a dispersion measure. -The driver makes no attempt to correct for the intrinsic jitter of the -radio itself, which is a known problem with the older radios. - -

Monitor Data

- -The driver writes each timecode as received to the clockstats -file. When enabled by the flag4 fudge flag, a table of quality -data maintained internally by the Netclock/2 is retrieved and written to -the clockstats file when the first timecode message of a new -dayis received. - -

Fudge Factors

- -
- -
time1 time
-
Specifies the time offset calibration factor, in seconds and -fraction, -with default 0.0.
- -
time2 time
-
Not used by this driver.
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default -0.
- -
refid string
-
Specifies the driver reference identifier, an ASCII string from one -to four characters, with default WWVB.
- -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
Not used by this driver.
- -
flag3 0 | 1
-
Not used by this driver.
- -
flag4 0 | 1
-
Enable verbose clockstats recording if set.
- -
- -Additional Information - -

Reference Clock Drivers -


David L. Mills (mills@udel.edu)
diff --git a/dist/ntp/html/driver5.htm b/dist/ntp/html/driver5.htm deleted file mode 100644 index edbd0458292b..000000000000 --- a/dist/ntp/html/driver5.htm +++ /dev/null @@ -1,159 +0,0 @@ - - - - - TrueTime GPS/GOES/OMEGA Receivers - - - - -

-TrueTime GPS/GOES/OMEGA Receivers

- -
-

-Synopsis

-Address: 127.127.5.u -
Reference ID: GPS, OMEGA, GOES -
Driver ID: TRUETIME -
Serial Port: /dev/trueu; 9600 baud, 8-bits, no parity -
Features: tty_clk -

-Description

-This driver supports several models models of Kinemetrics/TrueTime timing -receivers, including 468-DC MK III GOES Synchronized Clock, GPS- DC MK -III and GPS/TM-TMD GPS Synchronized Clock, XL-DC (a 151-602-210, reported -by the driver as a GPS/TM-TMD), GPS-800 TCU (an 805-957 with the RS232 -Talker/Listener module), OM-DC OMEGA Synchronized Clock, and very likely -others in the same model family that use the same timecode formats. - -

Most of this code is originally from refclock_wwvb.c with thanks. It -has been so mangled that wwvb is not a recognizable ancestor. -

Timcode format: ADDD:HH:MM:SSQCL
-
-A - control A (this is stripped before we see it)
-Q - Quality indication (see below)
-C - Carriage return
-L - Line feed
-
-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:
-
-                > +/- 5 seconds
-
-                ? +/- 500 milliseconds  # +/- 50 milliseconds
-                * +/- 5 milliseconds    . +/- 1 millisecond
-
-                A-H less than 1 millisecond. Character indicates which
-station
-                is being received as follows: A = Norway, B = Liberia,
-                C = Hawaii, D = North Dakota, E = La Reunion, F =
-Argentina,
-                G = Australia, H = Japan.
-The carriage return start bit begins on 0 seconds and extends to 1 bit -time. - -

Notes on 468-DC and OMEGA receiver: - -

Send the clock a R or C and once per second a timestamp -will appear. Send a R to get the satellite position once (GOES -only). - -

Notes on the 468-DC receiver: - -

Since the old east/west satellite locations are only historical, you -can't set your clock propagation delay settings correctly and still use -automatic mode. The manual says to use a compromise when setting the switches. -This results in significant errors. The solution; use fudge time1 and time2 -to incorporate corrections. If your clock is set for 50 and it should be -58 for using the west and 46 for using the east, use the line - -

fudge 127.127.5.0 time1 +0.008 time2 -0.004 - -

This corrects the 4 milliseconds advance and 8 milliseconds retard needed. -The software will ask the clock which satellite it sees. - -

The PCL720 from PC Labs has an Intel 8253 look-alike, as well as a bunch -of TTL input and output pins, all brought out to the back panel. If you -wire a PPS signal (such as the TTL PPS coming out of a GOES or other Kinemetrics/Truetime -clock) to the 8253's GATE0, and then also wire the 8253's OUT0 to the PCL720's -INPUT3.BIT0, then we can read CTR0 to get the number of microseconds since -the last PPS upward edge, mediated by reading OUT0 to find out if the counter -has wrapped around (this happens if more than 65535us (65ms) elapses between -the PPS event and our being called.) -

-Monitor Data

-When enabled by the flag4 fudge flag, every received timecode -is written as-is to the clockstats file. -

-Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -to be used for the West satellite, with default 0.0.
- -
-time2 time
- -
-. Specifies the time offset calibration factor, in seconds and fraction, -to be used for the East satellite, with default 0.0.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default TRUE.
- -
-flag1 0 | 1
- -
-Silence the clock side of ntpd, just reading the clock without trying to -write to it.
- -
-flag2 0 | 1
- -
-Generate a debug file /tmp/true%d.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/driver6.htm b/dist/ntp/html/driver6.htm deleted file mode 100644 index 1babf4fff5cc..000000000000 --- a/dist/ntp/html/driver6.htm +++ /dev/null @@ -1,242 +0,0 @@ - -IRIG Audio Decoder -

-IRIG Audio Decoder -


- -

Synopsis

- -Address: 127.127.6.u -
Reference ID: IRIG -
Driver ID: IRIG_AUDIO -
Audio Device: /dev/audio and /dev/audioctl - -

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. - -

Description

- -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. - -

This driver incorporates several features in common with other audio -drivers such as described in the Radio CHU Audio -Demodulator/Decoder and the Radio WWV/H Audio -Demodulator/Decoder 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 Reference Clock -Audio Drivers page. - -

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. - -

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. - -

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). - -

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. - -

    - -
  1. The peak carrier amplitude is less than 100 units. This usually -means dead IRIG signal source, broken cable or wrong input port.
  2. - -
  3. The frequency error is greater than ±250 PPM (.025 percent). -This usually means broken codec hardware or wrong codec -configuration.
  4. - -
  5. The modulation index is less than 0.5. This usually means overdriven -IRIG signal or wrong IRIG format.
  6. - -
  7. A frame synchronization error has occurred. This usually means wrong -IRIG signal format or the IRIG signal source has lost synchronization -(signature control).
  8. - -
  9. A data decoding error has occurred. This usually means wrong IRIG -signal format.
  10. - -
  11. 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.
  12. - -
  13. An audio codec error (overrun) occurred. This usually means -insufficient CPU resources, as sometimes happens with Sun SPARC IPCs -when doing something useful.
  14. - -
- -Note that additional checks are done elsewhere in the reference clock -interface routines. - -

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. - -

IRIG-B Timecode Format

-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. - -

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: - -

     Element   CF        Function
-     -------------------------------------
-     55        6         time sync status
-     60-63     10-13     BCD year units
-     65-68     15-18     BCD year tens
-
- -Other devices set these elements to zero. - -

Performance

- -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. - -

The accuracy of the system clock synchronized to the IRIG-B source -with this driver and the ntpd daemon is 10-20 ms 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. - -

Monitor Data

- -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: - -

00 1 98 23 19:26:52 721 143 0.694 47 20 0.083 66.5 -3094572411.00027 - -

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. - -

Fudge Factors

- -
- -
time1 time
-
Specifies the time offset calibration factor, in seconds and -fraction, with default 0.0.
- -
time2 time
-
Not used by this driver.
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default -0.
- -
refid string
-
Specifies the driver reference identifier, an ASCII string from one -to four characters, with default IRIG.
- -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
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.
- -
flag3 0 | 1
-
Enables audio monitoring of the input signal. For this purpose, the -speaker volume must be set before the driver is started.
- -
flag4 0 | 1
-
Enable verbose clockstats recording if set.
-
- -

Additional Information

- -Reference Clock Drivers -
Reference Clock Audio Drivers - -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/driver7.htm b/dist/ntp/html/driver7.htm deleted file mode 100644 index b3fe7129be72..000000000000 --- a/dist/ntp/html/driver7.htm +++ /dev/null @@ -1,596 +0,0 @@ - -Radio CHU Audio Demodulator/Decoder -

-Radio CHU Audio Demodulator/Decoder -


- -

Synopsis

- -Address: 127.127.7.u -
Reference ID: CHU -
Driver ID: CHU -
Modem Port: /dev/chuu; 300 baud, 8-bits, no parity -
Autotune Port: /dev/icom; 1200/9600 baud, 8-bits, no parity -
Audio Device: /dev/audio and /dev/audioctl - -

Description

- -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. - -

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 Pulse-per-second (PPS) Signal -Interfacing 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. - -

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. - -

This driver incorporates several features in common with other audio -drivers such as described in the Radio WWV/H Audio -Demodulator/Decoder and the IRIG Audio -Decoder 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 Reference Clock Audio Drivers -page. - -

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. - -

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. - -

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 yyyy 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 -q 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. - -

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. - -

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 bcnt field shows the number of format A bursts in -the range 1-8. The dist 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 tsmp field shows the number -of timestamps determined in the range 0-60. For a valid timecode, -bcnt must be at least 3, dist must be greater than -bcnt and tsmp must be at least 20. - -

Program Operation

- -

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. - -

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. -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

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. - -

Autotune

- -

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 icom.h header file. - -

Each ICOM radio is assigned a unique 8-bit ID select code, usually -expressed in hex format. To activate the CI-V interface, the -mode keyword of the server 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 mode keyword or a zero argument leaves -the interface disabled. - -

If specified, the driver will attempt to open the device -/dev/icom 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 /dev/icom 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. - -

Radio Broadcast Format

- -

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. - -

Format A bursts are sent at seconds 32 through 39 of the minute in -hex digits - -

6dddhhmmss6dddhhmmss -

The first ten digits encode a frame marker (6) followed by -the day (ddd), hour (hh), minute (mm) and -second (ss). Since format A bursts are sent during the -third decade of seconds the tens digit of ss is always 3. The -driver uses this to determine correct burst synchronization. These -digits are then repeated with the same polarity. -

Format B bursts are sent at second 31 of the minute in hex digits - -

xdyyyyttaaxdyyyyttaa - -

The first ten digits encode a code (x described below) -followed by the DUT1 (d in deciseconds), Gregorian year -(yyyy), difference TAI - UTC (tt) and daylight time -indicator (aa) peculiar to Canada. These digits are then -repeated with inverted polarity. - -

The x is coded - -

- -
1 -
Sign of DUT (0 = +)/dd> - -
2 -
Leap second warning. One second will be added.
- -
4 -
Leap second warning. One second will be subtracted. This is not -likely to happen in our universe.
- -
8 -
Even parity bit for this nibble.
- -
- -

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 fudge time1 variable. - -

Debugging Aids

- -

The most convenient way to track the program status is using the -ntpq program and the clockvar 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 (-d on the ntpd command line)is enabled, -the program produces detailed status messages as it operates. If the -fudge flag 4 is set, these messages are written to the -clockstats file. All messages produced by this driver have the -prefix chu for convenient filtering with the Unix grep -command. - -

With debugging enabled the driver produces messages in the following -formats: - -

A format chuA message is produced for each format A burst -received in seconds 32 through 39 of the minute: - -

chuA n b s code - -

where n is the number of characters in the burst (0-11), -b the burst distance (0-40), s the synchronization -distance (0-40) and code the burst characters as received. Note -that the hex digits in each character are reversed and the last ten -digits inverted, so the burst -

11 40 1091891300ef6e76ecff -

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. - -

A format chuB message is produced for each format B burst -received in second 31 of the minute: - -

chuB n b f s m code - -

where n is the number of characters in the burst (0-11), -b the burst distance (0-40), f the field alignment (- -1, 0, 1), sthe synchronization distance (0-16), mthe -burst number (2-9) and code the burst characters as received. -Note that the hex digits in each character are reversed, so the burst - -

10 38 0 16 9 06851292930685129293 - -

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. - -

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. - -

Monitor Data

- -When enabled by the filegen facility, every received timecode -is written to the clockstats file in the following format: - -
-        sq yy ddd hh:mm:ss.fff ld dut lset agc rfrq bcnt dist tsmp
-
-        s       sync indicator
-        q       quality character
-        yyyy    Gregorian year
-        ddd     day of year
-        hh      hour of day
-        mm      minute of hour
-        ss      second of minute
-        fff     millisecond of second
-        l       leap second warning
-        d       DST state
-        dut     DUT sign and magnitude in deciseconds
-        lset    minutes since last set
-        agc     audio gain (0-255)
-        rfrq    radio frequency
-        bcnt    burst count
-        dist    decoding distance
-        tsmp    timestamps captured
-
- -The fields beginning with year and extending through -dut are decoded from the received data and are in fixed-length -format. The agc and lset fields, as well as the -following driver-dependent fields, are in variable-length format. - -
- -
s -
The sync indicator is initially ? before the clock is set, -but turns to space when the clock is correctly set.
- -
q -
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: - -
-
8 -
Decoder alarm. A majority of repetitions for at least one digit of -the timecode fails to agree. -
- -
4 -
Timestamp alarm. Fewer than 20 timestamps have been determined.
- -
2 -
Format alarm. The majority timecode contains invalid bit -combinations.
- -
1 -
Frame alarm. A framing or format error occurred on at least one -burst during the minute.
- -
- -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. - -
yyyy ddd hh:mm:ss.fff -
The timecode format itself is self explanatory. Note that the -Gregorian year is decoded directly from the transmitted timecode.
-
l -
The leap second warning is normally space, but changes to L -if a leap second is to occur at the end of the month of June or -December.
- -
d -
The DST code for Canada encodes the state for all provinces.
- -
dut -
The DUT sign and magnitude shows the current UT1 offset relative to -the displayed UTC time, in deciseconds.
- -
lset -
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.
- -
agc -
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. - -
rfrq -
The current radio frequency, if the CI-V interface is active, or 'X' -if not.
- -
bcnt -
The number of format A bursts received during the most recent minute -bursts were received.
- -
dist -
The minimum decoding distance determined during the most recent -minute bursts were received.
- -
tsmp -
The number of timestamps determined during the most recent -minute bursts were received.
-
- -

Modes

- -

The mode keyword of the server 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. - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RadioHexDecimalRadioHexDecimal
IC7250x2840IC7810x2638
IC7260x3048R70000x088
IC7350x044R710x1A26
IC7510x1c28R71000x3452
IC7610x1e30R720x3250
IC7650x2c44R85000x4a74
IC7750x4668R90000x2a42
- -

Fudge Factors

- -
- -
time1 time
-
Specifies the propagation delay for CHU (45:18N 75:45N), in seconds -and fraction, with default 0.0.
- -
time2 time
-
Not used by this driver.
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default -0.
- -
refid string
-
Specifies the driver reference identifier, an ASCII string from one -to four characters, with default CHU.
- -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
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.
- -
flag3 0 | 1
-
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.
- -
flag4 0 | 1
-
Enable verbose clockstats recording if set.
- -
- -

Additional Information

-Reference Clock Drivers -
Reference Clock Audio Drivers - -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/driver8.htm b/dist/ntp/html/driver8.htm deleted file mode 100644 index 702768848b88..000000000000 --- a/dist/ntp/html/driver8.htm +++ /dev/null @@ -1,334 +0,0 @@ - -Generic Reference Driver -

-Generic Reference Driver -


- -

Synopsis

- -Address: 127.127.8.u -
Reference ID: PARSE -
Driver ID: GENERIC -
Serial Port: /dev/refclock-u; TTY mode according to -clock type - -

Description

- -The timecode of these receivers is sampled via a STREAMS module in the -kernel (The STREAMS module has been designed for use with SUN Systems -under SunOS 4.1.x or Solaris 2.3 - 2.6. It can be linked directly into -the kernel or loaded via the loadable driver mechanism). This STREAMS -module can be adapted to be able to convert different time code formats. -If the daemon is compiled without the STREAM definition synchronization -will work without the Sun streams module, though accuracy is -significantly degraded. This feature allows to use PARSE also on non Sun -machines. - -

The actual receiver status is mapped into various synchronization -states generally used by receivers. The STREAMS module is configured to -interpret the time codes of DCF C51, PZF535, PZF509, GPS166, Trimble SV6 -GPS, ELV DCF7000, Schmid, Wharton 400A and low cost receivers (see list -below). - -

The reference clock support in ntp contains the necessary -configuration tables for those receivers. In addition to supporting -several different clock types and 4 devices, the generation a a PPS -signal is also provided as an configuration option. The PPS -configuration option uses the receiver generated time stamps for feeding -the PPS loopfilter control for much finer clock synchronization. - -

CAUTION: The PPS configuration option is different from the hardware -PPS signal, which is also supported (see below), as it controls the way -ntpd is synchronized to the reference clock, while the hardware PPS -signal controls the way time offsets are determined. - -

The use of the PPS option requires receivers with an accuracy of -better than 1ms. - -

Fudge factors - -

Only two fudge factors are utilized. The time1 fudge factor defines -the phase offset of the synchronization character to the actual time. On -the availability of PPS information the time2 fudge factor defines the -skew between the PPS time stamp and the receiver timestamp of the PPS -signal. This parameter is usually zero, as usually the PPS signal is -believed in time and OS delays should be corrected in the machine -specific section of the kernel driver. time2 needs only be set when the -actual PPS signal is delayed for some reason. The flag1 enables input -filtering. This a median filter with continuous sampling. The flag2 -selects averaging of the samples remaining after the filtering. Leap -second-handling is controlled with the flag3. When set a leap second -will be deleted on receipt of a leap second indication from the -receiver. Otherwise the leap second will be added, (which is the -default). flag3 should never be set. PPS handling is enabled by adding -128 to the mode parameter in the server/peer command. - -

ntpq (8) -

timecode variable - -

The ntpq program can read clock variables command list several -variables. -These hold the following information: refclock_time is the local time -with -the offset to UTC (format HHMM). The currently active receiver flags are -listed in refclock_status. Additional feature flags of the receiver are -optionally listed in parentheses. The actual time code is listed in -timecode. -A qualification of the decoded time code format is following in -refclock_format. The last piece of information is the overall running -time and the accumulated times for the clock event states in -refclock_states. When PPS information is present additional variable are -available. refclock_ppstime lists then the PPS timestamp and -refclock_ppsskew lists the difference between RS232 -derived timestamp and the PPS timestamp. - -

Currently, eighteen clock types (devices /dev/refclock-0 - -/dev/refclock-3) are supported by the PARSE driver. -
A note on the implementations: -

  • These implementations where mainly done WITHOUT -actual access to the hardware. Thus not all implementations provide full -support. The development was done with the help of many souls who had -the hardware and where so kind to borrow me their time an patience -during the development and debugging cycle. Thus for continued support -and quality direct access to the receivers is a big help. Nevertheless i -am not prepared to buy these reference clocks - donations to me -(kardel@acm.org) are welcome as -long as they work within Europe 8-). - -

    Verified implementations are: -

      -
    • -RAWDCF variants - -

      These variants are tested for the decoding with my own homegrown -receivers. Interfacing with specific commercial products may involve -some fiddeling with cables. Especially commericial RAWDCF receivers have -a seemingly unlimited number of ways to draw power from the RS232 port -and to encode the DCF77 datastream. You are mainly on your own here -unless i have a sample of the receiver. -

    • -Meinberg clocks - -

      These implementations are verified by the Meinberg people themselves -and i have access to one of these clocks.

    -
-The pictures below refer to the respective clock and where taken from -the vendors web pages. They are linked to the respective vendors. -
    -
  • -server 127.127.8.0-3 mode 0 - -

    Meinberg PZF535/PZF509 receiver (FM -demodulation/TCXO / 50us) -
    -

  • -server 127.127.8.0-3 mode 1 - -

    Meinberg PZF535/PZF509 -receiver (FM demodulation/OCXO / 50us) -
    -

  • -server 127.127.8.0-3 mode 2 - -

    Meinberg DCF U/A -31/DCF C51 receiver -(AM demodulation / 4ms) -
    -

  • -server 127.127.8.0-3 mode 3 - -

    ELV DCF7000 (sloppy AM -demodulation -/ 50ms) -
    -

  • -server 127.127.8.0-3 mode 4 - -

    Walter Schmid DCF receiver Kit (AM demodulation / -1ms) -
    -

  • -server 127.127.8.0-3 mode 5 - -

    RAW DCF77 100/200ms pulses (Conrad DCF77 receiver module / -5ms) -
    -

  • -server 127.127.8.0-3 mode 6 - -

    RAW DCF77 100/200ms pulses (TimeBrick DCF77 receiver module -/ 5ms) -
    -

  • -server 127.127.8.0-3 mode 7 - -

    Meinberg GPS166/GPS167 -receiver (GPS / <<1us) -
    -

  • -server 127.127.8.0-3 mode 8 -

    IGEL clock -
    -

  • -server 127.127.8.0-3 mode 9 - -

    Trimble SVeeSix -GPS receiverTAIP protocol (GPS / <<1us) -
    -

  • -server 127.127.8.0-3 mode 10 - -

    Trimble SVeeSix -GPS receiver TSIP protocol (GPS / <<1us) (no kernel support -yet) -
    -

  • -server 127.127.8.0-3 mode 11 - -

    Radiocode Clocks Ltd RCC 8000 Intelligent Off-Air Master -Clock -support -
    -

  • -server 127.127.8.0-3 mode 12 - -

    HOPF Funkuhr -6021 -
    -

  • -server 127.127.8.0-3 mode 13 - -

    Diem's Computime Radio Clock -
    -

  • -server 127.127.8.0-3 mode 14 - -

    RAWDCF receiver (DTR=high/RTS=low) - -

  • -server 127.127.8.0-3 mode 15 - -

    WHARTON 400A Series Clocks with a 404.2 Serial -Interface -

  • -server 127.127.8.0-3 mode 16 - -

    RAWDCF receiver (DTR=low/RTS=high) - -

  • -server 127.127.8.0-3 mode 17 - -

    VARITEXT Receiver (MSF) - -

-

-Actual data formats and set-up requirements of the various clocks can be -found in NTP PARSE clock data formats. - -

The reference clock support carefully monitors the state transitions -of the receiver. All state changes and exceptional events such as loss -of time code transmission are logged via the syslog facility. Every hour -a summary of the accumulated times for the clock states is listed via -syslog. - -

PPS support is only available when the receiver is completely -synchronized. The receiver is believed to deliver correct time for an -additional period of time after losing synchronizations, unless a -disruption in time code transmission is detected (possible power loss). -The trust period is dependent on the receiver oscillator and thus a -function of clock type. This is one of the parameters in the clockinfo -field of the reference clock implementation. This parameter cannot be -configured by ntpdc. - -

In addition to the PPS loopfilter control a true PPS hardware signal -can be applied on Sun Sparc stations via the CPU serial ports on the CD -pin. This signal is automatically detected and will be used for offset -calculation. The input signal must be the time mark for the following -time code. (The edge sensitivity can be selected - look into the -appropriate kernel/parsestreams.c for details). Meinberg receivers can -be connected by feeding the PPS pulse of the receiver via a 1488 level -converter to Pin 8 (CD) of a Sun serial zs-port. To select PPS support -the STREAMS driver for PARSE must be loaded and the mode parameter ist -the mode value of above plus 128. If 128 is not added to the mode value -PPS will be detected to be available but it will not be used. For PPS to -be used you MUST add 128 to the mode parameter. - -

For the Meinberg GPS166/GPS167 receiver is also a special firmware -release available (Uni-Erlangen). This release should be used for proper -operation. - -

The raw DCF77 pulses can be fed via a level converter directly into -Pin 3 (Rx) of the Sun. The telegrams will be decoded an used for -synchronization. AM DCF77 receivers are running as low as $25. The -accuracy is dependent on the receiver and is somewhere between 2ms -(expensive) to 10ms (cheap). Upon bad signal reception of DCF77 -synchronizations will cease as no backup oscillator is available as -usually found in other reference clock receivers. So it is important to -have a good place for the DCF77 antenna. For transmitter shutdowns you -are out of luck unless you have other NTP servers with alternate time -sources available. - -

Monitor Data

- -Clock states statistics are written hourly the the syslog service. -Online information can be found by examining the clock variable via the -ntpq cv command. - -

Fudge Factors

- -
- -
time1 time
-
Specifies the time offset calibration factor, in seconds and -fraction, with default depending on clock type.
- -
time2 time
-
Specifies the offset if the PPS signal to the actual time. (PPS fine -tuning).
- -
stratum number
-
Specifies the driver stratum, in decimal from 0 to 15, with default -0.
- -
refid string
-
Specifies the driver reference identifier, an ASCII string from one -to four characters, with default according to current clock type.
- -
flag1 0 | 1
-
Not used by this driver.
- -
flag2 0 | 1
-
Not used by this driver.
- -
flag3 0 | 1
-
delete next leap second instead of adding it.
- -
-flag4 0 | 1
-
Delete next leap second instead of adding it - flag will be re- -defined soon - so don't use it. Statistics are provided by more common -means (syslog, clock variable via ntpq)
- -
- -

Making your own PARSE clocks

- -The parse clock mechanismis deviated from the way other ntp reference -clocks work. For a short description how to build parse reference clocks -see making PARSE clocks - -

Additional Information - -

Reference Clock Drivers - -


Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/driver9.htm b/dist/ntp/html/driver9.htm deleted file mode 100644 index d35e587358a9..000000000000 --- a/dist/ntp/html/driver9.htm +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Magnavox MX4200 GPS Receiver - - - -

Magnavox MX4200 GPS Receiver

- -
-

Synopsis

-Address: 127.127.9.u -
Reference ID: GPS -
Driver ID: GPS_MX4200 -
Serial Port: /dev/gpsu; 4800 baud, 8-bits, no parity -
Features: ppsclock (required) - -

Description

-This driver supports the Magnavox MX4200 Navigation Receiver adapted to -precision timing applications. It requires the ppsclock line -discipline or streams module described in the Line -Disciplines and Streams Modules page. It also requires a gadget box and 1-PPS level converter, such as -described in the Pulse-per-second (PPS) Signal -Interfacing page. - -

This driver supports all compatible receivers such as the 6-channel -MX4200, MX4200D, and the 12-channel MX9212, MX9012R, MX9112. - -

-Leica Geosystems acquired -the Magnavox commercial GPS technology business in February of 1994. -They now market and support former Magnavox GPS products such as the -MX4200 and its successors.

- -

- -

Operating Modes

-This driver supports two modes of operation, static and mobile, controlled -by clock flag 2. - -

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. 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. - -

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. - -

Monitor Data

-The driver writes each timecode as received to the clockstats -file. Documentation for the NMEA-0183 proprietary -sentences produced by the MX4200 can be found in -MX4200 Receiver Data Format. - -

Fudge Factors

- -
-
-time1 time
- -
-Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.
- -
-time2 time
- -
-Not used by this driver.
- -
-stratum number
- -
-Specifies the driver stratum, in decimal from 0 to 15, with default 0.
- -
-refid string
- -
-Specifies the driver reference identifier, an ASCII string from one to -four characters, with default GPS.
- -
-flag1 0 | 1
- -
-Not used by this driver.
- -
-flag2 0 | 1
- -
-Assume GPS receiver is on a mobile platform if set.
- -
-flag3 0 | 1
- -
-Not used by this driver.
- -
-flag4 0 | 1
- -
-Not used by this driver.
-
-Additional Information - -

Reference Clock Drivers  -


-
-David L. Mills (mills@udel.edu)
- - - diff --git a/dist/ntp/html/exec.htm b/dist/ntp/html/exec.htm deleted file mode 100644 index 2371870859f0..000000000000 --- a/dist/ntp/html/exec.htm +++ /dev/null @@ -1,284 +0,0 @@ - -Executive Summary - Computer Network Time Synchronization -

-Executive Summary - Computer Network Time Synchronization -

- -

Introduction

- -

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. - -

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.) - -

Protocol Design Issues

- -

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 timestamp 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. - -

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 subnet, 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. -

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. - -

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. - -

Computer Clock Modelling and Error Analysis

- -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 tick 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 tick. Typical Unix system kernels -provide a programmable mechanism to increase or decrease the value of -tick by a small, fixed amount in order to amortize a given time -adjustment smoothly over multiple tick intervals. - -

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 - -

T(t) = T(t0) + -R(t - t0) + 1/2 D(t - -T0)2,
- -

where t is the current time, T is the time offset at -the last measurement update t0, R is the -frequency offset and D 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. - -

The synchronization protocol estimates T(t0) -(and R(t0), where relevant) at regular -intervals t and adjusts the clock to minimize -T(t) in future. In common cases, R 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 T and R 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. - -

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. - -

Correctness Principles

- -

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. - -

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. - -

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 truechimers and the others assumed incorrect -falsetickers. Only the truechimers are used to adjust the -system -clock. - -

Data Grooming Algorithms

- -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. -

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. - -

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. - -

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. - -

Further Reading

- -
    - -

  1. Cristian, F. Probabilistic clock synchronization. In Distributed -Computing 3, Springer Verlag, 1989, 146-158.
  2. - -

  3. Digital Time Service Functional Specification Version T.1.0.5. -DigitalEquipment Corporation, 1989.
  4. - -

  5. 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).
  6. - -

  7. Kopetz, H., and W. Ochsenreiter. Clock synchronization in -distributed real-time systems. IEEE Trans. Computers C-36, 8 (August -1987), 933-939.
  8. - -

  9. Lamport, L., and P.M. Melliar-Smith. Synchronizing clocks in the -presence of faults. JACM 32, 1 (January 1985), 52-78.
  10. - -

  11. Marzullo, K., and S. Owicki. Maintaining the time in a -distributed system. ACM Operating Systems Review 19, 3 (July 1985), 44- -54.
  12. - -

  13. 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.
  14. -

  15. Mills, D.L. Modelling and analysis of computer network clocks. -Electrical Engineering Department Report 92-5-2, University of Delaware, -May 1992, 29 pp.
  16. - -

  17. NIST Time and Frequency Dissemination Services. NBS Special -Publication432 (Revised 1990), National Institute of Science and -Technology, U.S. Department of Commerce, 1990.
  18. - -

  19. Schneider, F.B. A paradigm for reliable clock synchronization. -Department of Computer Science Technical Report TR 86-735, Cornell -University, February 1986.
  20. - -

  21. Srikanth, T.K., and S. Toueg. Optimal clock synchronization. JACM -34, 3 (July 1987), 626-645.
  22. - -

  23. 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.
  24. - -
- -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/extern.htm b/dist/ntp/html/extern.htm deleted file mode 100644 index f3b265a66aa2..000000000000 --- a/dist/ntp/html/extern.htm +++ /dev/null @@ -1,40 +0,0 @@ - -External Clock Discipline and the Local Clock Driver -

-External Clock Discipline and the Local Clock Driver -


- -

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. - -

When external clocks are used in conjunction with NTP service, some way needs to be provided for the external clock driver and NTP daemon ntpd 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. - -

Control and monitoring functions for the external clock and driver are implemented using the Local Clock (type 1) driver and the ntp_adjtime() 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, ntpd 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 ntpd; 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. - -

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: - -

ntp__enable. set/reset by enable command. enables ntp clock discipline - -

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. - - -

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. - -

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/ - -


Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/gadget.htm b/dist/ntp/html/gadget.htm deleted file mode 100644 index 7361de8a4ee4..000000000000 --- a/dist/ntp/html/gadget.htm +++ /dev/null @@ -1,107 +0,0 @@ - -Gadget Box PPS Level Converter and CHU Modem -

-Gadget Box PPS Level Converter and CHU Modem -

- -

Introduction

- -

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 gadget.tar.Z, or by -anonymous FTP from ftp.udel.edu in the pub/ntp directory. - -

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 tty_clk and chu_tty line disciplines in -the ntp3 distribution. - -

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. - -

Circuit Description

- -

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. - -

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. - -

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. - -

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. - -

Files - -

Following is a list of files included in this archive. All files are -in PostScript, except the README and -gadget.lst files, which are in ASCII. The files -gadget.s01, gadget.s02 and gadget.lst were -generated using the Schema schematic-capture program from Omation. The -printed-circuit files *.lpr were generated using Schema- -PCB, also from Omation. - -

Files - -

README - helpful information -
gadget.s01 - circuit schematic -
gadget.s02 - minibox assembly drawing -
gadget.lst - net list, pin list, parts list, etc. -
gen0102.lpr - pcb x-ray diagram -
art01.lpr - pcb artword side 1 -
art02.lpr - pcb artwork side 2 -
adt0127.lpr - pcb assembly drawing -
dd0124.lpr - pcb drill drawing -
sm0228.lpr - pcb solder mask (side 2) -
sst0126.lpr - pcb silkscreen mask (side 1) - -


Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/genkeys.htm b/dist/ntp/html/genkeys.htm deleted file mode 100644 index 563e52a574cb..000000000000 --- a/dist/ntp/html/genkeys.htm +++ /dev/null @@ -1,152 +0,0 @@ - -<tt>ntp_genkeys</tt> - generate public and private keys -

-ntp_genkeys - generate public and private keys -


- -

Synopsis

- -ntp_genkeys - -

Description

- -

The cryptographic values used by the autokey scheme are -incorporated as a set of four files generated by the -ntp_genkeys program, including 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, and -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. - -

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 ntpq and ntpdc -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 ntp_genkeys 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 privatekey 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 -publickey 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. 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. - -

The file formats begin with two lines, the first containing the -generating system DNS name and the second the 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. If necessary, this file can be further customized by an ordinary -text editor. The format is described in the following section. 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. - -

Private Key File Format

- -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). ntpd reads its keys from a file specified using the --k command line option or the keys 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. - -

The key file uses the same comment conventions as the configuration -file. Key entries use a fixed format of the form - -

keyno type key - -

where keyno is a positive integer, -type is a single character which defines the key format, -and key is the key itself. - -

The key may be given in one of three different formats, controlled by -the type character. The three key types, and -corresponding formats, are listed following. -

- -
S
-
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 0101010101010101.
- -
N
-
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 8080808080808080.
- -
A
-
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.
- -
M
-
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.
- -
- -

Note that the keys used by the ntpq and ntpdc -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. - -

Files

- -The RSA Laboratories package rsaref20 of cryptographic routines -is necessary in order to build and use this program. - -

Bugs

- -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. - -
Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/hints.htm b/dist/ntp/html/hints.htm deleted file mode 100644 index 772f6f880edd..000000000000 --- a/dist/ntp/html/hints.htm +++ /dev/null @@ -1,26 +0,0 @@ - -Hints and Kinks -

-Hints and Kinks -


- -

This is an index for a set of troubleshooting notes contained in -individual text files in the ./hints directory. They were -supplied by various volunteers in the form of mail messages, patches or -just plain word of mouth. Each note applies to a specific computer and -operating system and gives information found useful in setting up the -NTP distribution or site configuration. The notes are very informal and -subject to errors; no attempt has been made to verify the accuracy of -the information contained in them. - -

Additions or corrections to this list or the information contained in -the notes is solicited. The most useful submissions include the name of -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 here for a directory listing. - -


Home
David L. Mills <mills@udel.edu> -
diff --git a/dist/ntp/html/hints/a-ux b/dist/ntp/html/hints/a-ux deleted file mode 100644 index f8c26d2188b6..000000000000 --- a/dist/ntp/html/hints/a-ux +++ /dev/null @@ -1,195 +0,0 @@ -------------- -INTRODUCTION: -------------- -Last revision: 06-Jul-1994 - -Included in this distribution of XNTP V3 is a configuration file suitable -for use under Apple's A/UX Version 3.x.x There is also one for A/UX 2.0.1 -but it has not been fully tested. To make the executables follow the steps -outlined below. - -*** NOTE: You must have gcc installed to successfully compile the current -distribution; the native cc supplied with A/UX will NOT correctly compile -this source. See the FAQ in comp.unix.aux for places to obtain gcc from -and how to install it. - ----------------------- -MAKING XNTPD FOR A/UX: ----------------------- - -First, you need to create the makefiles (after you've downloaded the -source, of course): - - % make clean - % make refconf - -After that, you should edit Config.local to make sure that BINDIR is -correct for where you wish the programs to be "installed". The default -(and what I use) is /usr/local/etc. Make sure that DEFS_LOCAL and -CLOCKDEFS are commented out! Presently, only the LOCAL_CLOCK/REFCLOCK -clock is used and supported. - - -After this is done (you should be told that your system is A/UX 3), make -'xntpd' (the options to 'gcc' are held in compilers/aux3.gcc): - - % make - -I do not normally use the `make install' option and so have not verified its -compatibility with A/UX. Rather, I pull out each of the executables and -place them in the locally appropriate locations. - ---------------- -STARTING XNTPD: ---------------- - -At this point you need to set things up so that 'xntpd' is started upon -boot-up. You can do this in 1 of 2 ways: either add entries in /etc/inittab -or, more ideally, create and use an /etc/rc.local file. Since rc.local is -what I recommend, here's how you do it: - -By default, A/UX doesn't have rc.local, so you'll need to add the following to -/etc/inittab: - - net6:2:wait:/etc/syslogd # set to "wait" to run a syslog daemon -+ jmj0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1 # Local stuff - dbg2::wait:/etc/telinit v # turn off init's verbose mode - -Now, the look of a sample /etc/rc.local is as follows: - - #!/bin/sh - : - : rc.local - : - # @(#)Copyright Apple Computer 1987 Version 1.17 of rc.sh on 91/11/08 15:56:21 (ATT 1.12) - - - # Push line discipline/set the device so it will print - /etc/line_sane 1 - echo " " - echo "Entering rc.local..." - - set `/bin/who -r` - if [ "$7" = 2 ] - then - /bin/echo " now setting the time..." - /usr/local/etc/ntpdate -s -b - sleep 5 - # - # start up 'xntpd' if we want - # - if [ -f /etc/ntp.conf ] - then - /bin/echo " setting tick and tickadj..." - /usr/local/etc/tickadj -t 16672 -a 54 - sleep 5 - /bin/echo " starting xntpd..." - /usr/local/etc/xntpd <&- > /dev/null 2>&1 - sleep 5 - fi - # - fi - - echo "Leaving rc.local..." - -There are a few things to notice about the above: - - o When run, 'ntpdate' forces your clock to the time returned by the - host(s) specified by (you'll need to replace this - be the IP address(es) of your timehosts. This is good since it gets - things close to start off with. You can use more than one time - server. - - o 'tickadj' is also called. This does two things: changes the - default value of 'tick' (which the the amount of time, in ms, that - is added to the clock every 1/60 seconds) and changes the value - of 'tickadj' which the the amount that is added or subtracted - from 'tickadj' when adjtime() is called. - - Now Mac clocks are pretty bad and tend to be slow. Sooo, instead of - having A/UX add the default of 16666ms every 1/60th of a second, you - may want it to add more (or less) so that it keeps better time. The - above value works for me but your "best" value may be different and - will likely require some fooling around to find the best value. As a - general rule of thumb, if you see 'xntpd' make a lot of negative clock - adjustments, then your clock is fast and you'll need to _decrease_ - the value of 'tick'. If your adjustments are positive, then you need - to increase 'tick'. To make a guess on how fast/slow your clock is, - use 'ntpdate' to sync your clock. Now watch 'xntpd' and see how it - operates. If, for example, it resets your clock by 1 second every 30 - minutes, then your clock is (1/(30*60)) is about 0.056% off and you'll - need to adjust 'tick' by 16666*0.00056 or about 9 (i.e. 'tick' should - be ~16675 if slow or ~16657 if fast) - - A/UX's default value of 'tickadj' is 1666 which is too big for - 'xntpd'... so it also needs to be adjusted. I like using larger - values then the recommended value of 9 for 'tickadj' (although not - anything near as big as 1666) since this allows for quick slews - when adjusting the clock. Even with semi-large values of 'tickadj' - (~200), getting 5ms (1/200 s) accuracy is easy. - - -Finally, before A/UX and 'xntpd' will work happily together, you need to -patch the kernel. This is due to the fact that A/UX attempts to keep the -UNIX-software clock and the Mac-hardware clock in sync. Neither the h/w or -the s/w clock are too accurate. Also, 'xntpd' will be attempting to adjust -the software clock as well, so having A/UX muck around with it is asking -for headaches. What you therefore need to do is tell the kernel _not_ to -sync the s/w clock with the h/w one. This is done using 'adb'. The -following is a shell script that will do the patch for you: - - #! /bin/sh - adb -w /unix < -Newsgroups: comp.protocols.time.ntp -to: mills@udel.edu -return-receipt-to: rocky@panix.com -Subject: time and AIX 3.2.5 raw tty bug - -This posting isn't strictly about NTP, any program that may stop the -clock or set the clock backwards is subject to the AIX 3.2.5 bug. - -On AIX 3.2.5, there is a bug in the tty driver for a raw device which -may crash the box under certain conditions: basically a read() on a -raw tty in effect, a character was read but not as many as specified -by VMIN when a read timeout occurred. VTIME specifies the timeout. See -the AIX manual page on termios.h or that include file. for Information -on VMIN (or MIN) VTIME (or TIME). - -A remedy other than to not use raw tty's is to apply patch U435110. - -Details of the problem report follow. - -> ABSTRACT: -> IX43779: TRAP IN PSX_TIMEO -> -> ORIGINATING DETAILS: -> Stacktrace shows: -> IAR: 01460214 posixdd:psx_timeo + 8bf4: ti 4,r12,0x0 -> *LR: 014601a0 posixdd:psx_timeo + 8b80 -> 00212c60: 014604f4 posixdd:psx_timer + 8ed4 -> 00212cc0: 0144b74c ttydd:tty_do_offlevel + 4284 -> 00212d20: 000216fc .i_offlevel + 8c -> 00212d70: 00021d78 .i_softint + c8 -> 00001004: 00008714 .finish_interrupt + 80 -> -> RESPONDER SUMMARY: -> AIX asserted in psx_timeo(). Reason for the assert was that -> the current time was behind psx_ctime. Since this state -> can occur when the current time is changed after a character -> is received but before the VTIME interbyte timer pops, we -> should not assert on this. -> -> RESPONDER CONCLUSION: -> Removed the requirement that current time > psx_ctime by -> adding a new L_ntimersub macro that is used instead of the -> ntimersub macro in time.h. Also added a test for (current -> time - psx_ctime) being negative, in that case we do not -> adjust the new timeout. -> -> Reported to Correct a PTF in Error: NO -> Reported as a Highly pervasive problem: NO -> -> PE Apar?: NoPE -> Hiper Apar?: NoHiper -> Status: CLOSED PER -> Component Name: AIX V3 FOR RS/6 -> Version: 320 -> Component ID: 575603001 -> Submitted: 94/05/03 -> Closed: 94/05/05 -> ChangeTeam: TX2527 -> -> APAR FIXED BY: U431696 U432151 U432844 U432870 U432979 -> U433049 U433081 U433459 U433876 U433906 U434598 U434453 -> U434672 U434737 U435110 - diff --git a/dist/ntp/html/hints/bsdi b/dist/ntp/html/hints/bsdi deleted file mode 100644 index 3b8bc386efea..000000000000 --- a/dist/ntp/html/hints/bsdi +++ /dev/null @@ -1,65 +0,0 @@ -hints/bsdi - -Author: Bdale Garbee, bdale@gag.com -Last revision: 27Oct94 (Paul Vixie) - -Included in this distribution of XNTP is a configuration file suitable -for use with BSDI's BSD/OS 1.1 (formerly BSD/386 1.1). On this system, -the "cc" command is GCC 1.4x rather than PCC or GCC 2.x. It is imperative -that "cc" be used since it predefines the symbol __bsdi__; if you want to -use another compiler you will need to add -D__bsdi__ to catch the various -#ifdef's required for this system. - -The Kinemetrics/Truetime GPS-TM/TMD driver is known to work on this system. -The GPS-805 and GOES should also work fine. Hell, they should all work fine -but it's hard to test very many locally. - -Due to BNR2's strict interpretation of POSIX and XNTP's use of SIGIO, BSD/OS -can only handle one refclock per daemon. We're working this out with the -system architects. - -The config file is machine/bsdi, and the following steps should be all that -are required to install and use the bits. - -Note that you will need GNU sed; the version supplied with BSD/OS 1.1 loops -endlessly during "make refconf". Likewise you should get GNU make, which -the instructions below assume that you have put in /usr/local/bin/gnumake. - -To build the software: - - rm -f Config.local - gnumake refconf - gnumake MAKE=gnumake - -To install the software: - - gnumake install - - This will place all of the executables in /usr/local/etc. The config - file is expected to be /usr/local/etc/xntp.conf and the key file for - the optional authentication is /etc/ntp.keys. - - Craft a config file and a key file, and put them in the right places. - There is information on how to do this elsewhere in the documentation, - the only thing I'll mention is that I put the drift file in - /var/log/ntp.drift, and the authdelay on my 486DX/50 system is - 0.000064. Your mileage will vary, learn to use the authspeed tools - if you're going to authenticate. - - In the file /etc/rc.local, make sure that the invocation of ntpd is - commented out, and add an invocation of xntpd. Here's what I'm using: - - echo -n 'starting local daemons:' - - if [ -f /etc/ntp.keys -a -f /usr/local/etc/xntp.conf ]; then - echo -n ' xntpd'; /usr/local/etc/xntpd - fi - - #XXX# echo -n ' ntpd'; /usr/libexec/ntpd -t - -At this point, you should be good to go. Try running /usr/local/etc/xntpd and -using ntpq or xntpdc to see if things are working, then pay attention the next -time you reboot to make sure that xntpd is being invoked, and use ntpq or -xntpdc again to make sure all is well. - -Enjoy! diff --git a/dist/ntp/html/hints/changes b/dist/ntp/html/hints/changes deleted file mode 100644 index 177e562b6dc6..000000000000 --- a/dist/ntp/html/hints/changes +++ /dev/null @@ -1,13 +0,0 @@ -Ulrich Windl (xntpd/refclock_parse.c): - - Added support to supply power from RS232 with CLOCK_RAWDCF. - Known to work with Linux 1.2. - - Made Linux ignore parity errors with CLOCK_RAWDCF. - -Ulrich Windl (parse/util/dcfd.c): - - Removed conflicting prototype for Linux (sscanf) - - Corrected spelling error - - Made Linux ignore parity errors. - - Added support to supply power from RS232 with CLOCK_RAWDCF. - -Ulrich Windl (parse/util/testdcf.c): - - Made Linux ignore parity errors. diff --git a/dist/ntp/html/hints/decosf1 b/dist/ntp/html/hints/decosf1 deleted file mode 100644 index bc4ce0bb294d..000000000000 --- a/dist/ntp/html/hints/decosf1 +++ /dev/null @@ -1,40 +0,0 @@ -Some major changes were necessary to make xntp v3 run on the DEC Alpha -hardware running DEC OSF/1. All "long" and "u_long" declarations and -casts in the code were changed to "LONG" and "U_LONG" and a new header -file (include/ntp_types.h) was added. The new header file defines -LONG as int and U_LONG as u_int for the Alpha hardware and as long -and u_long for anything else. A couple of #ifs where changed in -ntpq and xntpdc to get the result of a signal defined correctly. The -Config.decosf1 file built the programs here with no problems. - -I don't have a radio clock here, so none of that code has been tested. -I have run xntpd, xntpdc, xntpres, ntpq, ntpdate, and tickadj under -DEC OSF/1 v1.2-2 (BL10). - -Mike Iglesias Internet: iglesias@draco.acs.uci.edu -University of California, Irvine BITNET: iglesias@uci -Office of Academic Computing uucp: ...!ucbvax!ucivax!iglesias -Distributed Computing Support phone: (714) 856-6926 - -Support for NTP Version 2 is included with the current OSF/1 release. If -you are upgrading to NTP Version 3 with this distribution, you should not -use the xntpd or ntpq programs that come with the OSF/1 release. The -older programs should be replaced by the newer programs of the same name, -either in situ or via a link to a tranquil spot like /usr/local/bin. The -make install script in the this distribution don't work due to a silly -install program incompatibility, so you will need to copy the programs by -hand. - -Don't use the setup utility to install or configure the xntpd installation, -as it will cheerfully clobber your painstakingly crafted ntp.conf program. -However, assuming you put this file in /etc/ntp.conf, you can use the -/sbin/init.d/xntpd script to start and stop the daemon. - -This distribution compiles with nominal mumur with the stock cc compiler -that comes with OSF/1. - -Dave Mills -Electrical Engineering Department -Unibergisty of Delabunch -mills@udel.edu - diff --git a/dist/ntp/html/hints/decosf2 b/dist/ntp/html/hints/decosf2 deleted file mode 100644 index e4a8828cc508..000000000000 --- a/dist/ntp/html/hints/decosf2 +++ /dev/null @@ -1,54 +0,0 @@ -Problems with DEC OSF/1 V2.0 - -Compilation using gcc fails with ntp_config.c. The problem is an apparent -error in the /usr/include/sys/procset.h and /usr/include/sys/wait.h -include files. - -cowbird:/usr/include/sys# diff -c wait.h.orig wait.h -*** wait.h.orig Tue Feb 22 02:41:38 1994 ---- wait.h Thu Aug 25 14:52:57 1994 -*************** -*** 298,304 **** - #else - - _BEGIN_CPLUSPLUS -! extern int waitid(idtype_t, id_t, siginfo_t *, int); - _END_CPLUSPLUS - #endif /* _NO_PROTO */ - ---- 298,304 ---- - #else - - _BEGIN_CPLUSPLUS -! extern int waitid(idtype_t, pid_t, siginfo_t *, int); - _END_CPLUSPLUS - #endif /* _NO_PROTO */ - -cowbird:/usr/include/sys# diff -c procset.h.orig procset.h -*** procset.h.orig Tue Feb 22 02:41:44 1994 ---- procset.h Thu Aug 25 14:43:52 1994 -*************** -*** 86,95 **** - */ - - idtype_t p_lidtype; /* The id type for the left set. */ -! id_t p_lid; /* The id for the left set. */ - - idtype_t p_ridtype; /* The id type of for right set. */ -! id_t p_rid; /* The id of the right set. */ - } procset_t; - - ---- 86,95 ---- - */ - - idtype_t p_lidtype; /* The id type for the left set. */ -! pid_t p_lid; /* The id for the left set. */ - - idtype_t p_ridtype; /* The id type of for right set. */ -! pid_t p_rid; /* The id of the right set. */ - } procset_t; - -Also, if using gcc from the freeware disk, either replace syscall.h -in the directory /usr/local/lib/gcc-lib/alpha-dec-osf1/2.3.3/include -or replace with a link to /usr/include/sys/syscall.h. diff --git a/dist/ntp/html/hints/freebsd b/dist/ntp/html/hints/freebsd deleted file mode 100644 index ef847328bb3d..000000000000 --- a/dist/ntp/html/hints/freebsd +++ /dev/null @@ -1,15 +0,0 @@ -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/dist/ntp/html/hints/hpux b/dist/ntp/html/hints/hpux deleted file mode 100644 index 1640d057a350..000000000000 --- a/dist/ntp/html/hints/hpux +++ /dev/null @@ -1,158 +0,0 @@ -Last update: Sun Mar 13 15:05:31 PST 1994 - -This file hopefully describes the whatever and however of how to get xntp -running on hpux 7.0 and later s300. s400, s700, and s800. - -First off, all the standard disclaimers hold here ... HP doesn't have anthing -to do with this stuff. I fool with it in my spare time because we use it and -because I like to. We just happen to have a lot of HP machines around here :-) -Xntpd has been in use here for several years and has a fair amount of mileage -on various HP platforms within the company. I can't really guarantee bug fixes -but I'd certainly like to hear about bugs and I won't hestitate to look at -any fixes sent to me. - -Now lets talk OS. If you don't have 7.0 or later, pretty much hang it up now. -This stuff has run here on pretty much everything from 8.0 upward on s300, -s700, and s800. It is known to run on 7.0 s300/s400 but all reports are -from the field and not my personal experience. - -If you are lucky enough to have a s300 or s400 with 9.03, then you no longer -have to worry about adjtimed as HP-UX now has adjtime(2). The rest of you -will have to wait on 10.0 which will have adjtime(2) and a supported though -a bit older version of xntpd. - -Next, let me explain a bit about how this stuff works on HP-UX's that do not -have adjtime(2). The directory adjtime contains libadjtime.a and the adjtimed -daemon. Instead of the adjtime(2) system call, we use a library routine to -talk to adjtimed thru message queues. Adjtimed munges into /dev/kmem and -causes the clock to skew properly as needed. PLEASE NOTE that the adjtime -code provided here is NOT a general replacement for adjtime(2) ... use of -this adjtime(3)/adjtimed(8) other than with xntpd may yield very odd results. - -What to do to get this stuff running ? - - * If you are running an OS less than 10.0 or do not have a s300/s400 - with 9.03 or better - -> cd machines - -> vi hpux - -> (change -DSYS_HPUX=? to match whatever you are running [7,8,9]) - -> cd .. - - * Say "make makeconfig" - - * Say "make", sit back for a few minutes. - - * cd authstuff - * Say "./authcert < certdata" and check the output. Every line should - end with "OK" ... if not, we got trouble. - * Now try "./authspeed auth.samplekeys". What we want to - remember here is the "authentication delay in CPU time" - * cd .. - - * Say "make install" - - * I'd suggest reading the xntp docs about now :-) ... seriously !! - - * One thing I have added to this version of xntpd is a way to select - config files if you are sharing /usr/local thru NFS or whatever. - If the file /usr/local/etc/xntp.conf happens to be a directory, the - files in that directory are searched until a match is found. The - rules for a match are: - - 1. Our hostname - 2. default. (as in default.375 or default.850) - 3. default - - * Ok, make sure adjtimed is running (just start it up for now with - "/usr/local/etc/adjtimed"). Using -z as an option will get you - a usage message. - - * Now start up xntpd and watch it work. - - * Make sure that adjtimed gets started at boot right before xntpd. - We do this in /etc/netbsdsrc. They must both run as root !! - -Possible problems ? - - * On some 320's and 835's we have had to run adjtimed with "-p 45" or - so to get rid of syslog messages about "last adjust did not finish". - - * At 9.0, there is a problem with DIAGMON (patch available from the - response center) which causes it to delete the message queue that - adjtimed/xntpd use to communicate. (see next note for result) - - * Xntpd has been known to get really ticked off when adjtime() fails - which is usually only while running the emulation code on HP-UX. - When it gets mad, it usually jumps the clock into never never land. - Possible reasons for this are adjtimed being killed or just never - started or adjtimed being completely swapped out on a really busy - machine (newer adjtimed try to lock themselves in memory to prevent - this one). - -Anything else ... just drop me a line at ken@sdd.hp.com - -Received: from louie.udel.edu by huey.udel.edu id aa14418; 15 Jun 95 9:19 EDT -Received: from host5.colby.edu (host-05.colby.edu) by host-04.colby.edu with ESMTP (1.37.109.15/Colby 1.1) - id AA165442355; Thu, 15 Jun 1995 09:19:16 -0400 -Received: by host5.colby.edu (1.37.109.15/Colby 1.1) - id AA056252339; Thu, 15 Jun 1995 09:18:59 -0400 -Date: Thu, 15 Jun 1995 09:18:59 -0400 (EDT) -From: "Jeff A. Earickson" -To: Mills@huey.udel.edu -Subject: More minor bugs in xntp3.4s -In-Reply-To: <9506150022.aa12727@huey.udel.edu> -Message-Id: -Mime-Version: 1.0 -Content-Type: TEXT/PLAIN; charset=US-ASCII - -Dave, - After reading the hpux hints file, I realized I didn't install or -start adjtimed. In the course of doing this, I discovered that: - ---> $(TOP) is not defined in adjtime/Makefile, so "make install" can't - find the install.sh script. - ---> "make install" from the main Makefile never goes into the adjtime - directory, so I added the following two lines into the install - target of the main Makefile: - - @echo installing from adjtime - @cd adjtime && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" install - -This twiddle may not be right for all systems, but it got adjtimed -installed for me. - - You might also want to add to the hpux hints file that one way to -fire things up at boot time is to add the following lines to the localrc -function of /etc/rc: - - #---daemons for Network Time Protocol (version 3.4s) - #---note that adjtimed is only needed for HP-UX 9.X, not 10.0 - #---adjtimed must be running or xntpd won't work right... - if [ -x /usr/local/bin/adjtimed ]; then - /usr/local/bin/adjtimed -r & echo -n ' adjtimed' - if [ -x /usr/local/bin/xntpd ]; then - /usr/local/bin/xntpd & echo -n ' xntpd' - fi - fi - -I discovered that the "-r" option of adjtimed is needed to clear out any -trash from a previous execution of it. Otherwise adjtimed quietly dies -and leaves xntpd in the lurch... - -Thanks for the help. - -** Jeff A. Earickson, Ph.D PHONE: 207-872-3659 -** Senior UNIX Sysadmin, Information Technology EMAIL: jaearick@colby.edu -** Colby College, 4214 Mayflower Hill, FAX: 207-872-3555 -** Waterville ME, 04901-8842 - -On Thu, 15 Jun 1995 Mills@huey.udel.edu wrote: - -> Jeff, -> -> Read the hpux file in the hints directory. -> -> Dave -> - diff --git a/dist/ntp/html/hints/linux b/dist/ntp/html/hints/linux deleted file mode 100644 index b06a36a63465..000000000000 --- a/dist/ntp/html/hints/linux +++ /dev/null @@ -1,5 +0,0 @@ -The kernel PLL interface is broken, I know. -Update RSN. - - Torsten - (duwe@informatik.uni-erlangen.de) diff --git a/dist/ntp/html/hints/notes-xntp-v3 b/dist/ntp/html/hints/notes-xntp-v3 deleted file mode 100644 index ba027f2105fe..000000000000 --- a/dist/ntp/html/hints/notes-xntp-v3 +++ /dev/null @@ -1,119 +0,0 @@ -Notes for NTP Version 3 - -This version operates in much the same manner as Version 2 with the -following changes and additions: - -1. The protocol machinery operates in conformance with the RFC1305 NTP - Version 3 specification. The most visible characteristic of this - version is that the poll intervals for all polls, even selected - ones, is significantly increased. This is especially desirable when - serving a large client population. This implementation supports - previous versions as non-configured peers; for version-2 configured - peers a "version 2" keyword should be included on the "peer" line. - -2. The configuration file has a new keyword: statfile , where - is the name of a statistics file." When present, each clock - update generates an entry of the form: - - . - - where is the modified Julian day, . is the time of - day, is the peer address and is the peer status. - The , and are the measured offset, delay and - dispersion, respectively, of the peer clock relative to the local - clock. About once per day the current file is closed and a new one - created with names ., where starts at one and - increments for each new generation. - -3. A number of additional platforms are supported. See ./Config file - for details. - -4. A driver for the TrueTime 468DC GOES Synchronized Clock is - included. This driver (refclock_goes.c) should also work for other - TrueTime radio clocks, since all use the same format. - -5. A replacement driver for the Spectracom 8170 WWVB Synchronized - Clock is included. This driver (refclock_wwvb.c) (a) does not - require a 1-pulse-per-second signal, (b) supports both format 0 - (original 8170) and format 2 (Netclock/2 and upgraded 8170), (c) - can be connected to more than one computer and (d) automatically - compensates for all serial baud rates. - -6. A driver for the German time/frequency station DCF77 is included. - This requires a special STREAMS module. - -7. In Version 2 special line-discipline modules were required for the - CHU and WWVB drivers. This code continues to work in Version 3, - although it is no longer needed for the WWVB driver. However, this - code does not work under STREAMS, as used in SunOS 4.1.1. - Equivalent STREAMS modules are supplied with Version 3. - -8. Support for an external 1-pulse-per-second (pps) signal is - provided. The signal is connected to a serial port (see - xntpd/ntp_loopfilter.c for details). When present the leading edge - of the pulse establishes the on-time epoch within an interval - established by the selected radio clock or other NTP time server. - Use of the pps is indicated when the tattletale displayed by ntpq - changes from "*" to "o". - -9. The clock-selection and poll-update procedures have been modified - slightly in order to achieve better performance on high speed LANs - with compromise in performance on typical WANs. - -10. In order to comply with U.S. Commerce Department regulations, the DES - encryption routine lib/authdes.c cannot be exported. For exportable - versions of this distribution a DES-encrypted version of this routine - lib/authdes.c.des is included along with an unencrypted version - lib/authdes.c.export, which allows normal operation, but without the - NTP authentication feature. Further information is available in the - lib/authdes.c.export file. - -11. As an alternative to the DES-based authentication mechanism, an - implementation of the RSA Message Digest 5 algorithm is provided. - (see applicable copyright information in the library files). - -12. A driver for the Magnavox MX4200 GPS clock. - -13. A STREAMS module which captures carrier-detect data-lead transitions to - connect a precision source of 1-pps, yet avoid the ugly overhead in the - usual STREAMS processing. See the ppsclock subdirectory. - -14. Support for the Apple A/UX operating system and enhanced support for the - Hewlet-Packard HP/UX operating system. See the various README and Config - files for further information. - -See the COPYRIGHT file for authors and copyright information. Note that some -modules in this distribution contain copyright information that supersedes -the copyright information in that file. - -If I missed something or neglected to give due credit, please advise. - -David L. Mills -University of Delaware -31 May 1992, amended 23 July 1992, 25 October 1992 - -Bugs and notes - -A bug in the original tty_clk_STREAMS.c module has been fixed. - -The poll-interval randomization feature of poll_update (in -xntpd/ntp_proto.c) has been extended to apply when the poll interval is -increased, as well as reduced. This spreads the update messages in time -and helps avoid unpleasant bursts of messages. - -In the clock_select algorithm the peers selected for combining are -limited to those survivors at the lowest stratum, not the entire list. -This helps avoid whiplash when large numbers of peers are at the same -stratum. - -The number formerly displayed by ntpq as "compliance" is now the time -constant of integration. - -The DNS resolver xntpd/ntp_intres.c is now integrated into xntpd, making -configuration of multiple hosts easier. - -System and peer event are now written to the system log at priority -LOG_INFO. - -The leap-second code was fixed to avoid broadcasting leap warnings on -all except the last day of June and December. diff --git a/dist/ntp/html/hints/parse b/dist/ntp/html/hints/parse deleted file mode 100644 index d2523515e839..000000000000 --- a/dist/ntp/html/hints/parse +++ /dev/null @@ -1,105 +0,0 @@ -Compilation: - Usual thing: rm -f Config.local ; make for vanilla - make refconf for reference clock (e. g. DCF77) - -Directory contents: - - hints/PARSE - this file - - xntpd/refclock_parse.c - - reference clock support for DCF77/GPS in xntp - parse/parse.c - - Reference clock data parser framework - parse/parse_conf.c - - parser configuration (clock types) - parse/clk_meinberg.c - - Meinberg clock formats (DCF U/A 31, PZF 535, GPS166) - parse/clk_schmid.c - - Schmid receiver (DCF77) - parse/clk_rawdcf.c - - 100/200ms pulses via 50 Baud line (DCF77) - parse/clk_dcf7000.c - - ELV DCF7000 (DCF77) - parse/clk_trimble.c - - Trimble SV6 GPS receiver - - If you want to add new clock types please check - with kardel@informatik.uni-erlangen.de. These files - implement the conversion of RS232 data streams into - timing information used by refclock_parse.c which is - mostly generic except for NTP configuration constants. - - parse/Makefile.kernel - - *SIMPLE* makefile to build a loadable STREAMS - module for SunOS 4.x / SunOS 5.x systems - - parse/parsestreams.c - - SUN Streams module (loadable) for radio clocks - This streams module is designed for SunOS 4.1.X. - - parse/parsesolaris.c - - SUN Streams module (loadable) for radio clocks. - This streams module is designed for SunOS 5.x - Beware this is still new - so it might crash - your machine (we have seen it working, though). - - parse/parsetest.c - - simple test program for STREAMS module. Its so simple, - that it doesn't even set TTY-modes, thus they got to - be correct on startup - works for Meinberg receivers - - parse/testdcf.c - - test program for raw DCF77 (100/200ms pulses) - receivers - - include/parse.h - interface to "parse" module and more - include/parse_conf.h - - interface to "parse" configuration - - include/sys/parsestreams.h - - STREAMS specific definitions - - scripts/support - - scripts (perl & sh) for statistics and rc startup - the startup scripts are used in Erlangen for - starting the daemon on a variety of Suns and HPs - and for Reference Clock startup on Suns - These scripts may or may not be helpful to you. - -Supported clocks: - Meinberg DCF U/A 31 - Meinberg PZF535/TCXO (Software revision PZFUERL 4.6) - Meinberg PZF535/OCXO (Software revision PZFUERL 4.6) - Meinberg GPS166 (Software version for Uni-Erlangen) - ELV DCF7000 (not recommended - casual/emergency use only) - Conrad DCF77 receiver (email: time@informatik.uni-erlangen.de) - + level converter - TimeBrick (email: time@informatik.uni-erlangen.de) - Schmid Receiver Kit - Trimble SV6 GPS receiver - -Addresses: - Meinberg Funkuhren - Auf der Landwehr 22 - 31812 Bad Pyrmont - Germany - Tel.: 05281/20 18 - FAX: 05281/60 81 80 - - ELV Kundenservice - Postfach 1000 - 26787 Leer - Germany - Tel.: 0491/60 08 88 - - Walter Schmidt - Eichwisrain 14 - 8634 Hombrechtikon - Switzerland - -If you have problems mail to: - - time@informatik.uni-erlangen.de - -We'll help (conditions permitting) - diff --git a/dist/ntp/html/hints/refclocks b/dist/ntp/html/hints/refclocks deleted file mode 100644 index 17e76434a307..000000000000 --- a/dist/ntp/html/hints/refclocks +++ /dev/null @@ -1,35 +0,0 @@ -This is a short overview for the reference clocks currently supported -by xntp V3. (Ultimate wisdom can be obtained from xntpd/refclock_*.c -this file was derived from that information - unfortunately some comments -in the files tend to get stale - so use with caution) - -Refclock address Type -127.127.0.x no clock (fails to configure) -127.127.1.x local clock - use local clock as reference -127.127.2.x no clock (fails to configure) -127.127.3.x PSTI 1010/1020 WWV Clock -127.127.4.x SPECTRACOM WWVB receiver 8170 and Netclock/2 -127.127.5.x Kinimetric Truetime 468-DC GOES receiver -127.127.6.x IRIG audio decode (Sun & modified BSD audio driver) -127.127.7.x CHU Timecode (via normal receiver & Bell 103 modem) -127.127.8.x PARSE (generic driver for a bunch of DCF/GPS clocks - can be extended for other clocks too) - 8.0-3 Meinberg PZF535/TCXO - 8.4-7 Meinberg PZF535/OCXO - 8.8-11 Meinberg DCF U/A 31 - 8.12-15 ELV DCF7000 - 8.16-19 Walter Schmid DCF receiver (Kit) - 8.20-23 Conrad DCF77 receiver module + level converter (Kit) - 8.24-27 TimeBrick (limited availability ask - time@informatik.uni-erlangen.de) - 8.28-31 Meinberg GPS166 - 8.32-35 Trimble SV6 GPS receiver -127.127.9.x MX4200 GPS receiver -127.127.10.x Austron 2201A GPS Timing Receiver -127.127.11.x Kinemetrics Truetime OM-DC OMEGA Receiver -127.127.12.x KSI/Odetecs TPRO-S IRIG-B / TPRO-SAT GPS -127.127.13.x Leitch: CSD 5300 Master Clock System Driver -127.127.14.x MSFEES -127/127.15.x TrueTime GPS/TM-TMD -127.127.16.x Bancomm GPS/IRIG Ticktock -127.127.17.x Datum Programmable Time System diff --git a/dist/ntp/html/hints/rs6000 b/dist/ntp/html/hints/rs6000 deleted file mode 100644 index 8561ac29b1b0..000000000000 --- a/dist/ntp/html/hints/rs6000 +++ /dev/null @@ -1,56 +0,0 @@ -15.7.1993 -xntp3 compiles now again on AIX. I have disabled prototyping and added -the switch -D_NO_PROTO which disables prototyping in the system include -files. - -Matthias Ernst maer@nmr.lpc.ethz.ch --------------------------------------------------------------------------------- -Xntp version 3 now support the cc compiler for AIX. -The Config.aix will now use cc by default. You can still compile xntp -with the bsd compiler by changing "COMP= cc" to "COMP= bsdcc" and -and removing the "-DSTUPID_SIGNAL" option from the "DEFS" option. - -xntp and tickadj was also modified so that the value of tickadj is read -form the kernel and can be set by tickadj. For now I would not set -tickadj below 40 us. - -Bill Jones -jones@chpc.utexas.edu -------------------------------------------------------------------------------- - -This is a modified version of xntp version 3 for the RS6000. It works for -AIX 3.2 and these are the same changes as have been applied tothe version 2 -implementation of xntp. It works fine for us but I have not tested all of -the features, especially the local clock support for the RS6000 is not tested -at all. - -Matthias Ernst, ETH-Zuerich, Switzerland - maer@nmr.lpc.ethz.ch - --------------------------------------------------------------------------------- - -Here the original README.rs6000 for the version 2 implementation: - -A hacked version of xntp for the IBM RS/6000 under AIX 3.1 can be found -in xntp.rs6000.tar.Z. [ if still available at all - Frank Kardel 93/12/3 ] - -This will not work on older versions of AIX due to a kernel bug; to find -out whether you have the kernel bug, compile and run testrs6000.c (see -comments in the code for instructions). - -xntp and testrs6000 require "bsdcc" to compile. This is simply another -entry point into the xlc compiler with various options set for BSD -compatibility. If your system does not have bsdcc, do the following: - -link /bin/bsdcc to /bin/xlc - -put the following into /etc/xlc.cfg: - -* BSD compatibility -bsdcc: use = DEFLT - crt = /lib/crt0.o - mcrt = /lib/mcrt0.o - gcrt = /lib/gcrt0.o - libraries = -lbsd, -lc - proflibs = -L/lib/profiled,-L/usr/lib/profiled - options = -H512,-T512, -qlanglvl=extended, -qnoro, -D_BSD, -D_NONSTD_TYPES, -D_NO_PROTO, -tp,-B/lib/ - diff --git a/dist/ntp/html/hints/sco.htm b/dist/ntp/html/hints/sco.htm deleted file mode 100644 index 2273faa7a436..000000000000 --- a/dist/ntp/html/hints/sco.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - SCO Unix hints - - -

SCO Unix hints

- -

Older SCO Unix versions

-

- NTP 4.0.x does not run on SCO Unix prior to version 3.2.5.0.0. If you - need NTP on an older SCO Unix system and don't mind to modify your - kernel, use 3.5.91 which has patches for SCO Unix 3.2.4.x. Apply the - kernel modifications as described in - XNTP on SCO - 3.2.4.2. - -

Compiling NTP

-

- Delete the old SCO supplied NTP programs using the "custom" - utility. Run the NTP configure program with CFLAGS="-b elf -K - processor-type" for best results. - -

Running NTP

-

- Run "tickadj -As" after every reboot to set the variables - "clock_drift" and "track_rtc" to the right values. -

- Run "ntpd" with a high negative nice-value, i.e. - "nice --19 ntpd" for best results. - -

More information

-

- More information on the way SCO Unix and NTP interact can be found in - NTP on SCO Unix, - which includes links to precompiled versions of NTP. -

- Kees Hendrikse, January 1999 - - diff --git a/dist/ntp/html/hints/sgi b/dist/ntp/html/hints/sgi deleted file mode 100644 index 5e4f7de6d597..000000000000 --- a/dist/ntp/html/hints/sgi +++ /dev/null @@ -1,74 +0,0 @@ -adjtime, tick and tickadj: --------------------------- - -The SGI value for HZ is 100 under Irix 4, with the system clock running -in nominal mode (ftimer off), so the value for tick is 10000 usec. -Tickadj is a bit more tricky because of the behaviour of adjtime(), -which seems to try to perform the correction over 100-200 seconds, with -a rate limit of 0.04 secs/sec for large corrections. Corrections of -less than 0.017 seconds generally complete in less than a second, -however. - -Some measured rates are as follows: - - Delta Rate (sec/sec) - - > 1 0.04 - 0.75 0.04 - 0.6 0.004 - 0.5 0.004 - 0.4 0.0026 - 0.3 0.0026 - 0.2 0.0013 - 0.1 0.0015 - 0.05 0.0015 - 0.02 0.0003 - 0.01 0.015 -Strange. Anyway, since adjtime will complete adjustments of less than -17msec in less than a second, whether the fast clock is on or off, I -have used a value of 150usec/tick for the tickadj value. - -Fast clock: ------------ - -I get smoother timekeeping if I turn on the fast clock, thereby making -the clock tick at 1kHz rather than 100Hz. With the fast clock off, I -see a sawtooth clock offset with an amplitude of 5msec. With it on, -the amplitude drops to 0.5msec (surprise!). This may be a consequence -of having a local reference clock which spits out the time at exactly -one-second intervals - I am probably seeing sampling aliasing between -that and the machine clock. This may all be irrelevant for machines -without a local reference clock. Fiddling with the fast clock doesn't -seem to compromise the above choices for tick and tickadj. - -I use the "ftimer" program to switch the fast clock on when the system -goes into multiuser mode, but you can set the "fastclock" flag in -/usr/sysgen/master.d/kernel to have it on by default. See ftimer(1). - -timetrim: ---------- - -Irix has a kernel variable called timetrim which adjusts the system -time increment, effectively trimming the clock frequency. Xntpd could -use this rather than adjtime() to do it's frequency trimming, but I -haven't the time to explore this. There is a utility program, -"timetrim", in the util directory which allows manipulation of the -timetrim value in both SGI and xntpd native units. You can fiddle with -default timetrim value in /usr/sysgen/master.d/kernel, but I think -that's ugly. I just use xntpd to figure out the right value for -timetrim for a particular CPU and then set it using "timetrim" when -going to multiuser mode. - -Serial I/O latency: -------------------- - -If you use a local clock on an RS-232 line, look into the kernel -configuration stuff with regard to improving the input latency (check -out /usr/sysgen/master.d/[sduart|cdsio]). I have a Kinemetrics OM-DC -hooked onto /dev/ttyd2 (the second CPU board RS-232 port) on an SGI -Crimson, and setting the duart_rsrv_duration flag to 0 improves things -a bit. - - -12 Jan 93 -Steve Clift, CSIRO Marine Labs, Hobart, Australia (clift@ml.csiro.au) diff --git a/dist/ntp/html/hints/solaris-dosynctodr.html b/dist/ntp/html/hints/solaris-dosynctodr.html deleted file mode 100644 index d6b97a9c1f0c..000000000000 --- a/dist/ntp/html/hints/solaris-dosynctodr.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - -Symptoms and Resolutions Article 19195 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Home * Buy * My Sun(sm)sun.com Global Sections
- - - - Sun Microsystems
- - - - - - - - - - - - - - - - - - -
Search SunSolve

-
- -Advanced Search
- -Product Search
- -Search Tips
- -
sopkoEdit
-
Contents Of SunSolve
- - - - - - - - -All Public Patches
- -Submit a Service Order
- -Diagnostic Tools
- -Support Docs.
- -Y2K Central
- -Security Information
-
-
  - -

------
- - Marked Docs.
- - Notifications
- - Low Graphics
- - SunSolve Servers
- - About SunSolve
- - Contact Us
- - Site Map
- - Articles
- - Home
- - Help
-
- - - -

-
-
- - - - - - - - - - - -
-
-[ Printer Friendly Page ] -[ Was this document useful? Yes or No ]
Notify if Document Changes ] -[ Mark Document for Download ]
View/Edit Notifications ] -[ View/Edit Marked Documents ]

- - -
Jump to
- - - - - - - - - - - - - -
SRDB ID Synopsis Date
19195 Upgraded to 2.6, using xntpd, but the system clock is drifting. Worked fine 4 Sep 1999

- - -
Problem DescriptionTop
-
Ever since upgrading to Solaris 2.6, the system clock has been drifting and
-there are messages like 'synchronisation lost', 'Previous time adjustment
-didn''t complete' and 'time reset (step)' a lot in the /var/adm/messages 
-file. The system either was previously working fine with the freeware
-xntpd or the configuration was copied from another system that was 
-using the freeware version.
--- 23-Apr-99 08:22 US/Eastern --
- -
Problem SolutionTop
-
The common lore for setting up xntpd on Solaris using
-the freeware version included the warning to set the 
-kernel variable dosynctodr to 0 in the /etc/system 
-file thus: set dosynctodr=0
-
-When using NTP on Solaris 2.6 or later, the kernel 
-variable MUST be left at the default value of 1. Prior 
-to 2.6 this variable controlled whether or not to rein  
-in the softclock using the hardware clock, with the result 
-that NTP and the hardware clock would fight for control of 
-the soft clock; thus before 2.6 you had to set dosynctodr 
-to 0. At 2.6, every system call that adjusts the softclock 
-also sets the hard clock, thus while NTP controls the soft 
-clock, the hard clock is also controlled. Setting 
-dosynctodr to 0 reverts the behavior back to the pre 2.6 
-defaulkt behavior, having exactly the opposite effect 
-as that intended.
-
-Do not set dosynctodr to 0.
- - - - - - - - - - -
Product AreaBundled Network
ProductNTP
OSSolaris 2.6
HardwareUltra 2
Document Contentwith freeware xntpd.

-
Top

-
- - - - - - - - - -
  -
-
- -
-
- - [ Edit Account ] - [ Patches ] - [ Submit a Service Order ]
- [ Diagnostic Tools ] - [ Support Docs. ] - [ Y2K Central ] - [ Security Information ]
- [ SunSolve Servers ] - [ About SunSolve ] - [ Contact Us ] - [ Site Map ] - [ Articles ] - [ Home ] - [ Help ] -
-
- - - -My Sun -Home -Buy - - - - -Java Technologies -Products and Solutions -Support, Education, and Consulting -Technology and Research -For Developers -Corporate Information - - - - - -SunSolve Online(tm) - - - - - -
-
- -
-Copyright 1994-1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA. -
-All rights reserved. -Legal Terms. -Privacy Policy. -
-
- - - -
- - - - diff --git a/dist/ntp/html/hints/solaris.html b/dist/ntp/html/hints/solaris.html deleted file mode 100644 index 64b361a14326..000000000000 --- a/dist/ntp/html/hints/solaris.html +++ /dev/null @@ -1,143 +0,0 @@ - - -Solaris hints and kinks - - -Information on compiling and executing ntpd under Solaris. -
-Last Updated: Sun Jun 21 01:32:18 EDT 1998, -John Hawkinson, - <jhawk@MIT.EDU> -

-If you're not running Solaris 2.5.1 or later, it is likely -that you will have problems; upgrading would be a really good plan. -

-

All Solaris versions

-

- We have a report that says starting with Solaris 2.6 we should leave - dosynctodr alone. - Here is the report. -

-Proper operation of ntp under Solaris may require setting the kernel -variable dosynctodr to zero (meaning "do not synchronize the clock -to the hardware time-of-day clock"). This can be done with the -tickadj utility: -

-tickadj -s -
-If you prefer, it can also be done with the native Solaris kernel debugger: -
-echo dosynctodr/W0 | adb -k -w /dev/ksyms /dev/mem -
-

-Or, it can also be set by adding a line to /etc/system: -

-set dosynctodr = 0 -
-

-Instead of the tick kernel variable, which many operating -systems use to control microseconds added to the system time every -clock tick (c.f. Dealing -with Frequency Tolerance Violations), Solaris has the variables -nsec_per_tick and usec_per_tick. -

-nsec_per_tick and usec_per_tick control the number of -nanoseconds and microseconds, respectively, added to the system clock -each clock interrupt. Enterprising souls may set these based on -information collected by ntpd in the /etc/ntp.drift file -to correct for individual hardware variations. -

-On UltraSPARC systems, nsec_per_tick and usec_per_tick -are ignored in favor of the cpu_tick_freq variable, which -should be automatically be determined by the PROM in an accurate -fashion. -

-In general, the same ntp binaries should not be used across multiple -operating system releases. There is enough variation in the core operating -system support for timekeeping that a rebuild of ntpd for the idiosyncracies -of your specific operating system version is advisable. -

-It is recommended that ntp be started via a script like this one, installed in -/etc/init.d/ntpd with a symbol link from -/etc/rc2.d/S99ntpd. - -

Solaris 2.6

-

-Solaris 2.6 adds support for kernel PLL timekeeping, but breaks this -support in such a fashion that using it worse than not. This is SUN Bug ID 4095849, and it is not yet -fixed as of June 1998. -

-

Solaris 2.5 and 2.5.1

-

-On UltraSPARC systems, calculation of cpu_tick_freq is broken -such that values that are off by significant amounts may be used -instead. This unfortunately means that ntpd may have severe problems -keeping synchronization. This is SUN Bug ID -4023118. Bryan Cantrill of Sun -posted patchfreq, a workaround script, -to comp.protocols.time.ntp in March of 1997. -

-


-

OLD DATA

-I can't vouch for the accuracy the information below this -rule. It may be significantly dated or incorrect. -

-

-

Solaris 2.2

-

-Solaris 2.2 and later contain completely re-written clock code to -provide high resolution microsecond timers. A benefit of the -re-written clock code is that adjtime does not round off its -adjustments, so ntp does not have to compensate for this -rounding. Under Solaris 2.2 and later, ntp #define's -ADJTIME_IS_ACCURATE, and does not look for the tickadj -kernel variable. -

-

Solaris 2.1

-(This originally written by William L. Jones <jones@chpc.utexas.edu>) -

-Solaris 2.1 contains fairly traditional clock code, with tick -and tickadj. -

-Since settimeofday under Solaris 2.1 only sets the seconds part of timeval -care must be used in starting xntpd. I suggest the following start -up script: -

-tickadj -s -a 1000 -
ntpdate -v server1 server2 -
sleep 20 -
ntpdate -v server1 server2 -
sleep 20 -
tickadj -a 200 -
xntpd -
- -The first tickadj turns of the time of day clock and sets the tick -adjust value to 1 millisecond. This will insure that an adjtime value -of at most 2 seconds will complete in 20 seconds. -

-The first ntpdate will set the time to within two seconds -using settimeofday or it will adjust time using adjtime. -

-The first sleep insures the adjtime has completed for the first ntpdate. -

-The second ntpdate will use adjtime to set the time of day since the -clock should be within 2 seconds of the correct time. -

-The second tickadj set the tick adjust system value to 5 microseconds. -

-The second sleeps insure that adjtime will complete before starting -the next xntpd. -

-I tried running with a tickadj of 5 microseconds with out much success. -200 microseconds seems to work well. -

-


-Prior versions of this file had major text contributed by: - -
  • Denny Gentry <denny@eng.sun.com> -
  • - - diff --git a/dist/ntp/html/hints/solaris.xtra.4023118 b/dist/ntp/html/hints/solaris.xtra.4023118 deleted file mode 100644 index 84c5d15214b2..000000000000 --- a/dist/ntp/html/hints/solaris.xtra.4023118 +++ /dev/null @@ -1,36 +0,0 @@ - Bug Id: 4023118 - Category: kernel - Subcategory: other - State: integrated - Synopsis: sun4u doesn't keep accurate time - Description: - -[ bmc, 12/20/96 ] - -The clock on a sun4u drifts unacceptably. On a typical 143 mHz Ultra, -the clock took 1.0001350 seconds to count 1 second. While this may seem -trivial, it adds up quickly. In this case, the TOD chip will have to -pull the clock forward by 2 seconds every 4 hours and 7 minutes. -This drift rate is so high, that the clock is close to being too broken -for NTP to guarantee correctness (in order for NTP's mechanism to work, -it must be assured that the local clock drifts no more than 20 ms in 64 -seconds; this particular 143 mHz Ultra will drift by nearly 9 ms in that -period). This problem has been reproduced on virtually all sun4u -classes. - -The fundamental problem lies in the kernel's perception of ticks per -second. The PROM is responsible for determining this figure exactly, -and the kernel extracts it into the variable cpu_tick_freq. On sun4u's, -this number is disconcertingly round: 143000000, 167000000, 248000000, -etc. Indeed, a simple experiment revealed that these numbers were -quite far from the actual ticks per second. Typical was the 143 mHz -Ultra which was discovered to tick around 142,980,806 (+/- 10) times -per second. - - Work around: - - Integrated in releases: s297_27 - Duplicate of: - Patch id: - See also: - Summary: diff --git a/dist/ntp/html/hints/solaris.xtra.4095849 b/dist/ntp/html/hints/solaris.xtra.4095849 deleted file mode 100644 index 8d3ce8074cfd..000000000000 --- a/dist/ntp/html/hints/solaris.xtra.4095849 +++ /dev/null @@ -1,74 +0,0 @@ - Bug Id: 4095849 - Category: kernel - Subcategory: syscall - State: evaluated - Synopsis: time_constant value >6 with PLL in use leads to integer divide - zero trap panic - Description: -If the time_constant parameter is 7 or higher, and the phase-lock looping model -is in use, the system will take a "integer divide zero trap" panic in -the clock routine as soon as the time_offset becomes non-zero. - -time_constant defaults to 0. The only place it is set is in the ntp_adjtime -system call, from the 'constant' element of the timex structure argument. - - Work around: -Never set the constant element of the timex structure passed to ntp_adjtime to -a value larger than 6. - -satish.mynam@Eng 1998-04-30 -1. Use Sun's version of NTP software instead of PD version. This problem -is not seen with Sun's NTP version (which is mostly eqivalent to PD NTP 3.4 -plus some Sun's local functionality futures). - -2. Workaround for the public domain NTP version ONLY: - ===================================================== -The workaround for public domain NTP version is to disable the -KERNEL_PLL from the NTP code. This way ntp_Adjtime() system call is -totally bypassed without sacrificing any of the functionality of the -NTP. The only hit you might see is the way kernel precision timminig -is done without the PLL algorithm in the kernel. - - The easiest way to disable ntp_adjtime option is(without changing - any makefiles or other config files) to disable the KERNEL_PLL - value in the ./config.h file. - -After doing a ./configure for probing for all the necessary tools(compilers, -os version, libraries), please comment out KERNEL_PLL macro in -the ./config.h file. This will disable the KERNEL_PLL part of the source -code and the newly obtained xntpd is just similar to the old one but it -does not use ntp_adjtime() system call. This prevents it from panic'ng -the kernel. - -/*#define KERNEL_PLL 1*/ - -I complied a new xntpd binary this way and it does nothave any ntp_adjtime() -related stuff. - -Default: -======= -/net/divya/export/home/mynam/public_domain/ntp/xntp3-5.92/xntpd>strings -xntpd | -grep ntp_adjtime -354:adj_frequency: ntp_adjtime failed: %m -357:loop_config: ntp_adjtime() failed: %m -435:get_kernel_info: ntp_adjtime() failed: %m - -With KERNEL_PLL disabled in config.h file --======================= - -/net/divya/export/home/mynam/public_domain/ntp/xntp3-5.92/xntpd>strings -xntpd.nopll | grep ntp_adjtime - - Integrated in releases: - Duplicate of: - Patch id: - See also: 4133517 - Summary: -If the time_constant parameter is 7 or higher, and the phase-lock looping model -is in use, the system will take a "integer divide zero trap" panic in -the clock routine as soon as the time_offset becomes non-zero. - -time_constant defaults to 0. The only place it is set is in the ntp_adjtime -system call, from the 'constant' element of the timex structure argument. ----------------------------------------------------------------------------- diff --git a/dist/ntp/html/hints/solaris.xtra.S99ntpd b/dist/ntp/html/hints/solaris.xtra.S99ntpd deleted file mode 100644 index d8058fd43d42..000000000000 --- a/dist/ntp/html/hints/solaris.xtra.S99ntpd +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -if [ $1 = "start" ]; then - if [ -x /usr/local/bin/xntpd ]; then - echo "Starting NTP daemon, takes about 1 minute... " - # dosynctodr may need to be left alone as of with Solaris 2.6 - # The following line is unnecessary if you turn off - # dosynctodr in /etc/system. - /usr/local/bin/tickadj -s - /usr/local/bin/ntpdate -v server1 server2 - sleep 5 - /usr/local/bin/xntpd - fi -else - if [ $1 = "stop" ]; then - pid=`/usr/bin/ps -e | /usr/bin/grep xntpd | /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` - if [ "${pid}" != "" ]; then - echo "Stopping Network Time Protocol daemon " - /usr/bin/kill ${pid} - fi - fi -fi diff --git a/dist/ntp/html/hints/solaris.xtra.patchfreq b/dist/ntp/html/hints/solaris.xtra.patchfreq deleted file mode 100644 index 9600881500e8..000000000000 --- a/dist/ntp/html/hints/solaris.xtra.patchfreq +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/ksh - -# -# File: patchfreq -# Author: Bryan Cantrill (bmc@eng.sun.com), Solaris Performance -# Modified: Sat Apr 26 04:00:59 PDT 1997 -# -# This is a little script to patch a 5.5 or 5.5.1 kernel to get around -# the cpu_tick_freq inaccuracy. Before running this script, one must -# know the true frequency of one's CPU; this can be derived by NTP, -# or by observing the clock relative to the time-of-day chip over a -# long period of time (the TOD will pull system time when it drifts -# by more than two seconds). -# -# Patching a kernel can render a machine unbootable; do not run this -# script unless you are prepared to accept that possibility. It -# is advisable to have a backout path (e.g. net booting, an alternate -# boot disk, an installation CD) should your machine fail to boot. -# -# This is not a product of Sun Microsystems, and is provided "as is", -# without warranty of any kind expressed or implied including, but not -# limited to, the suitability of this script for any purpose. -# - -if [ $# -eq 0 ]; then - echo "Usage: $0 cpu_tick_freq [ alternate_kernel ]" - exit 1 -fi - -cpu_tick_freq=$1 -kernel=/platform/sun4u/kernel/unix - -if [ $# -eq 2 ]; then - kernel=$2 -fi - -if [ ! -w $kernel ]; then - echo "$0: Cannot open $kernel for writing." - exit 1 -fi - -arch=`echo utsname+404?s | adb $kernel | cut -d: -f2` - -if [ ! $arch = "sun4u" ]; then - echo "Patch only applies to sun4u" - exit 1 -fi - -rel=`echo utsname+202?s | adb $kernel | cut -d: -f2` - -if [ ! $rel = "5.5" ] && [ ! $rel = "5.5.1" ]; then - echo "Patch only applies to 5.5 or 5.5.1..." - exit 1 -fi - -nop="1000000" # nop -store_mask="ffffe000" # mask out low 13 bits -store="da256000" # st %o5, [%l5 + offset] - -instr=`echo setcpudelay+34?X | adb $kernel | cut -d: -f 2 | nawk '{ print $1 }'` - -if [ $instr = $nop ]; then - echo "Instruction already patched..." -else - let masked="(16#$store_mask & 16#$instr) - 16#$store" - if [ $masked -ne 0 ]; then - echo "Couldn't find instruction to patch; aborting." - exit 1 - fi - - if ! echo setcpudelay+34?W $nop | adb -w $kernel 1> /dev/null - then - echo "adb returned an unexpected error; aborting." - fi -fi - -echo "Patching cpu_tick_freq to $cpu_tick_freq..." - -if ! echo cpu_tick_freq?W 0t$cpu_tick_freq | adb -w $kernel 1> /dev/null; then - echo "adb returned an unexpected error; aborting." - exit 1 -fi - -echo "$kernel successfully patched." -exit 0 diff --git a/dist/ntp/html/hints/sun4 b/dist/ntp/html/hints/sun4 deleted file mode 100644 index 424fa1873824..000000000000 --- a/dist/ntp/html/hints/sun4 +++ /dev/null @@ -1,15 +0,0 @@ -Notes on CPU clock oscillator tolerance with SunOS 4.1.1 and 4.1.3 - -A bug in SunOS 4.1.1 results in the kernel time losing 1 microsecond -per tick of the system clock. The bug was fixed (bugid 1094383) for -SunOS 4.1.1 and corrected in SunOS 4.1.3. The easiest way to fix this -is to replace the 4.1.1 binary clock.o with the corresponding 4.1.3 -binary. Without this change it is necessary to use the tickadj program -included in this distribution with the -t 9999 option. - -The tickadj option will work in all cases except when the kernel has -been modified to correct the CPU clock oscillator frequency using a -1-pps signal from a precision source. The bugfix must be installed for -this wrinkle to work properly. - -Dave Mills (mills@udel.edu) diff --git a/dist/ntp/html/hints/svr4-dell b/dist/ntp/html/hints/svr4-dell deleted file mode 100644 index 2c92f8a6337e..000000000000 --- a/dist/ntp/html/hints/svr4-dell +++ /dev/null @@ -1,8 +0,0 @@ -Notes on the DELL SVR4. - -You should use -DSETTIMEOFDAY_BROKEN. - -Philip.Gladstone@mail.citicorp.com - -(XXX But there is no checking for SETTIMEOFDAY_BROKEN in the code) - diff --git a/dist/ntp/html/hints/svr4_package b/dist/ntp/html/hints/svr4_package deleted file mode 100644 index b9f5ca391f34..000000000000 --- a/dist/ntp/html/hints/svr4_package +++ /dev/null @@ -1,33 +0,0 @@ -Date: Wed, 12 Apr 1995 12:42:03 +0100 -Message-ID: <513.797686923@concurrent.co.uk> -From: Andy Chittenden - -Dave - -Here is a uuencoded, compressed tar file. The only file I've -changed is Makefile - I've included the full file rather than diffs. -There are some new files as well: - - xntp shell script that starts up ntp during boot up - (the packaging stuff creates links to it so it comes - up at run level 2). As with all svr4 start/stop - scripts, it takes one parameter which is either - start or stop. It assumes that ntp.conf is in - /etc/inet/ntp.conf (where it should be on svr4 - machines). - prototype describes the file contents of the package. - You might like to review its contents to - see whether you want to include any other - files or remove some. NB I've made the man - pages go into 1m as they should on svr4. - preinstall runs before installation takes place. It - ensures that ntp is down if it is up before - installing a replacement package - postinstall starts up ntp after package installation. - preremove brings down ntp before removing the package. - -You create a package using "make package". This creates a file -called xntp.pkg. To install this package, you use -"pkgadd -d `pwd`/xntp.pkg xntp". This will start up ntp if -/etc/inet/ntp.conf exists. If you don't want the package anymore, use -"pkgrm xntp". I have tested this on Solaris 2.4. diff --git a/dist/ntp/html/hints/todo b/dist/ntp/html/hints/todo deleted file mode 100644 index e0e5ffa37696..000000000000 --- a/dist/ntp/html/hints/todo +++ /dev/null @@ -1,4 +0,0 @@ -Ulrich Windl : - Any change in a source file in the lib directory causes all files to - be recompiled (because the objects are removed). Add a better rule for - make to update the library. Maybe just remove "-rm -f $?". diff --git a/dist/ntp/html/hints/vxworks.html b/dist/ntp/html/hints/vxworks.html deleted file mode 100644 index 4df83c5afd56..000000000000 --- a/dist/ntp/html/hints/vxworks.html +++ /dev/null @@ -1,18 +0,0 @@ - - - vxWorks Port of NTP - - - -

    VxWorks port of NTP

    - -

    Please look at the Vxworks file in the html directory. - -

    Casey Crellin
    -casey@csc.co.za

    - -


    -

    - - - diff --git a/dist/ntp/html/hints/winnt.htm b/dist/ntp/html/hints/winnt.htm deleted file mode 100644 index d316607b7083..000000000000 --- a/dist/ntp/html/hints/winnt.htm +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - NTP on Windows NT - - - -

    -NTP 4.x for Windows NT

    - -

    -Introduction

    -The NTP 4 distribution runs as service on (i386) Windows NT 4.0 and Windows -2000. The binaries work on dual processor systems. This port has not been -tested on the Alpha platform. -

    Refer to System Requirements and Instructions for how to compile the -program. -

    -Reference Clocks

    -Refernce clock support under Windows NT is tricky because the IO functions -are so much different. The following reference clocks are supported by -Windows NT: -

    Type 1 Undisciplined Local Clock (LOCAL) -
    Type 29 Trimble Navigation Palisade GPS -(GPS_PALISADE) -

    -Functions Supported

    -All NTP functions are supported with some constraints. See the TODO list -below. -

    -Accuracy

    -Greg Brackley has implemented a fantastic interpolation scheme that improves -the precision of the NTP clock using a realtime thread (is that poetic -or what!) which captures a tick count from the 8253 counter after each -OS tick. The count is used to interpolate the time between operating system -ticks. -

    On a typical 200+ MHz system NTP achieves a precision of about 5 microseconds -and synchronizes the clock to +/-500 microseconds using the Trimble -Palisade as UTC reference. This allows distributed applications to -use the 10 milliseconds ticks available to them with high confidence. -

    -Binaries

    -Recent InstallShield based executable versions of NTP for Windows NT (i386) -are available from: -
    http://www.trimble.com/oem/ntp -and http://www.five-ten-sg.com/ -

    -ToDo

    - -
      -
    • -MD5 authentication causes problems with DNS. If you use encryption/authentication, -you have to use IP numbers in ntp.conf.
    • - -
    • -NMEA refclock support is in development.
    • - -
    • -See if precision can be improved by using CPU cycle counter for tick interpolation.
    • - -
    • -Make precision time available to applications using NTP_GETTIME API
    • -
    - -

    -Compiling Requirements

    - -
      -
    • -Windows NT 4.0 or 5.0 (2000)
    • - -
    • -Microsoft Visual C++ 6.0
    • - -
    • -Some version of the archiving program ZIP.
    • -
    - -

    -Compiling Instructions

    - -
      -
    1. -Unpack the NTP-4.x.tar.gz
    2. - -
    3. -Open the .\ports\winnt\ntp.dsw Visual C workspace
    4. - -
    5. -Batch build all projects
    6. -
    - -

    -Configuration File

    -The default NTP configuration file path is %SystemRoot%\system32\drivers\etc\. -(%SystemRoot% -is an environmental variable that can be determined by typing "set" at -the "Command Prompt" or from the "System" icon in the "Control Panel"). -
    Refer to your system environment and create your ntp.conf -file in the directory corresponding to your system  installation. -
    The older <WINDIR>\ntp.conf is still supported but you -will get a log entry reporting that the first file wasn't found. -

    -Installation Instructions

    -The instsrv program in the instsrv subdirectory of the distribution -can be used to install 'ntpd' as a service and start automatically at boot -time. Instsrv is automatically compiled with the rest of the distribution -if you followed the steps above. -
      -
    1. -Start a command prompt and enter "instsrv.exe <pathname_for_ntpd.exe>"
    2. - -
    3. -Clicking on the "Services" icon in the "Control Panel" will display the -list of currently installed services in a dialog box. The NetworkTimeProtocol -service should show up in this list. Select it in the list and hit the -"Start" button in the dialog box. The NTP service should start.
    4. - -
    5. -View the event log by clicking on the "Event Viewer" icon in the "Administrative -Tools" group, there should be several successful startup messages from -NTP. NTP will keep running and restart automatically when the machine is -rebooted.
    6. -
    -You can change the start mode (automatic/manual) and other startup parameters -correponding to the NTP service (eg. location of conf file) also in the -"Services" dialog box if you wish. -

    -Removing NTP

    -You can also use instsrv to delete the NTP service by entering: -"instsrv.exe remove" -

    -Command Line Parameters and Registry Entries

    -Unlike the Unix environment, there is no clean way to run 'ntpdate' and -reset the clock before starting 'ntpd' at boot time. -
    NTP will step the clock up to 1000 seconds by default. While there -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. -

    Use the registry editor to edit the value for the ntpd executable under -LocalMachine\System\CurrentControlSet\Services\NTP. -

    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) -

    -Bug Reports

    -Send bug reports to news://comp.protocols.time.ntp -and Sven_Dietrich@Trimble.COM -

    -Change Log

    - -

    -Last revision 16 February 1999  Version 4.0.99e.

    -by Sven Dietrich (sven_dietrich@trimble.com) -

    Significant Changes: -

      -
    • -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.
    • -
    - -

    -Last revision 15 November 1999  Version 4.0.98f.

    -by Sven Dietrich (sven_dietrich@trimble.com) -

    Significant Changes: -

      -
    • -Fixed I/O problem delaying packet responses which resulted in no-replys -to NTPQ and others.
    • - -
    • -The default configuration file path is <WINDIR>\system32\drivers\etc\ntp.conf. -The old <WINDIR>\ntp.conf is still supported but you will get a -log entry reporting that the first file wasn't found. The NTP 3.x legacy -ntp.ini -file is no longer supported.
    • -
    -Known Problems / TODO: -
      -
    • -MD5 and name resolution do not yet get along. If you define MD5, you cannot -use DNS names, only IP numbers.
    • -
    - -

    -Last revision 27 July 1999  Version 4.0.95.

    -This version compiles under WINNT with Visual C 6.0. -

    Greg Brackley and Sven Dietrich -

    Significant changes: -
    -Visual Studio v6.0 support -
    -Winsock 2.0 support -
    -Use of I/O completion ports for sockets and comm port I/O -
    -Removed the use of multimedia timers (from ntpd, others need removing) -
    -Use of waitable timers (with user mode APC) and performance counters -to fake getting a better time -
    -Trimble Palisade NTP Reference Clock support -
    -General cleanup, prototyping of functions -
    -Moved receiver buffer code to a separate module (removed unused members -from the recvbuff struct) -
    -Moved io signal code to a separate module -

    -Last revision:  20-Oct-1996

    -This version corrects problems with building the XNTP -
    version 3.5-86 distribution under Windows NT. -

    The following files were modified: -
     blddbg.bat -
     bldrel.bat -
     include\ntp_machine.h -
     xntpd\ntp_unixclock.c -
     xntpd\ntp_refclock.c -
     scripts\wininstall\build.bat -
     scripts\wininstall\setup.rul -
     scripts\wininstall\readme.nt -
     scripts\wininstall\distrib\ntpog.wri -
     html\hints\winnt (this file) -

    In order to build the entire Windows NT distribution you -
    need to modify the file scripts\wininstall\build.bat -
    with the installation directory of the InstallShield -
    software.  Then, simply type "bldrel" for non-debug -
    or "blddbg" for debug executables. -

    Greg Schueman -
        <schueman@acm.org> -

    -Last revision:  07-May-1996

    -This set of changes fixes all known bugs, and it includes -
    several major enhancements. -

    Many changes have been made both to the build environment as -
    well as the code.  There is no longer an ntp.mak file, instead -
    there is a buildntall.bat file that will build the entire -
    release in one shot.  The batch file requires Perl.  Perl -
    is easily available from the NT Resource Kit or on the Net. -

    The multiple interface support was adapted from Larry Kahn's -
    work on the BIND NT port.  I have not been able to test it -
    adequately as I only have NT servers with one network -
    interfaces on which to test. -

    Enhancements: -
    * Event Logging now works correctly. -
    * Version numbers now work (requires Perl during build) -
    * Support for multiple network interface cards (untested) -
    * NTP.CONF now default, but supports ntp.ini if not found -
    * Installation procedure automated. -
    * All paths now allow environment variables such as %windir% -

    Bug fixes: -
    * INSTSRV replaced, works correctly -
    * Cleaned up many warnings -
    * Corrected use of an uninitialized variable in XNTPD -
    * Fixed ntpdate -b option -
    * Fixed ntpdate to accept names as well as IP addresses -
            (Winsock WSAStartup was -called after a gethostbyname()) -
    * Fixed problem with "longjmp" in xntpdc/ntpdc.c that -
            caused a software exception -on doing a Control-C in xntpdc. -
     A Cntrl-C now terminates the program. -

    See below for more detail: -

          Note: SIGINT is not supported for any -Win32 application including -
          Windows NT and Windows 95. When a CTRL+C -interrupt occurs, Win32 -
          operating systems generate a new thread -to specifically handle that -
          interrupt. This can cause a single-thread -application such as UNIX, -
          to become multithreaded, resulting in -unexpected behavior. -
      -

    Possible enhancements and things left to do: -
    * Reference clock drivers for NT (at least Local Clock support) -
    * Control Panel Applet -
    * InstallShield based installation, like NT BIND has -
    * Integration with NT Performance Monitor -
    * SNMP integration -
    * Fully test multiple interface support -
      -

    Known problems: -
    *       bug in ntptrace - if no Stratum -1 servers are available, -
                    -such as on an IntraNet, the application crashes. -

    -Last revision:  12-Apr-1995

    -This NTPv3 distribution includes a sample configuration file and the project -
    makefiles for WindowsNT 3.5 platform using Microsoft Visual C++ 2.0 -compiler. -
    Also included is a small routine to install the NTP daemon as a "service" -
    on a WindowsNT box. Besides xntpd, the utilities that have been ported -are -
    ntpdate and xntpdc. The port to WindowsNT 3.5 has been tested using -a Bancomm -
    TimeServe2000 GPS receiver clock that acts as a strata 1 NTP server -with no -
    authentication (it has not been tested with any refclock drivers compiled -in). -
    Following are the known flaws in this port: -
    1) currently, I do not know of a way in NT to get information about -multiple -
       network interface cards. The current port uses just one -socket bound to -
       INADDR_ANY address. Therefore when dealing with a multihomed -NT time server, -
       clients should point to the default address on the server -(otherwise the -
       reply is not guaranteed to come from the same interface -to which the -
       request was sent). Working with Microsoft to get this -resolved. -
    2) There is some problem with "longjmp" in xntpdc/ntpdc.c that causes -a -
       software exception on doing a Control-C in xntpdc. Be -patient! -
    3) The error messages logged by xntpd currently contain only the numerical -
       error code. Corresponding error message string has to -be looked up in -
       "Books Online" on Visual C++ 2.0 under the topic "Numerical -List of Error -
       Codes". -

    Last HTML Update: November 17, 1999 -
    Sven_Dietrich@Trimble.COM - - diff --git a/dist/ntp/html/howto.htm b/dist/ntp/html/howto.htm deleted file mode 100644 index bcb6c6728d13..000000000000 --- a/dist/ntp/html/howto.htm +++ /dev/null @@ -1,315 +0,0 @@ - -How to Write a Reference Clock Driver -

    -How to Write a Reference Clock Driver -


    - -

    Description

    - -

    Reference clock support maintains the fiction that the clock is -actually an ordinary peer in the NTP tradition, but operating at a -synthetic stratum of zero. The entire suite of algorithms used to filter -the received data, select the best clocks or peers and combine them to -produce a local clock correction operate just like ordinary NTP peers. -In this way, defective clocks can be detected and removed from the peer -population. As no packets are exchanged with a reference clock; however, -the transmit, receive and packet procedures are replaced with separate -code to simulate them. - -

    Radio and modem reference clocks by convention have addresses in the -form 127.127.t.u, where t is the clock -type and u in the range 0-3 is used to distinguish multiple -instances of clocks of the same type. Most clocks require a serial port -or special bus peripheral. The particular device is normally specified -by adding a soft link /dev/devicedd to the particular -hardware device involved, where d corresponds to the -unit number. - -

    The best way to understand how the clock drivers work is to study the -ntp_refclock.c module and one of the drivers already -implemented, such as refclock_wwvb.c. Routines -refclock_transmit() and refclock_receive() maintain -the peer variables in a state analogous to a network peer and pass -received data on through the clock filters. Routines -refclock_peer() and refclock_unpeer() are called to -initialize and terminate reference clock associations, should this ever -be necessary. A set of utility routines is included to open serial -devices, process sample data, edit input lines to extract embedded -timestamps and to perform various debugging functions. - -

    The main interface used by these routines is the -refclockproc structure, which contains for most drivers the -decimal equivalents of the year, day, month, hour, second and -millisecond/microsecond decoded from the ASCII timecode. Additional -information includes the receive timestamp, exception report, statistics -tallies, etc. The support routines are passed a pointer to the -peer structure, which is used for all peer-specific processing -and contains a pointer to the refclockproc structure, which in -turn contains a pointer to the unit structure, if used. For legacy -purposes, a table typeunit[type][unit] contains the peer -structure pointer for each configured clock type and unit. - -

    The reference clock interface supports auxiliary functions to support -in-stream timestamping, pulse-per-second (PPS) interfacing and precision -time kernel support. In most cases the drivers do not need to be aware -of them, since they are detected at autoconfigure time and loaded -automatically when the device is opened. These include the -tty_clk and ppsclock STREAMS modules and -ppsapi PPS interface described in the Line -Disciplines and Streams Modules page. The tty_clk module -reduces latency errors due to the operating system and serial port code -in slower systems. The ppsclock module is an interface for the -PPS signal provided by some radios. The ppsapi PPS interface -replaces the ppsclock STREAMS module and is expected to become -the IETF standard cross-platform interface for PPS signals. In either -case, the PPS signal can be connected via a level converter/pulse -generator described in the Gadget Box PPS Level -Converter and CHU Modem page. - -

    By convention, reference clock drivers are named in the form -refclock_xxxx.c, where xxxx is a unique -string. Each driver is assigned a unique type number, long-form driver -name, short-form driver name, and device name. The existing assignments -are in the Reference Clock Drivers page -and its dependencies. All drivers supported by the particular hardware -and operating system are automatically detected in the autoconfigure -phase and conditionally compiled. They are configured when the daemon is -started according to the configuration file, as described in the Configuration Options page. - -

    The standard clock driver interface includes a set of common support -routines some of which do such things as start and stop the device, open -the serial port, and establish special functions such as PPS signal -support. Other routines read and write data to the device and process -time values. Most drivers need only a little customizing code to, for -instance, transform idiosyncratic timecode formats to standard form, -poll the device as necessary, and handle exception conditions. A -standard interface is available for remote debugging and monitoring -programs, such as ntpq and ntpdc, as well as -the filegen facility, which can be used to record device -status on a continuous basis. - -

    The general organization of a typical clock driver includes a -receive-interrupt routine to read a timecode from the I/O buffer and -convert to internal format, generally in days, hours, minutes, seconds -and fraction. Some timecode formats include provisions for leap-second -warning and determine the clock hardware and software health. The -interrupt routine then calls refclock_process() with these data -and the timestamp captured at the on-time character of the timecode. -This routine saves each sample as received in a circular buffer, which -can store from a few up to 60 samples, in cases where the timecodes -arrive one per second. - -

    The refclock_transmit() routine in the interface is called -by the system at intervals defined by the poll interval in the peer -structure, generally 64 s. This routine in turn calls the transmit poll -routine in the driver. In the intended design, the driver calls the -refclock_receive() to process the offset samples that have -accumulated since the last poll and produce the final offset and -variance. The samples are processed by recursively discarding median -outlyers until about 60 percent of samples remain, then averaging the -surviving samples. When a reference clock must be explicitly polled to -produce a timecode, the driver can reset the poll interval so that the -poll routine is called a specified number of times at 1-s intervals. - -

    The interface code and this documentation have been developed over -some time and required not a little hard work converting old drivers, -etc. Should you find success writing a driver for a new radio or modem -service, please consider contributing it to the common good. Send the -driver file itself and patches for the other files to Dave Mills -(mills@udel.edu). - -

    Conventions, Fudge Factors and Flags

    - -

    Most drivers support manual or automatic calibration for systematic -offset bias using values encoded in the fudge configuration -command. By convention, the time1 value defines the calibration -offset in seconds. For those drivers that support statistics collection -using the filegen utility and the clockstats file, the -flag4 switch enables the utility. When a PPS signal is -available, a special automatic calibration facility is provided. If the -flag1 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. Should the PPS signal or the prefer -peer fail, the adjustment is frozen and the remaining drivers continue -to discipline the system clock with a minimum of residual error. - -

    Files Which Need to be Changed

    - -

    A new reference clock implementation needs to supply, in addition to -the driver itself, several changes to existing files. - -

    - -
    ./include/ntp.h -
    The reference clock type defines are used in many places. Each -driver is assigned a unique type number. Unused numbers are clearly -marked in the list. A unique REFCLK_xxxx -identification code should be recorded in the list opposite its assigned -type number. - -

    ./libntp/clocktypes.c -
    The ./libntp/clktype array is used by certain display -functions. A unique short-form name of the driver should be entered -together with its assigned identification code. - -

    ./ntpd/ntp_control.c -
    The clocktypes array is used for certain control -message displays functions. It should be initialized with the reference -clock class assigned to the driver, as per the NTP specification -RFC-1305. See the ./include/ntp_control.h header file for -the assigned classes. - -

    ./ntpd/refclock_conf.c -
    This file contains a list of external structure definitions which -are conditionally defined. A new set of entries should be installed -similar to those already in the table. The refclock_conf -array is a set of pointers to transfer vectors in the individual -drivers. The external name of the transfer vector should be initialized -in correspondence with the type number. - -

    ./acconfig.h -
    This is a configuration file used by the autoconfigure scheme. Add -two lines in the form: - -

    -  /* Define if we have a FOO clock */
    -  #undef FOO
    -
    - -

    where FOO is the define used to cause the driver to be included in -the distribution. - -

    ./configure.in -
    This is a configuration file used by the autoconfigure scheme. Add -lines similar to the following: - -

    -  AC_MSG_CHECKING(FOO clock_description)
    -  AC_ARG_ENABLE(FOO, [  --enable-FOO        clock_description],
    -      [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
    -  if test "$ntp_ok" = "yes"; then
    -      ntp_refclock=yes
    -      AC_DEFINE(FOO)
    -  fi
    -  AC_MSG_RESULT($ntp_ok)
    -
    - -

    (Note that $ntp_eac is the value from -- -{dis,en}able-all-clocks for non-PARSE clocks and -$ntp_eacp is the value from --{dis,en}able-parse- -clocks for PARSE clocks. See the documentation on the autoconf -and automake tools from the GNU distributions.) - -

    ./ntpd/Makefile.am -

    This is the makefile prototype used by the autoconfigure scheme. -Add the driver file name to the entries already in the -ntpd_SOURCES list. - -

    Patches to automake-1.0 are required for the -autoconfigure scripts to work properly. The file automake- -1.0.patches can be used for this purpose. - -

    ./ntpd/Makefile.am -
    Do the following sequence of commands: - -

    -  automake
    -  autoconf
    -  autoheader
    -  configure
    -
    - -

    or simply run make, which will do this command sequence -automatically. - -

    - -

    Interface Routine Overview

    - -
    - -
    refclock_newpeer - initialize and start a reference -clock -
    This routine allocates and initializes the interface structure which -supports a reference clock in the form of an ordinary NTP peer. A -driver-specific support routine completes the initialization, if used. -Default peer variables which identify the clock and establish its -reference ID and stratum are set here. It returns one if success and -zero if the clock address is invalid or already running, insufficient -resources are available or the driver declares a bum rap. -

    refclock_unpeer - shut down a clock -
    This routine is used to shut down a clock and return its resources -to the system. - -

    refclock_transmit - simulate the transmit procedure -
    This routine implements the NTP transmit procedure for a reference -clock. This provides a mechanism to call the driver at the NTP poll -interval, as well as provides a reachability mechanism to detect a -broken radio or other madness. - -

    refclock_sample - process a pile of samples from the -clock -
    This routine converts the timecode in the form days, hours, minutes, -seconds, milliseconds/microseconds to internal timestamp format. It then -calculates the difference from the receive timestamp and assembles the -samples in a shift register. It implements a recursive median filter to -suppress spikes in the data, as well as determine a rough dispersion -estimate. A configuration constant time adjustment -fudgetime1 can be added to the final offset to compensate -for various systematic errors. The routine returns one if success and -zero if failure due to invalid timecode data or very noisy offsets. - -

    Note that no provision is included for the year, as provided by some -(but not all) radio clocks. Ordinarily, the year is implicit in the Unix -file system and hardware/software clock support, so this is ordinarily -not a problem. Nevertheless, the absence of the year should be -considered more a bug than a feature and may be supported in future. - -

    refclock_receive - simulate the receive and packet -procedures -
    This routine simulates the NTP receive and packet procedures for a -reference clock. This provides a mechanism in which the ordinary NTP -filter, selection and combining algorithms can be used to suppress -misbehaving radios and to mitigate between them when more than one is -available for backup. - -

    refclock_gtlin - groom next input line and extract -timestamp -
    This routine processes the timecode received from the clock and -removes the parity bit and control characters. If a timestamp is present -in the timecode, as produced by the tty_clk line -discipline/streams module, it returns that as the timestamp; otherwise, -it returns the buffer timestamp. The routine return code is the number -of characters in the line. - -

    refclock_open - open serial port for reference clock -
    This routine opens a serial port for I/O and sets default options. -It returns the file descriptor if success and zero if failure. - -

    refclock_ioctl - set serial port control functions -
    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 the tty_clk, -chu_clk and ppsclock streams module/line discipline, -if compiled in the daemon and requested in the call. The routine returns -one if success and zero if failure. - -

    refclock_control - set and/or return clock values -
    This routine is used mainly for debugging. It returns designated -values from the interface structure that can be displayed using ntpdc -and the clockstat command. It can also be used to initialize -configuration variables, such as fudgetimes, fudgevalues, -reference ID and stratum. - -

    refclock_buginfo - return debugging info -
    This routine is used mainly for debugging. It returns designated -values from the interface structure that can be displayed using -ntpdc and the clkbug command. - -
    - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/htmlprimer.htm b/dist/ntp/html/htmlprimer.htm deleted file mode 100644 index 898a5833e0a2..000000000000 --- a/dist/ntp/html/htmlprimer.htm +++ /dev/null @@ -1,1198 +0,0 @@ - - - -A Beginner's Guide to HTML - - - -

    A Beginner's Guide to HTML

    - -

    -This is a primer for producing documents in HTML, the markup language -used by the World Wide Web. - -

    - -

    Acronym Expansion

    -
    -
    WWW -
    World Wide Web (or Web, for short). -
    SGML -
    Standard Generalized Markup Language -- this is a standard for - describing markup languages. -
    DTD -
    Document Type Definition -- this is a specific markup language, - written using SGML. -
    HTML -
    HyperText Markup Language -- HTML is a SGML DTD. In practical - terms, HTML is a collection of styles (indicated by markup tags) - that define the various components of a World Wide Web document. -HTML was invented by Tim Berners-Lee while at CERN. He is now director -of the W3 Consortium. -
    - -

    What This Primer Doesn't Cover

    -

    -This primer assumes that you have: - -

      -
    • at least a passing knowledge of how to use NCSA Mosaic or some - other Web browser -
    • a general understanding of how Web servers and client browsers - work -
    • access to a Web server for which you would like to produce HTML - documents, or that you wish to produce HTML documents for personal - use -
    - -

    Creating HTML Documents

    -

    -HTML documents are in plain (also known as ASCII) text format and can -be created using any text editor (e.g., Emacs or vi on UNIX machines). -A couple of Web browsers (tkWWW for X Window System machines and CERN's -Web browser for NeXT computers) include rudimentary HTML editors in -a WYSIWYG environment. There are also some WYSIWIG editors available -now (e.g. HotMetal for Sun Sparcstations, HTML Edit for Macintoshes). -You may wish to try one of them first before delving into the details -of HTML. -

    - You can preview a document in progress with NCSA Mosaic (and - some other Web browsers). Open it with the Open Local - command under the File menu. - -

    - After you edit the source HTML file, save the changes. Return - to NCSA Mosaic and Reload the document. The - changes are reflected in the on-screen display. - -

    - -

    The Minimal HTML Document

    -

    -Here is a bare-bones example of HTML: - -

    -    <TITLE>The simplest HTML example</TITLE>
    -    <H1>This is a level-one heading</H1>
    -    Welcome to the world of HTML. 
    -    This is one paragraph.<P>
    -    And this is a second.<P>
    -
    - -Click here to see the formatted version -of the example. - -

    -HTML uses markup tags to tell the Web browser how to display the text. -The above example uses: - -

      -
    • the <TITLE> tag (and corresponding </TITLE> - tag), which specifies the title of the document -
    • the <H1> header tag (and corresponding </H1>) -
    • the <P> paragraph-separator tag -
    - -

    -HTML tags consist of a left angle bracket (<), (a ``less -than'' symbol to mathematicians), followed by name of the tag and closed -by a right angular bracket (>). Tags are usually paired, -e.g. <H1> and </H1>. The ending -tag looks just like the starting tag except a slash (/) precedes the -text within the brackets. In the example, <H1> tells -the Web browser to start formatting a level-one heading; </H1> -tells the browser that the heading is complete. - -

    -The primary exception to the pairing rule is the <P> -tag. There is no such thing as </P>. - -

    -NOTE: HTML is not case sensitive. <title> -is equivalent to <TITLE> or <TiTlE>. - - -

    -Not all tags are supported by all World Wide Web browsers. If a browser -does not support a tag, it just ignores it. - -

    Basic Markup Tags

    -

    Title

    -

    -Every HTML document should have a title. A title is generally displayed -separately from the document and is used primarily for document identification -in other contexts (e.g., a WAIS search). Choose about half a dozen -words that describe the document's purpose. -

    - In the X Window System and Microsoft Windows versions of NCSA - Mosaic, the Document Title field is at the - top of the screen just below the pulldown menus. In NCSA - Mosaic for Macintosh, text tagged as <TITLE> - appears as the window title. - -
    - -

    Headings

    -

    -HTML has six levels of headings, numbered 1 through 6, with 1 being -the most prominent. Headings are displayed in larger and/or bolder -fonts than normal body text. The first heading in each document should -be tagged <H1>. The syntax of the heading tag is: - -

    -<Hy>Text of heading -</Hy > - -

    -where y is a number between 1 and 6 specifying the level -of the heading. - -

    -For example, the coding for the ``Headings'' section heading above -is - -

    -    <H3>Headings</H3>
    -
    - -
    Title versus first heading
    -

    -In many documents, the first heading is identical to the title. For -multipart documents, the text of the first heading should be suitable -for a reader who is already browsing related information (e.g., a chapter -title), while the title tag should identify the document in a wider -context (e.g., include both the book title and the chapter title, although -this can sometimes become overly long). - -

    Paragraphs

    -

    -Unlike documents in most word processors, carriage returns in HTML -files aren't significant. Word wrapping can occur at any point in your -source file, and multiple spaces are collapsed into a single space. -(There are couple of exceptions; space following a <P> -or <Hy> tag, for example, -is ignored.) Notice that in the bare-bones example, the first paragraph -is coded as - -

    -    Welcome to HTML.
    -    This is the first paragraph. <P>
    -
    - -

    -In the source file, there is a line break between the sentences. A -Web browser ignores this line break and starts a new paragraph only -when it reaches a <P> tag. - -

    -Important: You must separate paragraphs with <P>. -The browser ignores any indentations or blank lines in the source text. -HTML relies almost entirely on the tags for formatting instructions, -and without the <P> tags, the document becomes one -large paragraph. (The exception is text tagged as ``preformatted,'' -which is explained below.) For instance, the following would produce -identical output as the first bare-bones HTML example: - -

    -    <TITLE>The simplest HTML example</TITLE><H1>This is a level 
    -    one heading</H1>Welcome to the world of HTML. This is one 
    -    paragraph.<P>And this is a second.<P>
    -
    - -

    -However, to preserve readability in HTML files, headings should be -on separate lines, and paragraphs should be separated by blank lines -(in addition to the <P> tags). -

    - NCSA Mosaic handles <P> by ending the current paragraph - and inserting a blank line. - -
    - -

    -In HTML+, a successor to HTML currently in development, <P> -becomes a ``container'' of text, just as the text of a level-one heading -is ``contained'' within<H1> ... </H1>: - -

    -    <P>
    -    This is a paragraph in HTML+.
    -    </P>
    -
    - -

    -The difference is that the </P> closing tag can -always be omitted. (That is, if a browser sees a <P>, -it knows that there must be an implied </P> to end -the previous paragraph.) In other words, in HTML+, <P> -is a beginning-of-paragraph marker. - -

    -The advantage of this change is that you will be able to specify formatting -options for a paragraph. For example, in HTML+, you will be able to -center a paragraph by coding - -

    -    <P ALIGN=CENTER>
    -    This is a centered paragraph. This is HTML+, so you can't do it yet.
    -
    - -

    -This change won't effect any documents you write now, and they will -continue to look just the same with HTML+ browsers. - -

    Linking to Other Documents

    -

    -The chief power of HTML comes from its ability to link regions of text -(and also images) to another document. The browser highlights these -regions (usually with color and/or underlines) to indicate that they -are hypertext links (often shortened to hyperlinks or simply -links). - -

    -HTML's single hypertext-related tag is <A>, which -stands for anchor. To include an anchor in your document: - -

      -
    1. Start the anchor with <A . (There's a space after - the A.) -
    2. Specify the document that's being pointed to by entering the parameter - HREF="filename" - followed by a closing right angle bracket: > -
    3. Enter the text that will serve as the hypertext link in the current - document. -
    4. Enter the ending anchor tag: </A>. -
    - -

    -Here is an sample hypertext reference: - -

    -    <A HREF="MaineStats.html">Maine</A>
    -
    - -

    -This entry makes the word ``Maine'' the hyperlink to the document MaineStats.html, -which is in the same directory as the first document. You can link -to documents in other directories by specifying the relative path -from the current document to the linked document. For example, a link -to a file NJStats.html located in the subdirectory AtlanticStates -would be: - -

    -    <A HREF="AtlanticStates/NJStats.html">New Jersey</A>
    -
    - -

    -These are called relative links. You can also use the absolute -pathname of the file if you wish. Pathnames use the standard UNIX syntax. - -

    Relative Links Versus Absolute Pathnames

    -

    -In general, you should use relative links, because - -

      -
    1. You have less to type. -
    2. It's easier to move a group of documents to another location, because - the relative path names will still be valid. -
    - -

    -However, use absolute pathnames when linking to documents that are -not directly related. For example, consider a group of documents that -comprise a user manual. Links within this group should be relative -links. Links to other documents (perhaps a reference to related software) -should use full path names. This way, if you move the user manual to -a different directory, none of the links would have to be updated. - -

    Uniform Resource Locator

    -

    -The World Wide Web uses Uniform Resource Locators (URLs) to specify -the location of files on other servers. A URL includes the type of -resource being accessed (e.g., gopher, WAIS), the address of the server, -and the location of the file. The syntax is: - -

    -scheme://host.domain[:port]/path/filename - -

    -where scheme is one of - -

    -
    file -
    -
    -
    a file on your local system, or a file on an anonymous FTP server - -
    http -
    a file on a World Wide Web server -
    gopher -
    a file on a Gopher server -
    WAIS -
    a file on a WAIS server -
    news -
    an Usenet newsgroup -
    telnet -
    a connection to a Telnet-based service -
    - -

    -The port number can generally be omitted. (That means unless -someone tells you otherwise, leave it out.) - -

    -For example, to include a link to this primer in your document, you -would use - -

    -    <A HREF = "http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html"> 
    -    NCSA's Beginner's Guide to HTML</A>
    -
    - -

    -This would make the text ``NCSA's Beginner's Guide to HTML'' a hyperlink -to this document. - -

    -For more information on URLs, look at - -

    - -

    Links to Specific Sections in Other Documents

    -

    -Anchors can also be used to move to a particular section in a document. -Suppose you wish to set a link from document A and a specific section -in document B. (Call this file documentB.html.) First -you need to set up a named anchor in document B. For example, -to set up an anchor named ``Jabberwocky'' to document B, enter - -

    -    Here's <A NAME = "Jabberwocky">some text</a>
    -
    - -

    -Now when you create the link in document A, include not only the filename, -but also the named anchor, separated by a hash mark (#). - -

    -    This is my <A HREF = "documentB.html#Jabberwocky">link</A> to document B.
    -
    - -

    -Now clicking on the word ``link'' in document A sends the reader directly -to the words ``some text'' in document B. - -

    Links to Specific Sections Within the Current Document

    -

    -The technique is exactly the same except the filename is omitted. - -

    -For example, to link to the Jabberwocky anchor from within the same -file (Document B), use - -

    -    This is <A HREF = "#Jabberwocky">Jabberwocky link</A> from within Document B.
    -
    - -

    Additional Markup Tags

    -

    -The preceding is sufficient to produce simple HTML documents. For more -complex documents, HTML has tags for several types of lists, preformatted -sections, extended quotations, character formatting, and other items. - -

    Lists

    -

    -HTML supports unnumbered, numbered, and definition lists. - -

    Unnumbered Lists

    -

    -To make an unnumbered list, - -

      -
    1. Start with an opening list <UL> tag. -
    2. Enter the <LI> tag followed by the individual - item. (No closing </LI> tag is needed.) -
    3. End with a closing list </UL> tag. -
    - -

    -Below an example two-item list: - -

    -    <UL>
    -    <LI> apples
    -    <LI> bananas
    -    </UL>
    -
    - -

    -The output is: - -

      -
    • apples -
    • bananas -
    - -

    -The <LI> items can contain multiple paragraphs. -Just separate the paragraphs with the <P> paragraph -tags. - -

    Numbered Lists

    -

    -A numbered list (also called an ordered list, from which the tag name -derives) is identical to an unnumbered list, except it uses <OL> -instead of <UL>. The items are tagged using the -same <LI> tag. The following HTML code - -

    -    <OL>
    -    <LI> oranges
    -    <LI> peaches
    -    <LI> grapes
    -    </OL>
    -
    - -

    -produces this formatted output: - -

      -
    1. oranges -
    2. peaches -
    3. grapes -
    - -

    Definition Lists

    -

    -A definition list usually consists of alternating a term (abbreviated -as DT) and a definition (abbreviated as DD). -Web browsers generally format the definition on a new line. - -

    -The following is an example of a definition list: - -

    -    <DL>
    -    <DT> NCSA
    -    <DD> NCSA, the National Center for Supercomputing Applications,
    -         is located on the campus of the University of Illinois 
    -         at Urbana-Champaign. NCSA is one of the participants in the
    -         National MetaCenter for Computational Science and Engineering.
    -    <DT> Cornell Theory Center
    -    <DD> CTC is located on the campus of Cornell University in Ithaca,
    -         New York. CTC is another participant in the National MetaCenter
    -         for Computational Science and Engineering.
    -    </DL>
    -
    - -

    -The output looks like: - -

    -
    NCSA -
    NCSA, the National Center for Supercomputing Applications, is located - on the campus of the University of Illinois at Urbana-Champaign. - NCSA is one of the participants in the National MetaCenter for - Computational Science and Engineering. -
    Cornell Theory Center -
    CTC is located on the campus of Cornell University in Ithaca, New - York. CTC is another participant in the National MetaCenter for - Computational Science and Engineering. -
    - -

    -The <DT> and <DD> entries can -contain multiple paragraphs (separated by <P> paragraph -tags), lists, or other definition information. - -

    Nested Lists

    -

    -Lists can be arbitrarily nested, although in practice you probably -should limit the nesting to three levels. You can also have a number -of paragraphs, each containing a nested list, in a single list item. - -

    - An example nested list: - -

    -    <UL>
    -    <LI> A few New England states:
    -        <UL>
    -        <LI> Vermont
    -        <LI> New Hampshire
    -        </UL>
    -    <LI> One Midwestern state:
    -        <UL>
    -        <LI> Michigan
    -        </UL>
    -    </UL>
    -
    - -

    -The nested list is displayed as - -

      -
    • A few New England states: -
        -
      • Vermont -
      • New Hampshire -
      -
    • One Midwestern state: -
        -
      • Michigan -
      -
    - -

    Preformatted Text

    -

    -Use the <PRE> tag (which stands for ``preformatted'') -to generate text in a fixed-width font and cause spaces, new lines, -and tabs to be significant. (That is, multiple spaces are displayed -as multiple spaces, and lines break in the same locations as in the -source HTML file.) This is useful for program listings. For example, -the following lines - -

    -    <PRE>
    -      #!/bin/csh                           
    -      cd $SCR                             
    -      cfs get mysrc.f:mycfsdir/mysrc.f   
    -      cfs get myinfile:mycfsdir/myinfile   
    -      fc -02 -o mya.out mysrc.f           
    -      mya.out                              
    -      cfs save myoutfile:mycfsdir/myoutfile 
    -      rm *                                
    -    </PRE>
    -
    - -

    -display as - -

    -      #!/bin/csh                           
    -      cd $SCR                             
    -      cfs get mysrc.f:mycfsdir/mysrc.f   
    -      cfs get myinfile:mycfsdir/myinfile   
    -      fc -02 -o mya.out mysrc.f           
    -      mya.out                              
    -      cfs save myoutfile:mycfsdir/myoutfile 
    -      rm *
    -
    - -

    -Hyperlinks can be used within <PRE> sections. You -should avoid using other HTML tags within <PRE> -sections, however. - -

    -Note that because <, >, and & have special meaning in HTML, -you have to use their escape sequences (&lt;, &gt;, -and &amp;, respectively) to enter these characters. -See the section -Special Characters for more information. - -

    Extended Quotations

    -

    -Use the <BLOCKQUOTE> tag to include quotations in -a separate block on the screen. Most browsers generally indent to separate -it from surrounding text. - -

    -An example: - -

    -    <BLOCKQUOTE>
    -    I still have a dream. It is a dream deeply rooted in the
    -    American dream. <P>
    -    I have a dream that one day this nation will rise up and 
    -    live out the true meaning of its creed. We hold these truths 
    -    to be self-evident that all men are created equal. <P>
    -    </BLOCKQUOTE>
    -
    - -

    -The result is: -

    - I still have a dream. It is a dream deeply rooted in the American - dream. - -

    - I have a dream that one day this nation will rise up and live out - the true meaning of its creed. We hold these truths to be self-evident - that all men are created equal. - -

    - -

    Addresses

    -

    -The <ADDRESS> tag is generally used to specify the -author of a document and a means of contacting the author (e.g., an -email address). This is usually the last item in a file. - -

    -For example, the last line of the online version of this guide is - -

    -    <ADDRESS>
    -    A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
    -    </ADDRESS>
    -
    - -

    -The result is -

    A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
    - -

    -NOTE: <ADDRESS> is not -used for postal addresses. See ``Forced Line Breaks'' on page 10 to -see how to format postal addresses. - -

    Character Formatting

    -

    -You can code individual words or sentences with special styles. There -are two types of styles: logical and physical. Logical styles -tag text according to its meaning, while physical styles -specify the specific appearance of a section. For example, in the preceding -sentence, the words ``logical styles'' was tagged as a ``definition.'' -The same effect (formatting those words in italics), could have been -achieved via a different tag that specifies merely ``put these words -in italics.'' - -

    Physical Versus Logical: Use Logical Styles When Possible

    -

    -If physical and logical styles produce the same result on the screen, -why are there both? We devolve, for a couple of paragraphs, into the -philosophy of SGML, which can be summed in a Zen-like mantra: ``Trust -your browser.'' - -

    -In the ideal SGML universe, content is divorced from presentation. -Thus, SGML tags a level-one heading as a level-one heading, but does -not specify that the level-one heading should be, for instance, 24-point -bold Times centered on the top of a page. The advantage of this approach -(it's similar in concept to style sheets in many word processors) is -that if you decide to change level-one headings to be 20-point left-justified -Helvetica, all you have to do is change the definition of the level-one -heading in the presentation device (i.e., your World Wide Web browser). - -

    -The other advantage of logical tags is that they help enforce consistency -in your documents. It's easier to tag something as <H1> -than to remember that level-one headings are 24-point bold Times or -whatever. The same is true for character styles. For example, consider -the <STRONG> tag. Most browsers render it in bold -text. However, it is possible that a reader would prefer that these -sections be displayed in red instead. Logical styles offer this flexibility. - -

    Logical Styles

    -
    -
    <DFN> -
    for a word being defined. Typically displayed in italics. (NCSA - Mosaic is a World Wide Web browser.) -
    <EM> -
    for emphasis. Typically displayed in italics. (Watch out for - pickpockets.) -
    <CITE> -
    for titles of books, films, etc. Typically displayed in italics. - (A Beginner's Guide to HTML) -
    <CODE> -
    for snippets of computer code. Displayed in a fixed-width font. - (The <stdio.h> header file) -
    <KBD> -
    for user keyboard entry. Should be displayed in a bold fixed-width - font, but many browsers render it in the plain fixed-width font. - (Enter passwd to change your password.) -
    <SAMP> -
    for computer status messages. Displayed in a fixed-width font. - (Segmentation fault: Core dumped.) -
    <STRONG> -
    for strong emphasis. Typically displayed in bold. (Important) - -
    <VAR> -
    for a ``metasyntactic'' variable, where the user is to replace - the variable with a specific instance. Typically displayed in italics. - (rm filename deletes the file.) -
    - -

    Physical Styles

    -
    -
    <B> -
    bold text -
    <I> -
    italic text -
    <TT> -
    typewriter text, e.g. fixed-width font. -
    - -

    Using Character Tags

    -

    -To apply a character style, - -

      -
    1. Start with <tag>, where - tag is the desired character formatting tag, - to indicate the beginning of the tagged text. -
    2. Enter the tagged text. -
    3. End the passage with </tag>. -
    - -

    Special Characters

    -

    Escape Sequences

    -

    -Four characters of the ASCII character set -- the left angle bracket -(<), the right angle bracket (>), the ampersand (&) and the -double quote (") -- have special meaning within HTML and therefore -cannot be used ``as is'' in text. (The angle brackets are used to indicate -the beginning and end of HTML tags, and the ampersand is used to indicate -the beginning of an escape sequence.) - -

    -To use one of these characters in an HTML document, you must enter -its escape sequence instead: - -

    -
    &lt; -
    the escape sequence for < -
    &gt; -
    the escape sequence for > -
    &amp; -
    the escape sequence for & -
    &quot; -
    the escape sequence for " -
    - -

    -Additional escape sequences support accented characters. For example: - -

    -
    &ouml; -
    the escape sequence for a lowercase o with an umlaut: ö - -
    &ntilde; -
    the escape sequence for a lowercase n with an tilde: ñ -
    &Egrave; -
    the escape sequence for an uppercase E with a grave accent: È - -
    - -

    - A full -list of supported characters is available. - -

    -NOTE: Unlike the rest of HTML, the escape sequences -are case sensitive. You cannot, for instance, use &LT; instead -of &lt;. - -

    Forced Line Breaks

    -

    -The <BR> tag forces a line break with no extra space -between lines. (By contrast, most browsers format the <P> -paragraph tag with an additional blank line to more clearly indicate -the beginning the new paragraph.) - -

    -One use of <BR> is in formatting addresses: - -

    -    National Center for Supercomputing Applications<BR>
    -    605 East Springfield Avenue<BR>
    -    Champaign, Illinois 61820-5518<BR>
    -
    - -

    Horizontal Rules

    -

    -The <HR> tag produces a horizontal line the width -of the browser window. - -

    In-line Images

    -

    -Most Web browsers can display in-line images (that is, images next -to text) that are in X Bitmap (XBM) or GIF format. Each image takes -time to process and slows down the initial display of the document, -so generally you should not include too many or overly large images. - -

    -To include an in-line image, use - -

    -    <IMG SRC=image_URL>
    -
    - -

    -where image_URL is the URL of the image file. The syntax -for IMG SRC URLs is identical to that used in an anchor -HREF. If the image file is a GIF file, then the filename -part of image_URL must end with .gif. -Filenames of X Bitmap images must end with .xbm. - -

    -By default the bottom -of an image is aligned with the text as shown in this paragraph. - -

    - -Add the ALIGN=TOP -option if you want the browser to align adjacent text with the top -of the image as shown in this paragraph. The full in-line image tag -with the top alignment is: - -

    -    <IMG ALIGN=top SRC=image_URL>
    -
    - -

    - -ALIGN=MIDDLE -aligns the text with the center of the image. - -

    Alternate Text for Browsers That Can't Display Images

    -

    -Some World Wide Web browsers, primarily those that run on VT100 terminals, -cannot display images. The ALT option allows you to specify -text to be displayed when an image cannot be. For example: - -

    -    <IMG SRC = "UpArrow.gif" ALT = "Up">
    -
    - -

    -where UpArrow.gif is the picture of an upward pointing -arrow. With NCSA Mosaic and other graphics-capable viewers, the user -sees the up arrow graphic. With a VT100 browser, such as lynx, the -user sees the word ``Up.'' - -

    External Images, Sounds, and Animations

    -

    -You may want to have an image open as a separate document when a user -activates a link on either a word or a smaller, in-line version of -the image included in your document. This is considered an external -image and is useful if you do not wish to slow down the loading of -the main document with large in-line images. - -

    -To include a reference to an external image, use - -

    -    <A HREF = image_URL>link anchor</A>
    -
    - -

    -Use the same syntax is for links to external animations and sounds. -The only difference is the file extension of the linked file. For example, - -

    -<A HREF = "QuickTimeMovie.mov">link anchor</A> - -

    -specifies a link to a QuickTime movie. Some common file types and their -extensions are: - -

    -
    File Type -
    Extension -
    Plain text -
    .txt -
    HTML document -
    .html -
    GIF image -
    .gif -
    TIFF image -
    .tiff -
    XBM bitmap image -
    .xbm -
    JPEG image -
    .jpg or .jpeg -
    PostScript file -
    .ps -
    AIFF sound -
    .aiff -
    AU sound -
    .au -
    QuickTime movie -
    .mov -
    MPEG movie -
    .mpeg or .mpg -
    - -

    -Make sure your intended audience has the necessary viewers. Most UNIX -workstations, for instance, cannot view QuickTime movies. - -

    Troubleshooting

    -

    Avoid Overlapping Tags

    -

    -Consider this snippet of HTML: - -

    -    <B>This is an example of <DFN>overlapping</B> HTML tags.</DFN>
    -
    - -

    -The word ``overlapping'' is contained within both the <B> -and <DFN> tags. How does the browser format it? -You won't know until you look, and different browsers will likely react -differently. In general, avoid overlapping tags. - -

    Embed Anchors and Character Tags, But Nothing Else

    -

    -It is acceptable to embed anchors within another HTML element: - -

    -    <H1><A HREF = "Destination.html">My heading</A></H1>
    -
    - -

    -Do not embed a heading or another HTML element within an anchor: - -

    -    <A HREF = "Destination.html">
    -    <H1>My heading</H1>
    -    </A>
    -
    - -

    -Although most browsers currently handle this example, it is forbidden -by the official HTML and HTML+ specifications, and will not work with -future browsers. - -

    -Character tags modify the appearance of other tags: - -

    -    <UL><LI><B>A bold list item</B>
    -        <UL>
    -        <LI><I>An italic list item</I>
    -    </UL>
    -
    - -

    -However, avoid embedding other types of HTML element tags. For example, -it is tempting to embed a heading within a list, in order to make the -font size larger: - -

    -    <UL><LI><H1>A large heading</H1>
    -        <UL>
    -        <LI><H2>Something slightly smaller</H2>
    -    </UL>
    -
    - -

    -Although some browsers, such as NCSA Mosaic for the X Window System, -format this construct quite nicely, it is unpredictable (because it -is undefined) what other browsers will do. For compatibility with all -browsers, avoid these kinds of constructs. - -

    -What's the difference between embedding a <B> within -a <LI> tag as opposed to embedding a <H1> -within a <LI>? This is again a question of SGML. -The semantic meaning of <H1> is that it's the main -heading of a document and that it should be followed by the content -of the document.Thus it doesn't make sense to find a <H1> -within a list. - -

    -Character formatting tags also are generally not additive. You might -expect that - -

    -    <B><I>some text</I></B>
    -
    - -

    -would produce bold-italic text. On some browsers it does; other browsers -interpret only the innermost tag (here, the italics). - -

    Check Your Links

    -

    -When an <IMG> tag points at an image that does not -exist, a dummy image is substituted. When this happens, make sure that -the referenced image does in fact exist, that the hyperlink has the -correct information in the URL, and that the file permission is set -appropriately (world-readable). - -

    A Longer Example

    -

    -Here is a longer example of an HTML document: - -

    -    <HEAD>
    -    <TITLE>A Longer Example</TITLE>
    -    </HEAD>
    -    <BODY>
    -    <H1>A Longer Example</H1>
    -    This is a simple HTML document. This is the first
    -    paragraph. <P>
    -    This is the second paragraph, which shows special effects.  This is a 
    -    word in <I>italics</I>.  This is a word in <B>bold</B>.
    -    Here is an in-lined GIF image: <IMG SRC = "myimage.gif">. 
    -    <P>
    -    This is the third paragraph, which demonstrates links.  Here is 
    -    a hypertext link from the word <A HREF = "subdir/myfile.html">foo</A>
    -    to a document called "subdir/myfile.html". (If you 
    -    try to follow this link, you will get an error screen.) <P> 
    -    <H2>A second-level header</H2>
    -    Here is a section of text that should display as a 
    -    fixed-width font: <P>
    -    <PRE>
    -        On the stiff twig up there
    -        Hunches a wet black rook
    -        Arranging and rearranging its feathers in the rain ...
    -    </PRE>
    -    This is a unordered list with two items: <P>
    -    <UL>
    -    <LI> cranberries
    -    <LI> blueberries
    -    </UL>
    -    This is the end of my example document. <P>
    -    <ADDRESS>Me (me@mycomputer.univ.edu)</ADDRESS>
    -    </BODY>
    -
    - -Click here to see the formatted version. - -

    -In addition to tags already discussed, this example also uses the <HEAD> -... </HEAD> and <BODY> ... </BODY> -tags, which separate the document into introductory information about -the document and the main text of the document. These tags don't change -the appearance of the formatted document at all, but are useful for -several purposes (for example, NCSA Mosaic for Macintosh 2.0, for example, -allows you to browse just the header portion of document before deciding -whether to download the rest), and it is recommended that you use these -tags. - -

    For More Information

    -

    -This guide is only an introduction to HTML and not a comprehensive -reference. Below are additional sources of information. - -

    Fill-out Forms

    -

    -One major feature not discussed here is fill-out forms, which allows -users to return information to the World Wide Web server. For information -on fill-out forms, look at this - Fill-out -Forms Overview - -

    Style Guides

    -

    -The following offer advice on how to write ``good'' HTML: - -

    - -

    Other Introductory Documents

    -These cover similar information as this guide: - - -

    Additional References

    - -
    -
    -National Center for Supercomputing Applications / pubs@ncsa.uiuc.edu -
    - - diff --git a/dist/ntp/html/index.htm b/dist/ntp/html/index.htm deleted file mode 100644 index e9074e840f5b..000000000000 --- a/dist/ntp/html/index.htm +++ /dev/null @@ -1,197 +0,0 @@ - -The Network Time Protocol (NTP) Distribution -

    -The Network Time Protocol (NTP) Distribution -

    - -

    Introduction

    - -Note: The software contained in this distribution is available without -charge under the conditions set forth in the Copyright Notice. - -

    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. - -

    Background information on computer network time synchronization can -be found on the Executive Summary - Computer Network -Time Synchronization page. Discussion on protocol conformance issues -and interoperability with previous NTP versions can be found in the Protocol Conformance Statement page. Discussion on -year-2000 issues can be found in the Year 2000 -Conformance Statement page. Background information, bibliography and -briefing slides suitable for presentations can be found in the Network Time -Synchronization Project page. - -

    Building and Installing NTP

    - -The Building and Installing the Distribution -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 Configuration Options and Release Notes pages. - -

    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 Reference Clock Drivers 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. - -

    Configuring Clients and Servers

    -

    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 Quick Start page may be useful to get a -simple workstation on the air with an existing server. - -

    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 -ntp.conf, 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 Notes on -Configuring NTP and Setting up a NTP Subnet page. However, in many -common cases involving simple network topologies and workstations, the -file data can be specified entirely on the command line. - -

    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. - -

    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 Information on Time -and Frequency Services 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. - -

    Resolving Problems

    - -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 NTP Debugging Techniques and Hints and Kinks pages contain useful information -for identifying problems and devising solutions. - -

    Users are requested to report bugs, offer suggestions and contribute -additions to this distribution. The Patching -Procedures page suggests procedures which greatly simplify -distribution updates, while the Porting Hints -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 Reference Clock Drivers page. Further -information on NTP in the Internet can be found in the NTP -web page. - -

    Program Manual Pages

    - - - -

    Supporting Documentation

    - - - -

    Application Notes

    - - - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/kern.htm b/dist/ntp/html/kern.htm deleted file mode 100644 index ea5c9f23abf5..000000000000 --- a/dist/ntp/html/kern.htm +++ /dev/null @@ -1,51 +0,0 @@ - -A Kernel Model for Precision Timekeeping -

    -A Kernel Model for Precision Timekeeping -


    - -

    The technical memorandum: A Kernel Model for Precision -Timekeeping -(PostScript) 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. - -

    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 kernel.tar.Z or by -anonymous FTP from ftp.udel.edu in the pub/ntp directory. - -

    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 -xntpd and Version 4  ntpd 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, ntp_gettime(), which returns a structure -including the current time, estimated error and maximum error, and -ntp_adjtime(), 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 -/usr/include/sys/timex.h file.  - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/kernpps.htm b/dist/ntp/html/kernpps.htm deleted file mode 100644 index a194a67136bb..000000000000 --- a/dist/ntp/html/kernpps.htm +++ /dev/null @@ -1,26 +0,0 @@ - -A Kernel Programming Interface for Precision Time Signals -Network Performance Evaluation -

    -A Kernel Programming Interface for Precision Time Signals -


    - -

    The technical memorandum: A Kernel Programming Interface for -Precision Time Signals -(PostScript) 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. - -

    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. - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/ldisc.htm b/dist/ntp/html/ldisc.htm deleted file mode 100644 index 5dd732699882..000000000000 --- a/dist/ntp/html/ldisc.htm +++ /dev/null @@ -1,161 +0,0 @@ - - -Line Disciplines and Streams Modules -

    -Line Disciplines and Streams Modules -


    - -

    Description

    - -

    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. - -

    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 -ntpd. 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. - -

    There are two line disciplines and a special streams module included -in the distribution. Support for each in ntpd is enabled -by adding flags to the DEFS_LOCAL line of the -ntpd configuration file ./Config.local. This -can be done automatically by the autoconfiguration build procedures, or -can be inserted/deleted after the process has completed. - -

    - -
    tty_clk -
    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 timeval format. Both -select() and SIGIO are supported by the -routine. The -DTTYCLK flag is used to compile support for -this discipline in ntpd. This flag is automatically -included if the clkdefs.h file is found in the -/usr/include/sys 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 README file in the -./kernel directory. - -

    tty_chu -
    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 Reference Clock Drivers page. This discipline -should be used in raw mode. The -DCHUCLK flag is used to -compile support for this discipline in ntpd. This flag is -automatically included if the chudefs.h file is found in -the /usr/include/sys 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 README file -in the ./kernel directory. -

    ppsclock -
    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 Gadget Box PPS Level Converter and CHU Modem page. -For each positive-going edge of the DCD signal, the -ppsclock module captures a timestamp in Unix -timeval format for later retrieval using a special -ioctl() system call. The -DPPS flag is used to -compile support for this module in ntpd. This flag is -automatically included if the ppsclock.h file is found in -the /sys/sys 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 README file in -the ./kernel directory. - -
    - -

    There are two versions of both the tty_clk and -chu_clk programs. The tty_clk.c and -chu_clk.c are designed for use with older BSD systems and -are compiled in the kernel. The tty_clk_STREAMS.c and -chu_clk_STREAMS.c 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 README file in the -./kernel directory. - -

    How to Use the tty_clk Line Discipline

    - -

    The tty_clk line discipline defines a new ioctl(), -CLK_SETSTR, which takes a pointer to a string of no more -than 32 characters. Until the first CLK_SETSTR is -performed, the discipline will simply pass through characters. Once it -is passed a string by CLK_SETSTR, any character in that -string will be immediately followed by a timestamp in Unix -timeval format. You can change the string whenever you want -by doing another CLK_SETSTR. 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 CLK_SETSTR -turns off timestamping. Passing NULL will produce undefined -results. - -

    How to Use the tty_chu Line Discipline

    - -

    The tty_chu line discipline translates data received from the CHU -modem and returns chucode structures, as defined in -chudefs.h, and expected by the Scratchbuilt CHU Receiver reference clock -driver. Depending on the settings of PEDANTIC and -ANAL_RETENTIVE used when compiling the kernel, some -checking of the data may or may not be necessary. - -

    How to Use the ppsclock Stream Module

    - -

    The ppsclock streams module implements an ioctl() -CIOGETEV, which takes a pointer to the structure - -

    -struct ppsclockev {
    -     struct timeval tv;
    -     u_int serial;
    -};
    -
    - -

    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 CIOGETEV ioctl() call, -the current values of the timestamp and counter are returned in the -ppsclockev structure. - -

    TIOCDCDTIMESTAMP timestamping

    - -

    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. - -

    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. - -


    David L. Mills (mills@udel.edu)
    diff --git a/dist/ntp/html/measure.htm b/dist/ntp/html/measure.htm deleted file mode 100644 index 6a0d486a9beb..000000000000 --- a/dist/ntp/html/measure.htm +++ /dev/null @@ -1,50 +0,0 @@ - -Time and Time Interval Measurement with Application to Computer and -Network Performance Evaluation -

    -Time and Time Interval Measurement with Application to Computer and -Network Performance Evaluation -


    - -

    The technical memorandum: Time and Time Interval Measurement -with Application to Computer and Network Performance Evaluation -(PostScript) describes a number of techniques for conducting -experiments typical of computer network and transmission systems -engineering. - -

    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. - -

    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. - -

    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. - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/miscopt.htm b/dist/ntp/html/miscopt.htm deleted file mode 100644 index e0bed056a42f..000000000000 --- a/dist/ntp/html/miscopt.htm +++ /dev/null @@ -1,167 +0,0 @@ - -Miscellaneous Options -

    -Miscellaneous Options -


    - -
    - -
    broadcastdelay seconds
    -
    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.
    - -
    driftfile driftfile -
    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.
    - -

    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 ntpd must have write -permission for the directory the drift file is located in, and that file -system links, symbolic or otherwise, should be avoided.
    - -
    enable [auth | bclient | kernel | monitor | ntp | stats] -
    disable [auth | bclient | kernel | monitor | ntp | stats -
    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 ntpdc -utility program.
    - -
    - -
    auth
    -
    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.
    - -
    bclient
    -
    When enabled, this is identical to the broadcastclient -command. The default for this flag is disable.
    - -
    kernel
    -
    Enables the precision-time kernel support for the -ntp_adjtime() 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 -enable.
    - -
    monitor
    -
    Enables the monitoring facility. See the ntpdc program and -the monlist command or further information. The default for -this flag is enable.
    - -
    ntp
    -
    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 Reference Clock Drivers page for further -information. The default for this flag is enable.
    - -
    stats
    -
    Enables the statistics facility. See the Monitoring Options page for further information. -The default for this flag is enable.
    - -
    - -
    logconfig configkeyword
    -
    This command controls the amount and type of output written to the -system syslog facility or the alternate logfile log -file. By default, all output is turned on. All -configkeyword keywords can be prefixed with =, -+ and -, where = sets the -syslogmask, + adds and - removes messages. -syslog messages can be controlled in four classes (, -peer, sys and sync). Within these classes -four types of messages can be controlled.
    - -
    Informational messages (info) control configuration -information. Event messages (events) control logging of events -(reachability, synchronization, alarm conditions). Statistical output is -controlled with the statistics 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 allprefix can be used instead -of a message class. A message class may also be followed by the -all keyword to enable/disable all messages of the respective -message class.
    - -
    Thus, a minimal log configuration could look like this:
    - -

    logconfig = syncstatus +sysevents
    - -

    This would just list the synchronizations state of ntpd -and the major system events. For a simple reference server, the -following minimum message configuration could be useful:
    - -

    logconfig = syncall +clockall
    - -

    This configuration will list all clock information and -synchronization information. All other events and messages about peers, -system events and so on is suppressed.
    - -
    logfile logfile
    -
    This command specifies the location of an alternate log file to be -used instead of the default system syslog facility.
    - -
    setvar variable [default]
    -
    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 name = value is -followed by the default keyword, the variable will be listed as -part of the default system variables (ntpq rv 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 -setvar mechanism. There are three special variables that -contain the names of all variable of the same group. The -sys_var_list holds the names of all system variables. The -peer_var_list holds the names of all peer variables and the -clock_var_list holds the names of the reference clock -variables.
    - -
    trap host_address [port port_number] [interface -interface_address]
    -
    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.
    - -
    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.
    - -
    - -

    Files

    - -ntp.drift frequency compensation (PPM) - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/monopt.htm b/dist/ntp/html/monopt.htm deleted file mode 100644 index eb7cc181c6b1..000000000000 --- a/dist/ntp/html/monopt.htm +++ /dev/null @@ -1,250 +0,0 @@ - -Monitoring Options -

    -Monitoring Options -


    - -

    Monitoring Support

    - -ntpd includes a comprehensive monitoring facility suitable for -continuous, long term recording of server and client timekeeping -performance. See the statistics command below for a listing and -example of each type of statistics currently supported. Statistic files -are managed using file generation sets and scripts in the ./scripts -directory of this distribution. Using these facilities and Unix -cron jobs, the datacan be automatically summarized and archived -for retrospective analysis. - -

    Monitoring Commands

    - -
    - -
    statistics name [...]
    -
    Enables writing of statistics records. Currently, four kinds of -namestatistics are supported.
    - -
    - -
    loopstats
    -
    Enables recording of loop filter statistics information. Each update -of the local clock outputs a line of the following form to the file -generation set named loopstats:
    - -

    50935 75440.031 0.000006019 13.778190 0.000351733 0.013380 -6
    - -

    The first two fields show the date (Modified Julian Day) and time -(seconds and fraction past UTC midnight). The next five fields show time -offset (seconds), frequency offset (parts per million - PPM), RMS jitter -(seconds), Allan deviation (PPM) and clock discipline time -constant.
    - -
    peerstats
    -
    Enables recording of peer statistics information. This includes -statistics records of all peers of a NTP server and of special signals, -where present and configured. Each valid update appends a line of the -following form to the current element of a file generation set named -peerstats:
    - -

    48773 10847.650 127.127.4.1 9714 -0.001605 0.00000 -0.00142
    - -

    The first two fields show the date (Modified Julian Day) and time -(seconds and fraction past UTC midnight). The next two fields show the -peer address in dotted-quad notation and status, respectively. The -status field is encoded in hex in the format described in Appendix A of -the NTP specification RFC 1305. The final three fields show the offset, -delay and RMS jitter, all in seconds.
    - -
    clockstats
    -
    Enables recording of clock driver statistics information. Each -update received from a clock driver appends a line of the following form -to the file generation set named clockstats:
    - -

    49213 525.624 127.127.4.1 93 226 00:08:29.606 D
    -

    The first two fields show the date (Modified Julian Day) and time -(seconds and fraction past UTC midnight). The next field shows the clock -address in dotted-quad notation, The final field shows the last timecode -received from the clock in decoded ASCII format, where meaningful. In -some clock drivers a good deal of additional information can be gathered -and displayed as well. See information specific to each clock for -further details.
    - -
    rawstats
    -
    Enables recording of raw-timestamp statistics information. This -includes statistics records of all peers of a NTP server and of special -signals, where present and configured. Each NTP message received from a -peer or clock driver appends a line of the following form to the file -generation set named rawstats:
    - -

    50928 2132.543 128.4.1.1 128.4.1.20 3102453281.584327000 -3102453281.58622800031 02453332.540806000 3102453332.541458000
    - -

    The first two fields show the date (Modified Julian Day) and time -(seconds and fraction past UTC midnight). The next two fields show the -remote peer or clock address followed by the local address in -dotted-quad notation, The final four fields show the originate, receive, -transmit and final NTP timestamps in order. The timestamp values are as -received and before processing by the various data smoothing and -mitigation algorithms.
    - -
    - -
    statsdir directory_path
    -
    Indicates the full path of a directory where statistics files should -be created (see below). This keyword allows the (otherwise constant) -filegen filename prefix to be modified for file generation -sets, which is useful for handling statistics logs.
    - -
    filegen name [file filename] [type -typename] [link | nolink] [enable | disable]
    -
    Configures setting of generation file set name. Generation -file sets provide a means for handling files that are continuously -growing during the lifetime of a server. Server statistics are a typical -example for such files. Generation file sets provide access to a set of -files used to store the actual data. At any time at most one element of -the set is being written to. The type given specifies when and how data -will be directed to a new element of the set. This way, information -stored in elements of a file set that are currently unused are available -for administrational operations without the risk of disturbing the -operation of ntpd. (Most important: they can be removed to free -space for new data produced.)
    - -
    Note that this command can be sent from the ntpdc program -running at a remote location.
    - -
    - -
    name
    -
    This is the type of the statistics records, as shown in the -statististics command.
    - -
    - -
    file filename
    - -
    - -
    This is the file name for the statistics records. Filenames of set -members are built from three concatenated elements -prefix, filename and -suffix:
    - -
    - -
    prefix
    -
    This is a constant filename path. It is not subject to modifications -via the filegen option. It is defined by the server, usually -specified as a compile-time constant. It may, however, be configurable -for individual file generation sets via other commands. For example, the -prefix used with loopstats and peerstats generation -can be configured using the statsdir option explained -above.
    - -
    filename
    -
    This string is directly concatenated to the prefix mentioned above -(no intervening / (slash)). This can be modified using the -file argument to the filegen statement. No .. -elements are allowed in this component to prevent filenames referring to -parts outside the filesystem hierarchy denoted by prefix.
    - -
    suffix
    -
    This part is reflects individual elements of a file set. It is -generated according to the type of a file set.
    - -
    - -
    - -
    type typename
    - -
    - -
    A file generation set is characterized by its type. The following -types are supported:
    - -
    - -
    none
    -
    The file set is actually a single plain file.
    - -
    pid
    -
    One element of file set is used per incarnation of a ntpd -server. This type does not perform any changes to file set members -during runtime, however it provides an easy way of separating files -belonging to different ntpd server incarnations. The set member -filename is built by appending a . (dot) to concatenated -prefix and filename strings, and appending the decimal -representation of the process ID of the ntpd server -process.
    - -
    day
    -
    One file generation set element is created per day. A day is defined -as the period between 00:00 and 24:00 UTC. The file set member suffix -consists of a . (dot) and a day specification in the form -YYYYMMdd. YYYY is a 4-digit year number (e.g., 1992). -MM is a two digit month number. dd is a two digit day -number. Thus, all information written at 10 December 1992 would end up -in a file named prefix filename.19921210.
    - -
    week
    -
    Any file set member contains data related to a certain week of a -year. The term week is defined by computing day-of-year modulo 7. -Elements of such a file generation set are distinguished by appending -the following suffix to the file set filename base: A dot, a 4-digit -year number, the letter W, and a 2-digit week number. For -example, information from January, 10th 1992 would end up in a file with -suffix .1992W1.
    - -
    month
    -
    One generation file set element is generated per month. The file -name suffix consists of a dot, a 4-digit year number, and a 2-digit -month.
    - -
    year
    -
    One generation file element is generated per year. The filename -suffix consists of a dot and a 4 digit year number.
    - -
    age
    -
    This type of file generation sets changes to a new element of the -file set every 24 hours of server operation. The filename suffix -consists of a dot, the letter a, and an 8-digit number. This -number is taken to be the number of seconds the server is running at the -start of the corresponding 24-hour period. Information is only written -to a file generation by specifying enable; output is prevented -by specifying disable.
    - -
    - -
    - -
    link | nolink
    - -
    - -
    It is convenient to be able to access the current element of a file -generation set by a fixed name. This feature is enabled by specifying -link and disabled using nolink. If link is -specified, a hard link from the current file set element to a file -without suffix is created. When there is already a file with this name -and the number of links of this file is one, it is renamed appending a -dot, the letter C, and the pid of the ntpd server -process. When the number of links is greater than one, the file is -unlinked. This allows the current file to be accessed by a constant -name.
    - -
    - -
    enable | disable
    - -
    - -
    Enables or disables the recording function.
    - -
    - -
    - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/mx4200data.htm b/dist/ntp/html/mx4200data.htm deleted file mode 100644 index bca04748cebf..000000000000 --- a/dist/ntp/html/mx4200data.htm +++ /dev/null @@ -1,443 +0,0 @@ - - - - MX4200 Receiver Data Format - - -

    MX4200 Receiver Data Format

    - -
    -

    Table of Contents

    - - - -
    - -

    Control Port Sentences

    - -

    The Control (CDU) Port is used to initialize, monitor, and control -the receiver. The structure of the control port sentences is based on -the NMEA-0183 Standard for Interfacing Marine Electronics -Navigation Devices (version 1.5). For more details, please refer to -the NMEA-0183 Specification available from the -National Marine Electronics -Association.

    - -

    Reserved characters are used to indicate the beginning and the end -of records in the data stream, and to delimit data fields within a -sentence. Only printable ASCII characters (Hex 20 through 7F) may be -used in a sentence. Table 2 lists the reserved -characters and defines their usage. Table 1 -illustrates the general Magnavox proprietary NMEA sentence format. -

    - -

    Table 1. Magnavox Proprietary NMEA Sentence Format

    - -$PMVXG,XXX,...................*CK - - -

    - - -
    Character Meaning -
    $ Sentence Start Character -
    P Special ID (P = Proprietary) -
    MVX Originator ID (MVX = Magnavox) -
    G Interface ID (G = GPS) -
    XXX Sentence Type -
    ... Data -
    * Optional Checksum Field Delimiter -
    CK Optional Checksum -
    - -

    Table 2. NMEA Sentence Reserved Characters

    - - -
    Character Hex Value Usage -
    $ 24 Start of Sentence Identifier -
    {cr}{lf} 0D 0A End of Sentence Identifier -
    , 2C Sentence Delimiter -
    * 2A Optional Checksum Field Delimiter -
    - -

    Following the start character $, are five characters -which constitute the block label of the sentence. For Magnavox -proprietary sentences, this label is always PMVXG. The -next field after the block label is the sentence type, consisting of -three decimal digits.

    - -

    The data, delimited by commas, follows the sentence type. Note that -the receiver uses a free-format parsing algorithm, so you need not send -the exact number of characters shown in the examples. You will need to -use the commas to determine how many bytes of data need to be -retrieved.

    - -

    The notation CK shown in Table 1 -symbolically indicates the optional checksum in the examples. The -checksum is computed by exclusive-ORing all of the bytes between the -$ and the * characters. The $ , -* and the checksum are not included in the checksum -computation.

    - -

    Checksums are optional for Control Port input sentences, but are -highly recommended to limit the effects of communication errors. -Magnavox receivers always generate checksums for Control Port output -sentences.

    - -

    ASCII data characters are transmitted in the following format:

    - - -
    Data Bits 8 (msb always 0) -
    Parity None -
    Stop Bits 1 -
    - -

    NULL fields are fields which do not contain any data. They would -appear as two commas together in the sentence format, except for the -final field. Some Magnavox proprietary sentences require that the -format contain NULL fields. mandatory NULL fields are identified by an -'*' next to the respective field.

    - -
    - -

    Control Port Input Sentences

    -These are the subset of the MX4200 control port input sentences sent by -the NTP driver to the GPS receiver. - -
    - -

    $PMVXG,000

    -

    Initialization/Mode Control - Part A

    -Initializes the time, position and antenna height of the MX4200. - -

    - -
    Field Description Units Format Default Range -
    1 Day   Int   1-31 -
    2 Month   Int   1-12 -
    3 Year   Int   1991-9999 -
    4 GMT Time HHMMSS Int   000000-235959 -
    5 WGS-84 Latitude DDMM.MMMMFloat0.0 0 - 8959.9999 -
    6 North/South Indicator   Char N N,S -
    7 WGS-84 Longitude DDDMM.MMMMFloat0.0 0 - 17959.9999 -
    8 East/West Indicator   Char E E,W -
    9 Altitude (height above Mean Sea Level) in meters (WGS-84) MetersFloat0.0+/-99999.0 -
    10 Not Used         -
    -Example:
    -$PMVXG,000,,,,,,,,,,*48
    -$PMVXG,000,,,,,5128.4651,N,00020.0715,W,58.04,*4F - -


    - -

    $PMVXG,001

    -

    Initialization/Mode Control - Part B

    -Specifies various navigation parameters: Altitude aiding, acceleration -DOP limits, and satellite elevation limits. - -

    - -
    Field Description Units Format Default Range -
    *1 Constrain Altitude   Int 1 0=3D Only
    1=Auto
    2=2D Only -
    2 Not Used        -
    *3 Horizontal Acceleration Factorm/sec^2 Float 1.0 0.5-10.0 -
    *4 Not Used        -
    *5 VDOP Limit   Int 10 1-9999 -
    *6 HDOP Limit   Int 10 1-9999 -
    7 Elevation Limit Deg Int 5 0-90 -
    8 Time Output Mode   Char U U=UTC
    L=Local Time -
    9 Local Time Offset HHMM Int 0 +/- 0-2359 -
    -Example:
    -$PMVXG,001,3,,0.1,0.1,10,10,5,U,0*06 - -


    - - -

    $PMVXG,007

    -

    Control Port Output Configuration

    -This message enables or disables output of the specified sentence and -defines the output rate. The user sends this message for each sentence -that the receiver is to output. - -

    - -
    Field Description Units Format Default Range -
    1 Control Port Output Block Label Char     -
    2 Clear Current Output List Int   0=No
    1=Yes -
    3 Add/Delete Sentence from List Int   1=Append
    2=Delete -
    4 Not Used         -
    5 Sentence Output Rate Sec Int   1-9999 -
    6 # digits of Precision for CGA and GLL sentences  Int 2 2-4 -
    7 Not Used         -
    8 Not Used         -
    -Example:
    -$PMVXG,007,022,0,1,,1,,,*4F - -


    - - -

    $PMVXG,023

    -

    Time Recovery Configuration

    -This message is used to enable/disable the time recovery feature of the -receiver. The time synchronization for the 1PPS output is specified in -addition to a user time bias and an error tolerance for a valid pulse. -This record is accepted in units configured for time recovery. If the -back panel contains a 1PPS outlet, the receiver is a time recovery -unit. - -

    - -
    Field Description Units Format Default Range -
    *1 Time Recovery Mode   Char D D=Dynamic
    S=Static
    K=Known Position
    N=No Time Recovery -
    2 Time Synchronization   Char G U=UTC
    G=GPS -
    3 Time Mark Mode   Char A A=Always
    V=Valid Pulses Only -
    4 Maximum Time Error Nsec Int 100 50-1000 -
    5 User Time Bias Nsec Int 0 +/- 99999 -
    6 ASCII Time Message Control Int 0 0=No Output
    1=830 to Control Port
    2=830 to Equipment Port -
    7 Known Pos PRN   Int 0 1-32
    0=Track All Sats -
    -Example:
    -$PMVXG,023,S,U,A,500,0,1,*16 - -


    - - -

    $CDGPQ,YYY

    -

    Query From a Remote Device / Request to Output a Sentence

    -Enables the controller to request a one-time transmission of a specific -block label. To output messages at a periodic rate, refer to input -sentence $PMVXG,007. - -

    - -
    Field Description Units Format Default Range -
    1:CD ID of Remote Device   Char   (See NMEA-0183) -
    2:GP GPS   Char   (See NMEA-0183) -
    3:Q Query   Char   (See NMEA-0183) -
    4:YYY Label of Desired Sentence Char   Any Valid NMEA or Magnavox Sentence Type -
    -Example:
    -$CDGPQ,030*5E - - - -


    -

    Control Port Output Sentences

    -These are the subset of the MX4200 control port output sentences -recognized by the NTP driver. - -
    - -

    $PMVXG,000

    -

    Receiver Status

    -Returns the current status of the receiver including the operating -mode, number of satellites visible, and the number of satellites being -tracked. - -

    - -
    Field Description Units Format Range -
    1 Current Receiver Status   Char ACQ=Reacquisition
    ALT=Constellation Selection
    IAC=Initial Acquisition
    IDL=Idle, No Satellites
    NAV=Navigating
    STS=Search The Sky
    TRK=Tracking -
    2 Number of Satellites that should be Visible  Int 0-12 -
    3 Number of Satellites being Tracked   Int 0-12 -
    4 Time since Last Navigation HHMM Int 0-2359 -
    5 Initialization Status   Int 0=Waiting for Initialization
    1=Initialization Complete -
    -Example:
    -$PMVXG,000,TRK,3,3,0122,1*19 - -


    - -

    $PMVXG,021

    -

    Position, Height, Velocity

    -This sentence gives the receiver position, height, navigation mode and -velocity north/east. This sentence is intended for post analysis -applications. - -

    - -
    Field Description Units Format Range -
    1 UTC Measurement Time Seconds into the weekFloat0-604800.00 -
    2 WGS-84 Latitude DDMM.MMMMFloat 0-89.9999 -
    3 North/South Indicator   Char N, S -
    4 WGS-84 Longitude DDDMM.MMMM Float 0-179.9999 -
    5 East/West Indicator   Char E, W -
    6 Altitude (MSL) Meters Float   -
    7 Geoidal Height Meters Float   -
    8 Velocity East M/Sec Float   -
    9 Velocity North M/Sec Float   -
    10 Navigation Mode   Int Navigating
    - 1=Position From a Remote Device
    - 2=2D
    - 3=3D
    - 4=2D differential
    - 5=3D differential
    - Not Navigating
    - 51=Too Few Satellites
    - 52=DOPs too large
    - 53=Position STD too large
    - 54=Velocity STD too large
    - 55=Too many iterations for velocity
    - 56=Too many iterations for position
    - 57=3 Sat Startup failed -
    -Example:
    -$PMVXG,021,142244.00,5128.4744,N,00020.0593,W,00054.4,0047.4,0000.1,-000.2,03*66 - -


    - -

    $PMVXG,022

    -

    DOPs

    -This sentence reports the DOP (Dilution Of Precision) values actually -used in the measurement processing corresponding to the satellites -listed. The satellites are listed in receiver channel order. Fields -11-16 are output only on 12-channel receivers. - -

    - -
    Field Description Units Format Range -
    1 UTC Measurement Time Seconds into the weekFloat0-604800.00 -
    2 East DOP (EDOP)   Float   -
    3 North DOP (NDOP)   Float   -
    4 Vertical DOP (VDOP)   Float   -
    5 PRN on Channel #1   Int 1-32 -
    6 PRN on Channel #2   Int 1-32 -
    7 PRN on Channel #3   Int 1-32 -
    8 PRN on Channel #4   Int 1-32 -
    9 PRN on Channel #5   Int 1-32 -
    10 PRN on Channel #6   Int 1-32 -
    11 PRN on Channel #7   Int 1-32 -
    12 PRN on Channel #8   Int 1-32 -
    13 PRN on Channel #9   Int 1-32 -
    14 PRN on Channel #10   Int 1-32 -
    15 PRN on Channel #11   Int 1-32 -
    16 PRN on Channel #12   Int 1-32 -
    -Example:
    -$PMVXG,022,142243.00,00.7,00.8,01.9,27,26,10,09,13,23*77 - -


    - -

    $PMVXG,030

    -

    Software Configuration

    -This sentence contains the navigation processor and baseband firmware -version numbers. - -

    - -
    Field Description Units Format Range -
    1 Nav Processor Version Number   Char   -
    2 Baseband Firmware Version Number   Char   -
    -Example:
    -$PMVXG,030,DA35,015 - -


    - -

    $PMVXG,101

    -

    Control Sentence Accept/Reject

    -This sentence is returned (on the Control Port) for every -$PMVXG and $XXGPQ sentence that is -received. - -

    - -
    Field Description Units Format Range -
    1 Sentence ID   Char   -
    2 Accept/Reject Status   Int 0=Sentence Accepted
    - 1=Bad Checksum
    - 2=Illegal Value
    - 3=Unrecognized ID
    - 4=Wrong # of fields
    - 5=Required Data Field Missing
    - 6=Requested Sentence Unavailable -
    3 Bad Field Index   Int   -
    4 Requested Sentence ID (If field #1 = GPQ)   Char   -
    -Example:
    -$PMVXG,101,GPQ,0,,030*0D - -


    - -

    $PMVXG,523

    -

    Time Recovery Configuration

    -This sentence contains the configuration of the time recovery function -of the receiver. - -

    - -
    Field Description Units Format Range -
    1 Time Recovery Mode   Char D=Dynamic
    S=Static
    K=Known Position
    N=No Time Recovery -
    2 Time Synchronization   Char U=UTC Time
    G=GPS Time -
    3 Time Mark Mode   Char A=Always Output Time Pulse
    V=Only when Valid -
    4 Maximum Time Error for which a time mark will be considered valid Nsec Int   -
    5 User Time Bias Nsec Int   -
    6 Time Message Control   Int 0=No Message
    1=830 to Control Port
    2=830 to Equipment Port -
    7 Not Used       -
    -Example:
    -$PMVXG,523,S,U,A,0500,000000,1,0*23 - -


    - -

    $PMVXG,830

    -

    Time Recovery Results

    -This sentence is output approximately 1 second preceding the 1PPS -output. It indicates the exact time of the next pulse, whether or not -the time mark will be valid (based on operator-specified error -tolerance), the time to which the pulse is synchronized, the receiver -operating mode, and the time error of the last 1PPS -output. The leap second flag (Field #11) is not output by older -receivers. - -

    - -
    Field Description Units Format Range -
    1 Time Mark Valid   Char T=Valid
    F=Not Valid -
    2 Year   Int 1993- -
    3 Month   Int 1-12 -
    4 Day Nsec Int 1-31 -
    5 Time HH:MM:SSInt 00:00:00-23:59:59 -
    6 Time Synchronization   Char U=UTC
    G=GPS -
    7 Operating Mode   Char D=Dynamic
    S=Static
    K=Known Position -
    8 Oscillator Offset - estimate of oscillator frequency error PPB Int   -
    9 Time Mark Error of last pulse Nsec Int   -
    10 User Time Bias Nsec Int   -
    11 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. -   Int -1,0,1 -
    -Example:
    -$PMVXG,830,T,1998,10,12,15:30:46,U,S,000298,00003,000000,01*02 - -


    - - - - diff --git a/dist/ntp/html/notes.htm b/dist/ntp/html/notes.htm deleted file mode 100644 index d55067980f32..000000000000 --- a/dist/ntp/html/notes.htm +++ /dev/null @@ -1,1543 +0,0 @@ - -Notes on Configuring NTP and Setting up a NTP Subnet</H3> -

    -Notes on Configuring NTP and Setting up a NTP Subnet

    - - -

    Introduction

    - -This document is a collection of notes concerning the use of ntpd and -relatedprograms, and on coping with the Network Time Protocol (NTP) in -general. It is a major rewrite and update of an earlier document written -by Dennis Ferguson of the University of Toronto and includes many -changes and additions resulting from the NTP Version 3 specification and -new Version 4 implementation features. It supersedes earlier documents, -which should no longer be used -for new configurations. - -

    ntpd includes a complete implementation of the NTP Version -3 specification, as defined in: - -

      - -

    • 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: -PostScript | -PDF, Body: -PostScript | -PDF, Appendices: -PostScript | -PDF - -
    -Additional features have are described for NTP -Version 4. It also retains compatibility with both NTP Version 2, as -defined in RFC-1119, and NTP Version 1, as defined in RFC-1059, although -this compatibility is sometimes strained and only semiautomatic. In -order to support in principle the ultimate precision of about 232 -picoseconds in the NTP specification, ntpd uses NTP timestamp -format for external communication and double precision floating point -arithmetic internally. ntpd fully implements NTP Versions 2 and -3 authentication and in addition Version 4 autokey. It supports the NTP -mode-6 control message facility along with a private mode-7 control- -message facility used to remotely reconfigure the system and monitor a -considerable amount of internal detail. As extensions to the -specification, a flexible address-and-mask restriction facility has been -included. - -

    The code is biased towards the needs of a busy time server with -numerous, often hundreds, of clients and other servers. Tables are -hashed to allow efficient handling of many associations, though at the -expense of additional overhead when the number of associations is small. -Many fancy features have been included to permit efficient management -and monitoring of a busy primary server, features which are probably -excess baggage for a high stratum client. In such cases, a stripped-down -version of the protocol, the Simple Network Time Protocol (SNTP) can be -used. SNTP and NTP servers and clients can interwork in most situations, -as described in: Mills, D.L. Simple Network Time Protocol (SNTP). -Network Working Group Report RFC-2030, University of Delaware, October -1996, 14 pp. -(ASCII). - -

    The code was written with near demonic attention to details which can -affect precision and as a consequence should be able to make good use of -high performance, special purpose hardware such as precision oscillators -and radio clocks. The present code supports a number of radio clocks, -including those for the WWV, CHU, WWVB, MSF, DCF77, GOES and GPS radio -and satellite time services and USNO, ACTS and PTB modem time services. -It also supports the IRIG-B and IRIG-E signal format connected via an -audio codec. The server methodically avoids the use of Unix-specific -library routines where possible by implementing local versions, in order -to aid in porting the code to perverse Unix and non-Unix platforms. - -

    While this implementation conforms in most respects to the NTP -Version 3 specification RFC-1305, a number of improvements have been -made which are described in the conformance statement in the Further Information and Bibliography page. It has -been specifically tuned to achieve the highest accuracy possible on -whatever hardware and operating-system platform is available. In -general, its precision and stability are limited only by the -characteristics of the onboard clock source used by the hardware -and operating system, usually an uncompensated crystal oscillator. On -modern RISC-based processors connected directly to radio clocks via -serial-asynchronous interfaces, the accuracy is usually limited by the -radio clock and interface to the order of a millisecond or less. The -code includes special features to support a pulse-per-second (PPS) -signal and/or an IRIG-B signal generated by some radio clocks. When used -in conjunction with a suitable hardware level converter, the accuracy -can be improved to a few tens of microseconds. -Further improvement is possible using an outboard, stabilized frequency -source, in which the accuracy and stability are limited only by the -characteristics -of that source. - -

    The NTP Version 4 distribution includes, in addition to the daemon -itself (ntpd), several utility programs, -including two remote-monitoring programs ( -ntpq, ntpdc), a remote -clock-setting program similar to the Unix rdate program -(ntpdate), a traceback utility u seful to discover suitable -synchronization sources (ntptrace), and various programs used -to configure the local platform and calibrate the intrinsic errors. NTP -has been ported to a large number of platforms, including most RISC and -CISC workstations and mainframes manufactured today. Example -configuration files for many models of these machines are included -in the distribution. While in most cases the standard version of the -implementation runs with no hardware or operating system modifications, -not all features of the distribution are available on all platforms. For -instance, a special feature allowing Sun workstations to achieve -accuracies in the order of 100 microseconds requires some minor changes -and additions to the kernel and input/output support. - -

    There are, however, several drawbacks to all of this. ntpd -is quite fat. This is rotten if your intended platform for the daemon is -memory limited. ntpd uses SIGIO for all input, a -facility which appears to not enjoy universal support and whose use -seems to exercise the parts of your vendors' kernels which are most -likely to have been done poorly. The code is unforgiving in the face of -kernel problems which affect performance, and generally requires that -you repair the problems in order to achieve acceptable performance. The -code has a distinctly experimental flavour and contains features which -could charitably be termed failed -experiments, but which have not been completely hacked out. Much was -learned from the addition of support for a variety of radio clocks, -with the result that some radio clock drivers could use some rewriting. - -

    How NTP Works

    - -The approach used by NTP to achieve reliable time synchronization from -a set of possibly unreliable remote time servers is somewhat different -than other protocols. In particular, NTP does not attempt to synchronize -clocks to each other. Rather, each server attempts to synchronize to -Universal -Coordinated Time (UTC) using the best available source and available -transmission -paths to that source. This is a fine point which is worth understanding. -A group of NTP-synchronized clocks may be close to each other in time, -but this is not a consequence of the clocks in the group having -synchronized -to each other, but rather because each clock has synchronized closely to -UTC via the best source it has access to. As such, trying to synchronize -a set of clocks to a set of servers whose time is not in mutual -agreement -may not result in any sort of useful synchronization of the clocks, even -if you don't care about UTC. However, in networks isolated from UTC -sources, -provisions can made to nominate one of them as a phantom UTC source. - -

    NTP operates on the premise that there is one true standard time, and -that if several servers which claim synchronization to standard time -disagree -about what that time is, then one or more of them must be broken. There -is no attempt to resolve differences more gracefully since the premise -is that substantial differences cannot exist. In essence, NTP expects -that -the time being distributed from the root of the synchronization subnet -will be derived from some external source of UTC (e.g., a radio clock). -This makes it somewhat inconvenient (though by no means impossible) to -synchronize hosts together without a reliable source of UTC to -synchronize -them to. If your network is isolated and you cannot access other -people's -servers across the Internet, a radio clock may make a good investment. - -

    Time is distributed through a hierarchy of NTP servers, with each -server -adopting a stratum which indicates how far away from an external -source of UTC it is operating at. Stratum-1 servers, which are at the -top -of the pile (or bottom, depending on your point of view), have access to -some external time source, usually a radio clock synchronized to time -signal -broadcasts from radio stations which explicitly provide a standard time -service. A stratum-2 server is one which is currently obtaining time -from -a stratum-1 server, a stratum-3 server gets its time from a stratum-2 -server, -and so on. To avoid long lived synchronization loops the number of -strata -is limited to 15. - -

    Each client in the synchronization subnet (which may also be a server -for other, higher stratum clients) chooses exactly one of the available -servers to synchronize to, usually from among the lowest stratum servers -it has access to. This is, however, not always an optimal configuration, -for indeed NTP operates under another premise as well, that each -server's -time should be viewed with a certain amount of distrust. NTP really -prefers -to have access to several sources of lower stratum time (at least three) -since it can then apply an agreement algorithm to detect insanity on the -part of any one of these. Normally, when all servers are in agreement, -NTP will choose the best of these, where "best" is defined in terms of -lowest stratum, closest (in terms of network delay) and claimed -precision, -along with several other considerations. The implication is that, while -one should aim to provide each client with three or more sources of -lower -stratum time, several of these will only be providing backup service and -may be of lesser quality in terms of network delay and stratum (i.e., a -same-stratum peer which receives time from lower stratum sources the -local -server doesn't access directly can also provide good backup service). - -

    Finally, there is the issue of association modes. There are a number -of modes in which NTP servers can associate with each other, with the -mode -of each server in the pair indicating the behaviour the other server can -expect from it. In particular, when configuring a server to obtain time -from other servers, there is a choice of two modes which may be used. -Configuring -an association in symmetric-active mode (usually indicated by a -peer -declaration in the configuration file) indicates to the remote server -that -one wishes to obtain time from the remote server and that one is also -willing -to supply time to the remote server if need be. This mode is appropriate -in configurations involving a number of redundant time servers -interconnected -via diverse network paths, which is presently the case for most stratum- -1 -and stratum-2 servers on the Internet today. Configuring an association -in client mode (usually indicated by a server declaration in -the -configuration file) indicates that one wishes to obtain time from the -remote -server, but that one is not willing to provide time to the remote -server. -This mode is appropriate for file-server and workstation clients that do -not provide synchronization to other local clients. Client mode is also -useful for boot-date-setting programs and the like, which really have no -time to provide and which don't retain state about associations over the -longer term. - -

    Where the requirements in accuracy and reliability are modest, -clients -can be configured to use broadcast and/or multicast modes. These modes -are not normally utilized by servers with dependent clients. The -advantage -of these modes is that clients do not need to be configured for a -specific -server, so that all clients operating can use the same configuration -file. -Broadcast mode requires a broadcast server on the same subnet, while -multicast -mode requires support for IP multicast on the client machine, as well as -connectivity via the MBONE to a multicast server. Since broadcast -messages -are not propagated by routers, only those broadcast servers on the same -subnet will be used. There is at present no way to select which of -possibly -many multicast servers will be used, since all operate on the same group -address. - -

    Where the maximum accuracy and reliability provided by NTP are -needed, -clients and servers operate in either client/server or symmetric modes. -Symmetric modes are most often used between two or more servers -operating -as a mutually redundant group. In these modes, the servers in the group -members arrange the synchronization paths for maximum performance, -depending -on network jitter and propagation delay. If one or more of the group -members -fail, the remaining members automatically reconfigure as required. -Dependent -clients and servers normally operate in client/server mode, in which a -client or dependent server can be synchronized to a group member, but no -group member can synchronize to the client or dependent server. This -provides -protection against malfunctions or protocol attacks. - -

    Servers that provide synchronization to a sizeable population of -clients -normally operate as a group of three or more mutually redundant servers, -each operating with three or more stratum-one or stratum-two servers in -client-server modes, as well as all other members of the group in -symmetric -modes. This provides protection against malfunctions in which one or -more -servers fail to operate or provide incorrect time. The NTP algorithms -have -been specifically engineered to resist attacks where some fraction of -the -configured synchronization sources accidently or purposely provide -incorrect -time. In these cases a special voting procedure is used to identify -spurious -sources and discard their data. -

    -Configuring Your Subnet

    -At startup time the ntpd daemon running on a host reads the -initial -configuration information from a file, usually /etc/ntp.conf, -unless a different name has been specified at compile time. Putting -something -in this file which will enable the host to obtain time from somewhere -else -is usually the first big hurdle after installation of the software -itself, -which is described in the Building and Installing -the -Distribution page. At its simplest, what you need to do in the -configuration -file is declare the servers that the daemon should poll for time -synchronization. -In principle, no such list is needed if some other time server operating -in broadcast/multicast mode is available, which requires the client to -operate in a broadcastclient mode. - -

    In the case of a workstation operating in an enterprise network for -a public or private organization, there is often an administrative -department -that coordinates network services, including NTP. Where available, the -addresses of appropriate servers can be provided by that department. -However, -if this infrastructure is not available, it is necessary to explore some -portion of the existing NTP subnet now running in the Internet. There -are -at present many thousands of time servers running NTP in the Internet, -a significant number of which are willing to provide a public time- -synchronization -service. Some of these are listed in the list of public time servers, -which -can be accessed via the NTP web -page. These data are updated on a regular basis using information -provided -voluntarily by various site administrators. There are other ways to -explore -the nearby subnet using the ntptrace -and ntpdc programs. - -

    It is vital to carefully consider the issues of robustness and -reliability -when selecting the sources of synchronization. Normally, not less than -three sources should be available, preferably selected to avoid common -points of failure. It is usually better to choose sources which are -likely -to be "close" to you in terms of network topology, though you shouldn't -worry overly about this if you are unable to determine who is close and -who isn't. Normally, it is much more serious when a server becomes -faulty -and delivers incorrect time than when it simply stops operating, since -an NTP-synchronized host normally can coast for hours or even days -without -its clock accumulating serious error approaching a second, for instance. -Selecting at least three sources from different operating -administrations, -where possible, is the minimum recommended, although a lesser number -could -provide acceptable service with a degraded degree of robustness. - -

    Normally, it is not considered good practice for a single workstation -to request synchronization from a primary (stratum-1) time server. At -present, -these servers provide synchronization for hundreds of clients in many -cases -and could, along with the network access paths, become seriously -overloaded -if large numbers of workstation clients requested synchronization -directly. -Therefore, workstations located in sparsely populated administrative -domains -with no local synchronization infrastructure should request -synchronization -from nearby stratum-2 servers instead. In most cases the keepers of -those -servers in the lists of public servers provide unrestricted access -without -prior permission; however, in all cases it is considered polite to -notify -the administrator listed in the file upon commencement of regular -service. -In all cases the access mode and notification requirements listed in the -file must be respected. Under no conditions should servers not in these -lists be used without prior permission, as to do so can create severe -problems -in the local infrastructure, especially in cases of dial-up access to -the -Internet. - -

    In the case of a gateway or file server providing service to a -significant -number of workstations or file servers in an enterprise network it is -even -more important to provide multiple, redundant sources of synchronization -and multiple, diversity-routed, network access paths. The preferred -configuration -is at least three administratively coordinated time servers providing -service -throughout the administrative domain including campus networks and -subnetworks. -Each of these should obtain service from at least two different outside -sources of synchronization, preferably via different gateways and access -paths. These sources should all operate at the same stratum level, which -is one less than the stratum level to be used by the local time servers -themselves. In addition, each of these time servers should peer with all -of the other time servers in the local administrative domain at the -stratum -level used by the local time servers, as well as at least one -(different) -outside source at this level. This configuration results in the use of -six outside sources at a lower stratum level (toward the primary source -of synchronization, usually a radio clock), plus three outside sources -at the same stratum level, for a total of nine outside sources of -synchronization. -While this may seem excessive, the actual load on network resources is -minimal, since the interval between polling messages exchanged between -peers usually ratchets back to no more than one message every 17 -minutes. - -

    The stratum level to be used by the local time servers is an -engineering -choice. As a matter of policy, and in order to reduce the load on the -primary -servers, it is desirable to use the highest stratum consistent with -reliable, -accurate time synchronization throughout the administrative domain. In -the case of enterprise networks serving hundreds or thousands of client -file servers and workstations, conventional practice is to obtain -service -from stratum-1 primary servers listed for public access. When choosing -sources away from the primary sources, the particular synchronization -path -in use at any time can be verified using the ntptrace program -included in this distribution. It is important to avoid loops and -possible -common points of failure when selecting these sources. Note that, while -NTP detects and rejects loops involving neighboring servers, it does not -detect loops involving intervening servers. In the unlikely case that -all -primary sources of synchronization are lost throughout the subnet, the -remaining servers on that subnet can form temporary loops and, if the -loss -continues for an interval of many hours, the servers will drop off the -subnet and free-run with respect to their internal (disciplined) timing -sources. After some period with no outside timing source (currently one -day), a host will declare itself unsynchronized and provide this -information -to local application programs. - -

    In many cases the purchase of one or more radio clocks is justified, -in which cases good engineering practice is to use the configurations -described -above anyway and connect the radio clock to one of the local servers. -This -server is then encouraged to participate in a special primary-server -subnetwork -in which each radio-equipped server peers with several other similarly -equipped servers. In this way the radio-equipped server may provide -synchronization, -as well as receive synchronization, should the local or remote radio -clock(s) -fail or become faulty. ntpd treats attached radio clock(s) in -the same way as other servers and applies the same criteria and -algorithms -to the time indications, so can detect when the radio fails or becomes -faulty and switch to alternate sources of synchronization. It is -strongly -advised, and in practice for most primary servers today, to employ the -authentication or access-control features of the NTP specification in -order -to protect against hostile intruders and possible destabilization of the -time service. Using this or similar strategies, the remaining hosts in -the same administrative domain can be synchronized to the three (or -more) -selected time servers. Assuming these servers are synchronized directly -to stratum-1 sources and operate normally as stratum-2, the next level -away from the primary source of synchronization, for instance various -campus -file servers, will operate at stratum 3 and dependent workstations at -stratum -4. Engineered correctly, such a subnet will survive all but the most -exotic -failures or even hostile penetrations of the various, distributed -timekeeping -resources. -

    The above arrangement should provide very good, robust time service -with a minimum of traffic to distant servers and with manageable loads -on the local servers. While it is theoretically possible to extend the -synchronization subnet to even higher strata, this is seldom justified -and can make the maintenance of configuration files unmanageable. -Serving -time to a higher stratum peer is very inexpensive in terms of the load -on the lower stratum server if the latter is located on the same -concatenated -LAN. When justified by the accuracy expectations, NTP can be operated in -broadcast and multicast modes, so that clients need only listen for -periodic -broadcasts and do not need to send anything. - -

    When planning your network you might, beyond this, keep in mind a few -generic don'ts, in particular: -

      -
    • -Don't synchronize a local time server to another peer at the same -stratum, -unless the latter is receiving time from lower stratum sources the -former -doesn't talk to directly. This minimizes the occurrence of common points -of failure, but does not eliminate them in cases where the usual chain -of associations to the primary sources of synchronization are disrupted -due to failures.
    • - -
        -
    • -Don't configure peer associations with higher stratum servers. Let the -higher strata configure lower stratum servers, but not the reverse. This -greatly simplifies configuration file maintenance, since there is -usually -much greater configuration churn in the high stratum clients such as -personal -workstations.
    • -
        -
    • -Don't synchronize more than one time server in a particular -administrative -domain to the same time server outside that domain. Such a practice -invites -common points of failure, as well as raises the possibility of massive -abuse, should the configuration file be automatically distributed do a -large number of clients.
    • -
    -There are many useful exceptions to these rules. When in doubt, however, -follow them. -

    -Configuring Your Server or Client

    -As mentioned previously, the configuration file is usually called -/etc/ntp.conf. -This is an ASCII file conforming to the usual comment and whitespace -conventions. -A working configuration file might look like (in this and other -examples, -do not copy this directly): -
         # peer configuration for host whimsy
    -     # (expected to operate at stratum 2)
    -
    -     server rackety.udel.edu
    -     server umd1.umd.edu
    -     server lilben.tn.cornell.edu
    -
    -     driftfile /etc/ntp.drift
    -(Note the use of host names, although host addresses in dotted-quad -notation -can also be used. It is always preferable to use names rather than -addresses, -since over time the addresses can change, while the names seldom -change.) - -

    This particular host is expected to operate as a client at stratum 2 -by virtue of the server keyword and the fact that two of the -three -servers declared (the first two) have radio clocks and usually run at -stratum -1. The third server in the list has no radio clock, but is known to -maintain -associations with a number of stratum 1 peers and usually operates at -stratum -2. Of particular importance with the last host is that it maintains -associations -with peers besides the two stratum 1 peers mentioned. This can be -verified -using the ntpq program mentioned above. When configured using -the server keyword, this host can receive synchronization from -any of the listed servers, but can never provide synchronization to -them. - -

    Unless restricted using facilities described later, this host can -provide -synchronization to dependent clients, which do not have to be listed in -the configuration file. Associations maintained for these clients are -transitory -and result in no persistent state in the host. These clients are -normally -not visible using the ntpq program included in the -distribution; -however, ntpd includes a monitoring feature (described later) -which caches a minimal amount of client information useful for debugging -administrative purposes. - -

    A time server expected to both receive synchronization from another -server, as well as to provide synchronization to it, is declared using -the peer keyword instead of the server keyword. In all -other aspects the server operates the same in either mode and can -provide -synchronization to dependent clients or other peers. If a local source -of UTC time is available, it is considered good engineering practice to -declare time servers outside the administrative domain as peer -and those inside as server in order to provide redundancy in -the -global Internet, while minimizing the possibility of instability within -the domain itself. A time server in one domain can in principle heal -another -domain temporarily isolated from all other sources of synchronization. -However, it is probably unwise for a casual workstation to bridge -fragments -of the local domain which have become temporarily isolated. - -

    Note the inclusion of a driftfile declaration. One of the -things -the NTP daemon does when it is first started is to compute the error in -the intrinsic frequency of the clock on the computer it is running on. -It usually takes about a day or so after the daemon is started to -compute -a good estimate of this (and it needs a good estimate to synchronize -closely -to its server). Once the initial value is computed, it will change only -by relatively small amounts during the course of continued operation. -The -driftfile declaration indicates to the daemon the name of a -file -where it may store the current value of the frequency error so that, if -the daemon is stopped and restarted, it can reinitialize itself to the -previous estimate and avoid the day's worth of time it will take to -recompute -the frequency estimate. Since this is a desirable feature, a -driftfile -declaration should always be included in the configuration file. - -

    An implication in the above is that, should ntpd be stopped -for some reason, the local platform time will diverge from UTC by an -amount -that depends on the intrinsic error of the clock oscillator and the time -since last synchronized. In view of the length of time necessary to -refine -the frequency estimate, every effort should be made to operate the -daemon -on a continuous basis and minimize the intervals when for some reason it -is not running. - -

    -Configuring NTP with NetInfo

    -If NetInfo support is compiled into NTP, you can opt to configure ntp -in your NetInfo domain. NTP will look int he NetInfo directory -/locations/ntp for property/value pairs which are equivalent -the the lines in the configuration file described above. Each -configuration keyword may have a coresponding property in NetInfo. -Each value for a given property is treated as arguments to that property, -similar to a line in the configuration file. - -

    For example, the configuration shown in the configuration file above -can be duplicated in NetInfo by adding a property "server" with -values "rackety.udel.edu", "umd1.umd.edu", and -"lilben.tn.cornell.edu"; and a property "driftfile" -with the single value "/etc/ntp.drift". - -

    Values may contain multiple tokens similar to the arguments available -in the configuration file. For example, to use mimsy.mil as an -NTP version 1 time server, you would add a value "mimsy.mil version -1" to the "server" property. - -

    -Ntp4 Versus Previous Versions

    -There are several items of note when dealing with a mixture of -ntp4 -and previous distributions of NTP Version 2 (ntpd) and NTP -Version -1 (ntp3.4). The ntp4 implementation conforms to the -NTP -Version 3 specification RFC-1305 and, in addition, contains additional -feaures documented in the Release Notes page. -As such, by default when no additional information is available -concerning -the preferences of the peer, ntpd claims to be version 4 in the -packets that it sends from configured associations. The version -subcommand -of the server, peer, broadcast and -manycastclient -command can be used to change the default. In unconfigured -(ephemeral) -associaitons, the daemon always replies in the same version as the -request. - -

    An NTP implementation conforming to a previous version specification -ordinarily discards packets from a later version. However, in most -respects -documented in RFC-1305, The version 2 implementation is compatible with -the version 3 algorithms and protocol. The version 1 implementation -contains -most of the version 2 algorithms, but without important features for -clock -selection and robustness. Nevertheless, in most respects the NTP -versions -are backwards compatible. The sticky part here is that, when a previous -version implementation receives a packet claiming to be from a version -4 server, it discards it without further processing. Hence there is a -danger -that in some situations synchronization with previous versions will -fail. - -

    The trouble occurs when an previous version is to be included in an -ntpd configuration file. With no further indication, -ntpd -will send packets claiming to be version 4 when it polls. To get around -this, ntpd allows a qualifier to be added to configuration -entries -to indicate which version to use when polling. Hence the entries -

         # specify NTP version 1
    -
    -     server mimsy.mil version
    -1     # server running ntpd version 1
    -     server apple.com version
    -2     # server running ntpd version 2
    -will cause version 1 packets to be sent to the host mimsy.mil and -version -2 packets to be sent to apple.com. If you are testing ntpd -against -previous version servers you will need to be careful about this. Note -that, -as indicated in the RFC-1305 specification, there is no longer support -for the original NTP specification, once called NTP Version 0. -

    -Traffic Monitoring

    -ntpd handles peers whose stratum is higher than the stratum of -the local server and pollers using client mode by a fast path which -minimizes -the work done in responding to their polls, and normally retains no -memory -of these pollers. Sometimes, however, it is interesting to be able to -determine -who is polling the server, and how often, as well as who has been -sending -other types of queries to the server. - -

    To allow this, ntpd implements a traffic monitoring facility -which records the source address and a minimal amount of other -information -from each packet which is received by the server. This feature is -normally -enabled, but can be disabled if desired using the configuration file -entry: -

         # disable monitoring feature
    -     disable monitor
    -The recorded information can be displayed using the ntpdc query -program, described briefly below. -

    -Address-and-Mask Restrictions

    -The address-and-mask configuration facility supported by ntpd -is quite flexible and general, but is not an integral part of the NTP -Version -3 specification. The major drawback is that, while the internal -implementation -is very nice, the user interface is not. For this reason it is probably -worth doing an example here. Briefly, the facility works as follows. -There -is an internal list, each entry of which holds an address, a mask and a -set of flags. On receipt of a packet, the source address of the packet -is compared to each entry in the list, with a match being posted when -the -following is true: -
         (source_addr & mask) == (address &
    -mask)
    -A particular source address may match several list entries. In this case -the entry with the most one bits in the mask is chosen. The flags -associated -with this entry are used to control the access. - -

    In the current implementation the flags always add restrictions. In -effect, an entry with no flags set leaves matching hosts unrestricted. -An entry can be added to the internal list using a restrict -declaration. -The flags associated with the entry are specified textually. For -example, -the notrust flag indicates that hosts matching this entry, -while -treated normally in other respects, shouldn't be trusted to provide -synchronization -even if otherwise so enabled. The nomodify flag indicates that -hosts matching this entry should not be allowed to do run-time -configuration. -There are many more flags, see the ntpd -page. - -

    Now the example. Suppose you are running the server on a host whose -address is 128.100.100.7. You would like to ensure that run time -reconfiguration -requests can only be made from the local host and that the server only -ever synchronizes to one of a pair of off-campus servers or, failing -that, -a time source on net 128.100. The following entries in the configuration -file would implement this policy: -

         # by default, don't trust and don't allow
    -modifications
    -
    -     restrict default notrust nomodify
    -
    -     # these guys are trusted for time, but no
    -modifications allowed
    -
    -     restrict 128.100.0.0 mask 255.255.0.0 nomodify
    -     restrict 128.8.10.1 nomodify
    -     restrict 192.35.82.50 nomodify
    -
    -     # the local addresses are unrestricted
    -
    -     restrict 128.100.100.7
    -     restrict 127.0.0.1
    -The first entry is the default entry, which all hosts match and hence -which -provides the default set of flags. The next three entries indicate that -matching hosts will only have the nomodify flag set and hence -will be trusted for time. If the mask isn't specified in the -restrict -keyword, it defaults to 255.255.255.255. Note that the address -128.100.100.7 -matches three entries in the table, the default entry (mask 0.0.0.0), -the -entry for net 128.100 (mask 255.255.0.0) and the entry for the host -itself -(mask 255.255.255.255). As expected, the flags for the host are derived -from the last entry since the mask has the most bits set. - -

    The only other thing worth mentioning is that the restrict -declarations apply to packets from all hosts, including those that are -configured elsewhere in the configuration file and even including your -clock pseudopeer(s), if any. Hence, if you specify a default set of -restrictions -which you don't wish to be applied to your configured peers, you must -remove -those restrictions for the configured peers with additional -restrict -declarations mentioning each peer separately. -

    -Authentication

    -ntpd supports the optional authentication procedure specified -in the NTP Version 2 and 3 specifications. Briefly, when an association -runs in authenticated mode, each packet transmitted has appended to it -a 32-bit key ID and a 64/128-bit cryptographic checksum of the packet -contents -computed using either the Data Encryption Standard (DES) or Message -Digest -(MD5) algorithms. Note that, while either of these algorithms provide -sufficient -protection from message- modification attacks, distribution of the -former -algorithm implementation is restricted to the U.S. and Canada, while the -latter presently is free from such restrictions. For this reason, the -DES -algorithm is not included in the current distribution. Directions for -obtaining -it in other countries is in the Building and -Installing -the Distribution page. With either algorithm the receiving peer -recomputes -the checksum and compares it with the one included in the packet. For -this -to work, the peers must share at least one encryption key and, -furthermore, -must associate the shared key with the same key ID. - -

    This facility requires some minor modifications to the basic packet -processing procedures, as required by the specification. These -modifications -are enabled by the enable auth configuration declaration, which -is currently the default. In authenticated mode, peers which send -unauthenticated -packets, peers which send authenticated packets which the local server -is unable to decrypt and peers which send authenticated packets -encrypted -using a key we don't trust are all marked untrustworthy and unsuitable -for synchronization. Note that, while the server may know many keys -(identified -by many key IDs), it is possible to declare only a subset of these as -trusted. -This allows the server to share keys with a client which requires -authenticated -time and which trusts the server, but which is not trusted by the -server. -Also, some additional configuration language is required to specify the -key ID to be used to authenticate each configured peer association. -Hence, -for a server running in authenticated mode, the configuration file might -look similar to the following: -

         # peer configuration for 128.100.100.7
    -     # (expected to operate at stratum 2)
    -     # fully authenticated this time
    -
    -     peer 128.100.49.105 key 22 #
    -suzuki.ccie.utoronto.ca
    -     peer 128.8.10.1 key 4    #
    -umd1.umd.edu
    -     peer 192.35.82.50 key 6  #
    -lilben.tn.cornell.edu
    -
    -     keys /usr/local/etc/ntp.keys  # path for
    -key file
    -     trustedkey 1 2 14 15     #
    -define trusted keys
    -     requestkey
    -15            #
    -key (7) for accessing server variables
    -     controlkey
    -15            #
    -key (6) for accessing server variables
    -
    -     authdelay
    -0.000094       # authentication delay
    -(Sun4c/50 IPX)
    -There are a couple of previously unmentioned things in here. The -keys -line specifies the path to the keys file (see below and the -ntpd -document page for details of the file format). The trustedkey -declaration identifies those keys that are known to be uncompromised; -the -remainder presumably represent the expired or possibly compromised keys. -Both sets of keys must be declared by key identifier in the -ntp.keys -file described below. This provides a way to retire old keys while -minimizing -the frequency of delicate key-distribution procedures. The -requestkey -line establishes the key to be used for mode-6 control messages as -specified -in RFC-1305 and used by the ntpq utility program, while the -controlkey -line establishes the key to be used for mode-7 private control -messages -used by the ntpdc utility program. These keys are used to -prevent -unauthorized modification of daemon variables. - -

    Ordinarily, the authentication delay; that is, the processing time -taken -between the freezing of a transmit timestamp and the actual transmission -of the packet when authentication is enabled (i.e. more or less the time -it takes for the DES or MD5 routine to encrypt a single block) is -computed -automatically by the daemon. If necessary, the delay can be overriden by -the authdelay line, which is used as a correction for the -transmit -timestamp. This can be computed for your CPU by the authspeed -program included in the distribution. The usage is illustrated by -the -following: -

         # for DES keys
    -
    -     authspeed -n 30000 auth.samplekeys
    -     # for MD5 keys
    -
    -     authspeed -mn 30000 auth.samplekeys
    -Additional utility programs included in the ./authstuff -directory -can be used to generate random keys, certify implementation correctness -and display sample keys. As a general rule, keys should be chosen -randomly, -except possibly the request and control keys, which must be entered by -the user as a password. - -

    The ntp.keys file contains the list of keys and associated -key IDs the server knows about (for obvious reasons this file is better -left unreadable by anyone except root). The contents of this file might -look like: -

         # ntp keys file (ntp.keys)
    -     1    N   
    -29233E0461ECD6AE    # des key in NTP format
    -     2    M   
    -RIrop8KPPvQvYotM    # md5 key as an ASCII random string
    -     14   M   
    -sundial           
    -;  # md5 key as an ASCII string
    -     15   A   
    -sundial           
    -;  # des key as an ASCII string
    -
    -     # the following 3 keys are identical
    -
    -     10   A    SeCReT
    -     10   N   
    -d3e54352e5548080
    -     10   S   
    -a7cb86a4cba80101
    -In the keys file the first token on each line indicates the key ID, the -second token the format of the key and the third the key itself. There -are four key formats. An A indicates a DES key written as a 1- -to-8 -character string in 7-bit ASCII representation, with each character -standing -for a key octet (like a Unix password). An S indicates a DES -key -written as a hex number in the DES standard format, with the low order -bit (LSB) of each octet being the (odd) parity bit. An N -indicates -a DES key again written as a hex number, but in NTP standard format with -the high order bit of each octet being the (odd) parity bit (confusing -enough?). An M indicates an MD5 key written as a 1-to-31 -character -ASCII string in the A format. Note that, because of the simple -tokenizing routine, the characters ' ', '#', '\t', '\n' and -'\0' -can't be used in either a DES or MD5 ASCII key. Everything else is fair -game, though. Key 0 (zero) is used for special purposes and should not -appear in this file. - -

    The big trouble with the authentication facility is the keys file. It -is a maintenance headache and a security problem. This should be fixed -some day. Presumably, this whole bag of worms goes away if/when a -generic -security regime for the Internet is established. An alternative with NTP -Version 4 is the autokey feature, which uses random session keys and -public-key -cruptography and avoids the key file entirely. While this feature is not -completely finished yet, details can be found in the Release -Notes page. -

    -Query Programs

    -Three utility query programs are included with the distribution, -ntpq, -ntptrace and ntpdc. ntpq is a handy program -which sends queries and receives responses using NTP standard mode-6 -control -messages. Since it uses the standard control protocol specified in RFC- -1305, -it may be used with NTP Version 2 and Version 3 implementations for both -Unix and Fuzzball, but not Version 1 implementations. It is most useful -to query remote NTP implementations to assess timekeeping accuracy and -expose bugs in configuration or operation. - -

    ntptrace can be used to display the current synchronization -path from a selected host through possibly intervening servers to the -primary -source of synchronization, usually a radio clock. It works with both -version -2 and version 3 servers, but not version 1. - -

    ntpdc is a horrid program which uses NTP private mode-7 -control -messages to query local or remote servers. The format and contents of -these -messages are specific to this version of ntpd and some older -versions. -The program does allow inspection of a wide variety of internal counters -and other state data, and hence does make a pretty good debugging tool, -even if it is frustrating to use. The other thing of note about -ntpdc -is that it provides a user interface to the run time reconfiguration -facility. -See the respective document pages for details on the use of these -programs. -

    -Run-Time Reconfiguration

    -ntpd was written specifically to allow its configuration to be -fully modifiable at run time. Indeed, the only way to configure the -server -is at run time. The configuration file is read only after the rest of -the -server has been initialized into a running default-configured state. -This -facility was included not so much for the benefit of Unix, where it is -handy but not strictly essential, but rather for dedicated platforms -where -the feature is more important for maintenance. Nevertheless, run time -configuration -works very nicely for Unix servers as well. - -

    Nearly all of the things it is possible to configure in the -configuration -file may be altered via NTP mode-7 messages using the ntpdc -program. -Mode-6 messages may also provide some limited configuration -functionality -(though the only thing you can currently do with mode-6 messages is set -the leap-second warning bits) and the ntpq program provides -generic -support for the latter. The leap bits that can be set in the -leap_warning -variable (up to one month ahead) and in the leap_indication -variable -have a slightly different encoding than the usual interpretation: -

           
    -Value           Action
    -
    -        
    -00           &nbs
    -p; The daemon passes the leap bits of its
    -            
    -           
    -synchronisation source (usual mode of operation)
    -
    -        01/10   A leap
    -second is added/deleted
    -
    -        
    -11           &nbs
    -p; Leap information from the synchronization source
    -            
    -            is
    -ignored (thus LEAP_NOWARNING is passed on)
    -Mode-6 and mode-7 messages which would modify the configuration of the -server are required to be authenticated using standard NTP -authentication. -To enable the facilities one must, in addition to specifying the -location -of a keys file, indicate in the configuration file the key IDs to be -used -for authenticating reconfiguration commands. Hence the following -fragment -might be added to a configuration file to enable the mode-6 (ntpq) and -mode-7 (ntpdc) facilities in the daemon: -
         # specify mode-6 and mode-7 trusted keys
    -
    -     requestkey 65535    # for mode-7
    -requests
    -     controlkey 65534    # for mode-6
    -requests
    -If the requestkey and/or the controlkey configuration -declarations are omitted from the configuration file, the corresponding -run-time reconfiguration facility is disabled. - -

    The query programs require the user to specify a key ID and a key to -use for authenticating requests to be sent. The key ID provided should -be the same as the one mentioned in the configuration file, while the -key -should match that corresponding to the key ID in the keys file. As the -query programs prompt for the key as a password, it is useful to make -the -request and control authentication keys typeable (in ASCII format) from -the keyboard. -

    -Name Resolution

    -ntpd includes the capability to specify host names requiring -resolution -in peer and server declarations in the configuration -file. However, in some outposts of the Internet, name resolution is -unreliable -and the interface to the Unix resolver routines is synchronous. The -hangups -and delays resulting from name-resolver clanking can be unacceptable -once -the NTP server is running (and remember it is up and running before the -configuration file is read). However, it is advantageous to resolve time -server names, since their addresses are occasionally changed. - -

    In order to prevent configuration delays due to the name resolver, -the -daemon runs the name resolution process in parallel with the main daemon -code. When the daemon comes across a peer or server -entry -with a non-numeric host address, it records the relevant information in -a temporary file and continues on. When the end of the configuration -file -has been reached and one or more entries requiring name resolution have -been found, the server runs the name resolver from the temporary file. -The server then continues on normally but with the offending -peers/servers -omitted from its configuration. - -

    As each name is resolved, it configures the associated entry into the -server using the same mode-7 run time reconfiguration facility that -ntpdc -uses. If temporary resolver failures occur, the resolver will -periodically -retry the requests until a definite response is received. The program -will -continue to run until all entries have been resolved. -

    -Dealing with Frequency Tolerance -Violations - (tickadj and Friends)

    -The NTP Version 3 specification RFC-1305 calls for a maximum oscillator -frequency tolerance of +-100 parts-per-million (PPM), which is -representative -of those components suitable for use in relatively inexpensive -workstation -platforms. For those platforms meeting this tolerance, NTP will -automatically -compensate for the frequency errors of the individual oscillator and no -further adjustments are required, either to the configuration file or to -various kernel variables. For the NTP Version 4 release, this tolerance -has been increased to +-500 PPM. - -

    However, in the case of certain notorious platforms, in particular -Sun -4.1.1 systems, the performance can be improved by adjusting the values -of certain kernel variables; in particular, tick and -tickadj. -The variable tick is the increment in microseconds added to the -system time on each interval- timer interrupt, while the variable -tickadj -is used by the time adjustment code as a slew rate, in microseconds per -tick. When the time is being adjusted via a call to the system routine -adjtime(), the kernel increases or reduces tick by -tickadj -microseconds per tick until the specified adjustment has been completed. -Unfortunately, in most Unix implementations the tick increment must be -either zero or plus/minus exactly tickadj microseconds, meaning -that adjustments are truncated to be an integral multiple of -tickadj -(this latter behaviour is a misfeature, and is the only reason the -tickadj -code needs to concern itself with the internal implementation of -tickadj -at all). In addition, the stock Unix implementation considers it an -error -to request another adjustment before a prior one has completed. -

    Thus, to make very sure it avoids problems related to the roundoff, -the tickadj program can be used to adjust the values of -tick -and tickadj. This ensures that all adjustments given to -adjtime() -are an even multiple of tickadj microseconds and computes the -largest adjustment that can be completed in the adjustment interval -(using -both the value of tick and the value of tickadj) so it -can avoid exceeding this limit. It is important to note that not all -systems -will allow inspection or modification of kernel variables other than at -system build time. It is also important to know that, with the current -NTP tolerances, it is rarely necessary to make these changes, but in -many -cases they will substantially improve the general accurace of the time -service. - -

    Unfortunately, the value of tickadj set by default is almost -always too large for ntpd. NTP operates by continuously making -small adjustments to the clock, usually at one-second intervals. If -tickadj -is set too large, the adjustments will disappear in the roundoff; while, -if tickadj is too small, NTP will have difficulty if it needs -to make an occasional large adjustment. While the daemon itself will -read -the kernel's values of these variables, it will not change the values, -even if they are unsuitable. You must do this yourself before the daemon -is started using the tickadj program included in the -./util -directory of the distribution. Note that the latter program will also -compute -an optimal value of tickadj for NTP use based on the kernel's -value of tick. - -

    The tickadj program can reset several other kernel variables -if asked. It can change the value of tick if asked. This is -handy to compensate for kernel bugs which cause the clock to run with a -very large frequency error, as with SunOS 4.1.1 systems. It can also be -used to set the value of the kernel dosynctodr variable to -zero. This variable controls whether to synchronize the system clock to -the time-of-day clock, something you really don't want to be happen -when ntpd is trying to keep it under control. In some systems, -such as recent Sun Solaris kernels, the dosynctodr variable is -the only one that can be changed by the tickadj program. In -this and other modern kernels, it is not necessary to change the other -variables in any case. - -

    -We have a report that says starting with Solaris 2.6 we should -leave dosynctodr alone. -Here is the report. - -

    In order to maintain reasonable correctness bounds, as well as -reasonably -good accuracy with acceptable polling intervals, ntpd will -complain -if the frequency error is greater than 500 PPM. For machines with a -value -of tick in the 10-ms range, a change of one in the value of -tick -will change the frequency by about 100 PPM. In order to determine the -value -of tick for a particular CPU, disconnect the machine from all -sources of time (dosynctodr = 0) and record its actual time -compared -to an outside source (eyeball-and-wristwatch will do) over a day or -more. -Multiply the time change over the day by 0.116 and add or subtract the -result to tick, depending on whether the CPU is fast or slow. An example -call to tickadj useful on SunOS 4.1.1 is: -

         tickadj -t 9999 -a 5 -s
    -which sets tick 100 PPM fast, tickadj to 5 microseconds and -turns -off the clock/calendar chip fiddle. This line can be added to the -rc.local -configuration file to automatically set the kernel variables at boot -time. - -

    All this stuff about diddling kernel variables so the NTP daemon will -work is really silly. If vendors would ship machines with clocks that -kept -reasonable time and would make their adjtime() system call -apply -the slew it is given exactly, independent of the value of -tickadj, -all this could go away. This is in fact the case on many current Unix -systems. -

    -Tuning Your Subnet

    -There are several parameters available for tuning the NTP subnet for -maximum -accuracy and minimum jitter. One of these is the prefer -configuration -declaration described in Mitigation Rules and the -prefer Keyword documentation page. When more than one -eligible -server exists, the NTP clock-selection and combining algorithms act to -winnow out all except the "best" set of servers using several criteria -based on differences between the readings of different servers and -between -successive readings of the same server. The result is usually a set of -surviving servers that are apparently statistically equivalent in -accuracy, -jitter and stability. The population of survivors remaining in this set -depends on the individual server characteristics measured during the -selection -process and may vary from time to time as the result of normal -statistical -variations. In LANs with high speed RISC-based time servers, the -population -can become somewhat unstable, with individual servers popping in and out -of the surviving population, generally resulting in a regime called -clockhopping. - -

    When only the smallest residual jitter can be tolerated, it may be -convenient -to elect one of the servers at each stratum level as the preferred one -using the keyword prefer on the configuration declaration for -the selected server: -

         # preferred server declaration
    -
    -     peer rackety.udel.edu prefer   
    -# preferred server
    -The preferred server will always be included in the surviving -population, -regardless of its characteristics and as long as it survives preliminary -sanity checks and validation procedures. - -

    The most useful application of the prefer keyword is in high -speed LANs equipped with precision radio clocks, such as a GPS receiver. -In order to insure robustness, the hosts need to include outside peers -as well as the GPS-equipped server; however, as long as that server is -running, the synchronization preference should be that server. The -keyword -should normally be used in all cases in order to prefer an attached -radio -clock. It is probably inadvisable to use this keyword for peers outside -the LAN, since it interferes with the carefully crafted judgement of the -selection and combining algorithms. -

    -Provisions for Leap Seconds and Accuracy Metrics

    -ntpd understands leap seconds and will attempt to take -appropriate -action when one occurs. In principle, every host running ntpd will -insert -a leap second in the local timescale in precise synchronization with -UTC. -This requires that the leap-warning bits be activated some time prior to -the occurrence of a leap second at the primary (stratum 1) servers. -Subsequently, -these bits are propagated throughout the subnet depending on these -servers -by the NTP protocol itself and automatically implemented by -ntpd -and the time- conversion routines of each host. The implementation is -independent -of the idiosyncrasies of the particular radio clock, which vary widely -among the various devices, as long as the idiosyncratic behavior does -not -last for more than about 20 minutes following the leap. Provisions are -included to modify the behavior in cases where this cannot be -guaranteed. -While provisions for leap seconds have been carefully crafted so that -correct -timekeeping immediately before, during and after the occurrence of a -leap -second is scrupulously correct, stock Unix systems are mostly inept in -responding to the available information. This caveat goes also for the -maximum-error and statistical-error bounds carefully calculated for all -clients and servers, which could be very useful for application programs -needing to calibrate the delays and offsets to achieve a near- -simultaneous -commit procedure, for example. While this information is maintained in -the ntpd data structures, there is at present no way for -application -programs to access it. This may be a topic for further development. -

    -Clock Support Overview

    -ntpd was designed to support radio (and other external) clocks -and does some parts of this function with utmost care. Clocks are -treated -by the protocol as ordinary NTP peers, even to the point of referring to -them with an (invalid) IP host address. Clock addresses are of the form -127.127.t.u, where t specifies the particular type of -clock -(i.e., refers to a particular clock driver) and u is a unit -number -whose interpretation is clock-driver dependent. This is analogous to the -use of major and minor device numbers by Unix and permits multiple -instantiations -of clocks of the same type on the same server, should such magnificent -redundancy be required. - -

    Because clocks look much like peers, both configuration file syntax -and run time reconfiguration commands can be used to control clocks in -the same way as ordinary peers. Clocks are configured via -server -declarations in the configuration file, can be started and stopped using -ntpdc and are subject to address-and-mask restrictions much like a -normal -peer, should this stretch of imagination ever be useful. As a concession -to the need to sometimes transmit additional information to clock -drivers, -an additional configuration file is available: the fudge -statement. -This enables one to specify the values of two time quantities, two -integral -values and two flags, the use of which is dependent on the particular -clock -driver. For example, to configure a PST radio clock which can be -accessed -through the serial device /dev/pst1, with propagation delays to -WWV and WWVH of 7.5 and 26.5 milliseconds, respectively, on a machine -with -an imprecise system clock and with the driver set to disbelieve the -radio -clock once it has gone 30 minutes without an update, one might use the -following configuration file entries: -

         # radio clock fudge fiddles
    -     server 127.127.3.1
    -     fudge 127.127.3.1 time1 0.0075 time2 0.0265
    -     fudge 127.127.3.1 value2 30 flag1 1
    -Additional information on the interpretation of these data with respect -to various radio clock drivers is given in the Reference -Clock Drivers document page and in the individual driver documents -accessible via that page. -

    -Towards the Ultimate Tick

    -This section considers issues in providing precision time -synchronization -in NTP subnets which need the highest quality time available in the -present -technology. These issues are important in subnets supporting real-time -services such as distributed multimedia conferencing and wide-area -experiment -control and monitoring. - -

    In the Internet of today synchronization paths often span continents -and oceans with moderate to high variations in delay due to traffic -spasms. -NTP is specifically designed to minimize timekeeping jitter due to delay -variations using intricately crafted filtering and selection algorithms; -however, in cases where these variations are as much as a second or -more, -the residual jitter following these algorithms may still be excessive. -Sometimes, as in the case of some isolated NTP subnets where a local -source -of precision time is available, such as a PPS signal produced by a -calibrated -cesium clock, it is possible to remove the jitter and retime the local -clock oscillator of the NTP server. This has turned out to be a useful -feature to improve the synchronization quality of time distributed in -remote -places where radio clocks are not available. In these cases special -features -of the distribution are used together with the PPS signal to provide a -jitter-free timing signal, while NTP itself is used to provide the -coarse -timing and resolve the seconds numbering. - -

    Most available radio clocks can provide time to an accuracy in the -order -of milliseconds, depending on propagation conditions, local noise levels -and so forth. However, as a practical matter, all clocks can -occasionally -display errors significantly exceeding nominal specifications. Usually, -the algorithms used by NTP for ordinary network peers, as well as radio -clock peers will detect and discard these errors as discrepancies -between -the disciplined local clock oscillator and the decoded time message -produced -by the radio clock. Some radio clocks can produce a special PPS signal -which can be interfaced to the server platform in a number of ways and -used to substantially improve the (disciplined) clock oscillator jitter -and wander characteristics by at least an order of magnitude. Using -these -features it is possible to achieve accuracies in the order of a few tens -of microseconds with a fast RISC- based platform. - -

    There are three ways to implement PPS support, depending on the radio -clock model, platform model and serial line interface. These are -described -in detail in the application notes mentioned in the The -Network Time Protocol (NTP) Distribution document page. Each of -these -requires circuitry to convert the TTL signal produced by most clocks to -the EIA levels used by most serial interfaces. The Gadget -Box PPS Level Converter and CHU Modem document page describes a -device -designed to do this. Besides being useful for this purpose, this device -includes an inexpensive modem designed for use with the Canadian CHU -time/frequency -radio station. - -

    In order to select the appropriate implementation, it is important to -understand the underlying PPS mechanism used by ntpd. The PPS support -depends -on a continuous source of PPS pulses used to calculate an offset within -+-500 milliseconds relative to the local clock. The serial timecode -produced -by the radio or the time determined by NTP in absence of the radio is -used -to adjust the local clock within +-128 milliseconds of the actual time. -As long as the local clock is within this interval the PPS support is -used -to discipline the local clock and the timecode used only to verify that -the local clock is in fact within the interval. Outside this interval -the -PPS support is disabled and the timecode used directly to control the -local -clock. -

    -Parting Shots

    -There are several undocumented programs which can be useful in unusual -cases. They can be found in the ./clockstuff and -./authstuff -directories of the distribution. One of these is the propdelay -program, which can compute high frequency radio propagation delays -between -any two points whose latitude and longitude are known. The program -understands -something about the phenomena which allow high frequency radio -propagation -to occur, and will generally provide a better estimate than a -calculation -based on the great circle distance. Other programs of interest include -clktest, which allows one to exercise the generic clock line -discipline, -and chutest, which runs the basic reduction algorithms used by -the daemon on data received from a serial port.  - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/ntpd.htm b/dist/ntp/html/ntpd.htm deleted file mode 100644 index c9c144f5de20..000000000000 --- a/dist/ntp/html/ntpd.htm +++ /dev/null @@ -1,190 +0,0 @@ - -<TT>ntpd</TT> - Network Time Protocol (NTP) daemon -

    -ntpd - Network Time Protocol (NTP) daemon -


    - -

    Synopsis

    - -ntpd [ -aAbdm ] [ -c conffile ] [ -f driftfile ] [ -g -] [ -i chrootdir ] [ -k keyfile ] [ -l logfile ] -[ -p pidfile ] [ -r broadcastdelay ] [ -s statsdir ] -[ -t key ] [ -u user[:group] ] [ -v variable ] -[ -V variable ] [ -x ] - -

    Description

    - -ntpd is an operating system daemon which sets and maintains the -system time-of-day in synchronism with Internet standard time servers. -ntpd 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. ntpd 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 nanosecond CPU clocks and gigabit LANs. - -

    The daemon can operate in any of several modes, including symmetric -active/passive, client/server broadcast/multicast and manycast. 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. - -

    Ordinarily, ntpd reads the ntp.conf 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. - -

    If NetInfo support is built into ntpd, then ntpd -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 -c -option. - -

    Various internal ntpd variables can be displayed and -configuration options altered while the daemon is running using the -ntpq and ntpdc utility programs. - -

    When ntpd starts it looks at the value of umask, -and if it's zero ntpd will set the umask to -022. - -

    Command Line Options

    - -
    - -
    -a
    -
    Enable authentication mode (default).
    - -
    -A
    -
    Disable authentication mode.
    - -
    -b
    -
    Synchronize using NTP broadcast messages.
    - -
    -c conffile
    -
    Specify the name and path of the configuration file.
    - -
    -d
    -
    Specify debugging mode. This flag may occur multiple times, with -each occurrence indicating greater detail of display.
    - -
    -D level
    -
    Specify debugging level directly.
    - -
    -f driftfile
    -
    Specify the name and path of the drift file.
    - -
    -g
    -
    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 if the limit is exceeded.
    - -
    -i chrootdir
    -
    Specify the path to a directory in which ntpd will run chrooted.
    - -
    -k keyfile
    -
    Specify the name and path of the file containing the NTP -authentication keys.
    - -
    -l logfile
    -
    Specify the name and path of the log file. The default is the system -log facility.
    - -
    -m
    -
    Synchronize using NTP multicast messages on the IP multicast group -address 224.0.1.1 (requires multicast kernel).
    - -
    -p pidfile
    -
    Specify the name and path to record the daemon's process ID.
    - -
    -P
    -
    Override the priority limit set by the operating system. Not -recommended for sissies.
    - -
    -r broadcastdelay
    -
    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.
    - -
    -s statsdir
    -
    Specify the directory path for files created by the statistics -facility.
    - -
    -t key
    -
    Add a key number to the trusted key list.
    - -
    -u user[:group]
    -
    Specify user (and optionally group) as which ntpd will run.
    - -
    -v variable
    -
    -V variable
    -
    Add a system variable listed by default.
    - -
    -x
    -
    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.
    -
    - -

    The Configuration File

    - -The ntpd 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 /etc directory, -but could be installed elsewhere (see the -c conffile -command line option). The file format is similar to other Unix -configuration files - comments begin with a # 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 [ ] in the following -descriptions, while alternatives are separated by |. The -notation [ ... ] means an optional, indefinite repetition of -the last item before the [ ... ]. - -

    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 server, peer, broadcast or -manycastclient commands described in the Configuration Options -page. The Notes on Configuring NTP and Setting up a -NTP Subnet page contains an extended discussion of these options. - -

    Configuration Options -
    Authentication Options -
    Monitoring Options -
    Access Control Options -
    Reference Clock Options -
    Miscellaneous Options - -

    Files

    - -/etc/ntp.conf - the default name of the configuration file -
    /etc/ntp.drift - the default name of the drift file -
    /etc/ntp.keys - the default name of the key file - -

    Bugs

    - -ntpd has gotten rather fat. While not huge, it has gotten -larger than might be desirable 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. - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/ntpdate.htm b/dist/ntp/html/ntpdate.htm deleted file mode 100644 index b7cb0b239e3b..000000000000 --- a/dist/ntp/html/ntpdate.htm +++ /dev/null @@ -1,185 +0,0 @@ - - - - - ntpdate - set the date and time via NTP - - - - -

    -ntpdate - set the date and time via NTP

    - -
    -

    -Synopsis

    -ntpdate [ -bBdoqsuv ] [ -a key ] [ -e authdelay ] [ -k -keyfile ] [ -o version ] [ -p samples ] [ -t timeout -] server [ ... ] -

    -Description

    -ntpdate sets the local date and time by polling the Network Time -Protocol (NTP) server(s) given as the server 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 ntpdate -depends on the number of servers, the number of polls each time it is run -and the interval between runs. - -

    ntpdate 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 ntpd. It is also possible to run ntpdate -from a cron script. However, it is important to note that ntpdate -with contrived cron scripts is no substitute for the NTP daemon, -which uses sophisticated algorithms to maximize accuracy and reliability -while minimizing resource use. Finally, since ntpdate does not -discipline the host clock frequency as does ntpd, the accuracy -using ntpdate is limited. - -

    Time adjustments are made by ntpdate in one of two ways. If -ntpdate determines the clock is in error more than 0.5 second -it will simply step the time by calling the system settimeofday() -routine. If the error is less than 0.5 seconds, it will slew the time by -calling the system adjtime() routine. The latter technique is -less disruptive and more accurate when the error is small, and works quite -well when ntpdate is run by cron every hour or two. - -

    ntpdate will decline to set the date if an NTP server daemon -(e.g., ntpd) is running on the same host. When running ntpdate -on a regular basis from cron 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. - -

    If NetInfo support is compiled into ntpdate, then the -server argument is optional if ntpdate can find a time -server in the NetInfo configuration for ntpd. - -

    -Command Line Options

    - -
    -
    --a key
    - -
    -Enable the authentication function and specify the key identifier to be -used for authentication as the argument keyntpdate. The -keys and key identifiers must match in both the client and server key files. -The default is to disable the authentication function.
    - -
    --B
    - -
    -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.
    - -
    --b
    - -
    -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.
    - -
    --d
    - -
    -Enable the debugging mode, in which ntpdate will go through all -the steps, but not adjust the local clock. Information useful for general -debugging will also be printed.
    - -
    --e authdelay
    - -
    -Specify the processing delay to perform an authentication function as the -value authdelay, in seconds and fraction (see ntpd 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.
    - -
    --k keyfile
    - -
    -Specify the path for the authentication key file as the string keyfile. -The default is /etc/ntp.keys. This file should be in the format -described in ntpd.
    - -
    --o version
    - -
    -Specify the NTP version for outgoing packets as the integer version, -which can be 1 or 2. The default is 3. This allows ntpdate to -be used with older NTP versions.
    - -
    --p samples
    - -
    -Specify the number of samples to be acquired from each server as the integer -samples, with values from 1 to 8 inclusive. The default is 4.
    - -
    --q
    - -
    -Query only - don't set the clock.
    - -
    --s
    - -
    -Divert logging output from the standard output (default) to the system -syslog facility. This is designed primarily for convenience of -cron scripts.
    - -
    --t timeout
    - -
    -Specify the maximum time waiting for a server response as the value timeout, -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.
    - -
    --u
    - -
    -Direct ntpdate 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 -d option always uses unprivileged ports.
    - -
    --v
    - -
    -Be verbose. This option will cause ntpdate's version identification -string to be logged.
    -
    - -

    -Files

    -/etc/ntp.keys - encryption keys used by ntpdate. -

    -Bugs

    -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 tick and tickadj.  -
    -
    -David L. Mills (mills@udel.edu)
    - - - diff --git a/dist/ntp/html/ntpdc.htm b/dist/ntp/html/ntpdc.htm deleted file mode 100644 index 9aaaf0003fe8..000000000000 --- a/dist/ntp/html/ntpdc.htm +++ /dev/null @@ -1,620 +0,0 @@ - - - - - ntpdc - special NTP query program - - - - -

    -ntpdc - special NTP query program

    - -
    -

    -Synopsis

    -ntpdc [ -ilnps ] [ -c command ] [ host ] [ ... ] -

    -Description

    -ntpdc is used to query the ntpd 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 ntpdc -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 ntpdc. - -

    If one or more request options is included on the command line when -ntpdc 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, ntpdc -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. ntpdc -will prompt for commands if the standard input is a terminal device. - -

    ntpdc uses NTP mode 7 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. ntpdc makes no attempt to retransmit requests, and will -time requests out if the remote host is not heard from within a suitable -timeout time. - -

    The operation of ntpdc are specific to the particular implementation -of the ntpd daemon and can be expected to work only with this -and maybe some previous versions of the daemon. Requests from a remote -ntpdc 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. -

    -Command Line Options

    -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, ntpdc will attempt to read interactive -format commands from the standard input. -
    -
    --c command
    - -
    -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.
    - -
    --i
    - -
    -Force ntpdc to operate in interactive mode. Prompts will be written -to the standard output and commands read from the standard input.
    - -
    --l
    - -
    -Obtain a list of peers which are known to the server(s). This switch is -equivalent to -c listpeers.
    - -
    --n
    - -
    -Output all host addresses in dotted-quad numeric format rather than converting -to the canonical host names.
    - -
    --p
    - -
    -Print a list of the peers known to the server as well as a summary of their -state. This is equivalent to -c peers.
    - -
    --s
    - -
    -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 -c dmpeers.
    -
    - -

    -Interactive Commands

    -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 ntpdc program itself and do not result in NTP mode 7 requests -being sent to a server. These are described following. -

    -
    -? [ command_keyword ]
    - -
    helpl [ command_keyword ] -
    -A ? by itself will print a list of all the command keywords known -to this incarnation of ntpq. A ? followed by a command -keyword will print function and usage information about the command. This -command is probably a better source of information about ntpq -than this manual page.
    - -
    -delay milliseconds
    - -
    -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.
    - -
    -host hostname
    - -
    -Set the host to which future queries will be sent. Hostname may be either -a host name or a numeric address.
    - -
    -hostnames [ yes | no ]
    - -
    -If yes is specified, host names are printed in information displays. -If no is specified, numeric addresses are printed instead. The -default is yes, unless modified using the command line -n -switch.
    - -
    -keyid keyid
    - -
    -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.
    - -
    -quit
    - -
    -Exit ntpdc.
    - -
    -passwd
    - -
    -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.
    - -
    -timeout millseconds
    - -
    -Specify a timeout period for responses to server queries. The default is -about 8000 milliseconds. Note that since ntpdc retries each query -once after a timeout, the total waiting time for a timeout will be twice -the timeout value set.
    -
    - -

    -Control Message Commands

    -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. -
    -
    -listpeers
    - -
    -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 synchronization candidates.
    - -
    -peers
    - -
    -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 + denotes symmetric active, a - indicates -symmetric passive, a = means the remote server is being polled -in client mode, a ^ indicates that the server is broadcasting -to this address, a ~ denotes that the remote peer is sending broadcasts -and a * marks the peer the server is currently synchronizing to.
    - - -

    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 REFCLK(implementation number, parameter). -On hostnames no only IP-addresses will be displayed. -

    -dmpeers
    - -
    -A slightly different peer summary list. Identical to the output of the -peers 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 . indicates that this peer -was cast off in the falseticker detection, while a + indicates -that the peer made it through. A * denotes the peer the server -is currently synchronizing with.
    - -
    -showpeer peer_address [...]
    - -
    -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.
    - -
    -pstats peer_address [...]
    - -
    -Show per-peer statistic counters associated with the specified peer(s).
    - -
    -clockinfo clock_peer_address [...]
    - -
    -Obtain and print information concerning a peer clock. The values obtained -provide information on the setting of fudge factors and other clock performance -information.
    - -
    -kerninfo
    - -
    -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.
    - -
    -loopinfo [ oneline | multiline ]
    - -
    -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 -offset is the last offset given to the loop filter by the packet -processing code. The frequency is the frequency error of the local -clock in parts-per-million (ppm). The time_const controls the -stiffness of the phase-lock loop and thus the speed at which it can adapt -to oscillator drift. The watchdog timer value is the number of -seconds which have elapsed since the last sample offset was given to the -loop filter. The oneline and multiline options specify -the format in which this information is to be printed, with multiline -as the default.
    - -
    -sysinfo
    - -
    -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.
    - -
    -
    -The system flags show various system flags, some of which can -be set and cleared by the enable and disable configuration -commands, respectively. These are the auth, bclient, -monitor, pll, pps and stats flags. -See the ntpd documentation for the meaning of these flags. There -are two additional flags which are read only, the kernel_pll and -kernel_pps. These flags indicate the synchronization status when -the precision time kernel modifications are in use. The kernel_pll -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.
    - -
    -The stability 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 tick -may be incorrect.
    - -
    -The broadcastdelay shows the default broadcast delay, as set by -the broadcastdelay configuration command.
    - -
    -The authdelay shows the default authentication delay, as set by -the authdelay configuration command.
    -
    - -
    -sysstats
    - -
    -Print statistics counters maintained in the protocol module.
    - -
    -memstats
    - -
    -Print statistics counters related to memory allocation code.
    - -
    -iostats
    - -
    -Print statistics counters maintained in the input-output module.
    - -
    -timerstats
    - -
    -Print statistics counters maintained in the timer/event queue support code.
    - -
    -reslist
    - -
    -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.
    - -
    -monlist [ version ]
    - -
    -Obtain and print traffic counts collected and maintained by the monitor -facility. The version number should not normally need to be specified.
    - -
    -clkbug clock_peer_address [...]
    - -
    -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.
    -
    - -

    -Runtime Configuration Requests

    -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. - -

    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. - -

    The following commands all make authenticated requests. -

    -
    -addpeer peer_address [ keyid ] [ version ] [ prefer -]
    - -
    -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 keyid -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 version# -can be 1, 2 or 3 and defaults to 3. The prefer 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.
    - -
    -addserver peer_address [ keyid ] [ version ] [ -prefer ]
    - -
    -Identical to the addpeer command, except that the operating mode is client.
    - -
    -broadcast peer_address [ keyid ] [ version ] [ -prefer ]
    - -
    -Identical to the addpeer command, except that the operating mode is broadcast. -In this case a valid key identifier and key are required. The peer_address -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.
    - -
    -unconfig peer_address [...]
    - -
    -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.
    - -
    -fudge peer_address [ time1 ] [ time2 ] [ stratum -] [ refid ]
    - -
    -This command provides a way to set certain data for a reference clock. -See the source listing for further information.
    - -
    -enable [ flag ] [ ... ]
    - -
    disable [ flag ] [ ... ] -
    -These commands operate in the same way as the enable and disable -configuration file commands of ntpd. Following is a description -of the flags. Note that only the auth, bclient, monitor, -pll, pps and stats flags can be set by ntpdc; -the pll_kernel and pps_kernel flags are read-only.
    - -
    -
    -auth
    - -
    -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.
    - -
    -bclient
    - -
    -Enables the server to listen for a message from a broadcast or multicast -server, as in the multicastclient command with default address. -The default for this flag is disable.
    - -
    -monitor
    - -
    -Enables the monitoring facility. See the ntpdc program and the -monlist command or further information. The default for this flag -is enable.
    - -
    -pll
    - -
    -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 Reference -Clock Drivers page for further information. The default for this flag -is enable.
    - -
    -pps
    - -
    -Enables the pulse-per-second (PPS) signal when frequency and time is disciplined -by the precision time kernel modifications. See the A -Kernel Model for Precision Timekeeping page for further information. -The default for this flag is disable.
    - -
    -stats
    - -
    -Enables the statistics facility. See the Monitoring -Options page for further information. The default for this flag is -enable.
    - -
    -pll_kernel
    - -
    -When the precision time kernel modifications are installed, this indicates -the kernel controls the clock discipline; otherwise, the daemon controls -the clock discipline.
    - -
    -pps_kernel
    - -
    -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 pll_kernel flag.
    -
    - -
    -restrict address mask flag [ flag ]
    - -
    -This command operates in the same way as the restrict configuration -file commands of ntpd.
    - -
    -unrestrict address mask flag [ flag ]
    - -
    -Unrestrict the matching entry from the restrict list.
    - -
    -delrestrict address mask [ ntpport ]
    - -
    -Delete the matching entry from the restrict list.
    - -
    -readkeys
    - -
    -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 ntpd configuration file). This allows encryption keys to -be changed without restarting the server.
    - -
    -trustkey keyid [...]
    - -
    -untrustkey keyid [...]
    - -
    -These commands operate in the same way as the trustedkey and untrustkey -configuration file commands of ntpd.
    - -
    -authinfo
    - -
    -Returns information concerning the authentication module, including known -keys and counts of encryptions and decryptions which have been done.
    - -
    -traps
    - -
    -Display the traps set in the server. See the source listing for further -information.
    - -
    -addtrap [ address [ port ] [ interface ]
    - -
    -Set a trap for asynchronous messages. See the source listing for further -information.
    - -
    -clrtrap [ address [ port ] [ interface]
    - -
    -Clear a trap for asynchronous messages. See the source listing for further -information.
    - -
    -reset
    - -
    -Clear the statistics counters in various modules of the server. See the -source listing for further information.
    -
    - -

    -Bugs

    -ntpdc 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.  -
    -
    -David L. Mills (mills@udel.edu)
    - - - diff --git a/dist/ntp/html/ntpq.htm b/dist/ntp/html/ntpq.htm deleted file mode 100644 index 1b94992c21de..000000000000 --- a/dist/ntp/html/ntpq.htm +++ /dev/null @@ -1,747 +0,0 @@ - - - - - ntpq - standard NTP query program - - - - -

    -pq - standard NTP query program

    - -
    -

    -Synopsis

    -ntpq [-inp] [-c command] [host] [...] -

    -Description

    -ntpq 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. -ntpq can also obtain and print a list of peers in a common format -by sending multiple queries to the server. - -

    If one or more request options is included on the command line when -ntpq 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, ntpq -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. ntpq -will prompt for commands if the standard input is a terminal device. - -

    ntpq 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. ntpq makes one attempt to retransmit requests, and will -time requests out if the remote host is not heard from within a suitable -timeout time. - -

    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, ntpq -will attempt to read interactive format commands from the standard input. -

    -
    --c
    - -
    -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.
    - -
    --i
    - -
    -Force ntpq to operate in interactive mode. Prompts will be written -to the standard output and commands read from the standard input.
    - -
    --n
    - -
    -Output all host addresses in dotted-quad numeric format rather than converting -to the canonical host names.
    - -
    --p
    - -
    -Print a list of the peers known to the server as well as a summary of their -state. This is equivalent to the peers interactive command.
    -
    - -

    -Internal Commands

    -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 ntpq program itself and do not result in NTP mode 6 -requests being sent to a server. These are described following. -
    -
    -? [command_keyword]
    - -
    helpl [ command_keyword ] -
    -A "?" by itself will print a list of all the command keywords -known to this incarnation of ntpq. A "?" followed by -a command keyword will print function and usage information about the -command. This command is probably a better source of information about -ntpq than this manual page.
    - -
    - -
    -addvars variable_name [ = value] [...]
    - -
    rmvars variable_name [...] -
    clearvars -
    -The data carried by NTP mode 6 messages consists of a list of items of -the form variable_name = value, where the " -= value" is ignored, and can be omitted, in requests to the -server to read variables. ntpq 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.
    - -
    - -
    -authenticate yes | no
    - -
    -Normally ntpq does not authenticate requests unless they are write -requests. The command authenticate yes causes ntpq 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.
    - -
    - -
    -cooked
    - -
    -Causes output from query commands to be "cooked". Variables which -are recognized by the server will have their values reformatted for human -consumption. Variables which ntpq thinks should have a decodeable -value but didn't are marked with a trailing "?".
    - -
    - -
    -debug more | less | off
    - -
    -Turns internal query program debugging on and off.
    - -
    - -
    -delay milliseconds
    - -
    -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.
    - -
    - -
    -host hostname
    - -
    -Set the host to which future queries will be sent. Hostname may be either -a host name or a numeric address.
    - -
    - -
    -hostnames [yes | no]
    - -
    -If "yes" is specified, host names are printed in information displays. -If "no" is specified, numeric addresses are printed instead. The -default is "yes", unless modified using the command line -n -switch.
    - -
    - -
    -keyid keyid
    - -
    -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.
    - -
    - -
    -ntpversion 1 | 2 | 3 | 4
    - -
    -Sets the NTP version number which ntpq 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.
    - -
    - -
    -quit
    - -
    -Exit ntpq.
    - -
    - -
    -passwd
    - -
    -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.
    - -
    - -
    -raw
    - -
    -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.
    - -
    - -
    -timeout millseconds
    - -
    -Specify a timeout period for responses to server queries. The default is -about 5000 milliseconds. Note that since ntpq retries each query -once after a timeout, the total waiting time for a timeout will be twice -the timeout value set.
    -
    - -

    -Control Message Commands

    -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. - -

    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. -

    -
    -associations
    - -
    -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 condition field. Note that the data returned -by the "associations" command is cached internally in ntpq. -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.
    - -
    - -
    -clockvar [assocID] [variable_name [ = value [...] -] [...]
    - -
    -cv [assocID] [variable_name [ = value [...] ] -[...]
    - -
    -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 "system clock" 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.
    - -
    - -
    -lassociations
    - -
    -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 "associations" 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 "associations" -command is used, but are included in the output of "lassociations".
    - -
    - -
    -lpassociations
    - -
    -Print data for all associations, including out-of-spec client associations, -from the internally cached list of associations. This command differs from -"passociations" only when dealing with fuzzballs.
    - -
    - -
    -lpeers
    - -
    -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.
    - -
    - -
    -mreadlist assocID assocID
    - -
    mrl assocID assocID -
    -Like the readlist 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 associations command.
    - -
    - -
    -mreadvar assocID assocID [ variable_name [ = value -[ ... ]
    - -
    mrv assocID assocID [ variable_name [ = value -[ ... ] -
    -Like the readvar 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 associations command.
    - -
    - -
    -opeers
    - -
    -An old form of the peers command with the reference ID replaced -by the local interface address.
    - -
    - -
    -passociations
    - -
    -Prints association data concerning in-spec peers from the internally cached -list of associations. This command performs identically to the "associations" -except that it displays the internally stored data rather than making a -new query.
    - -
    - -
    -peers
    - -
    -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.
    - -
    - -
    -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 pidgeon -used in the rv command, and a short explanation of the condition -revealed.
    - -
    - -
    -space reject
    - -
    -
    -The peer is discarded as unreachable, synchronized to this server (synch -loop) or outrageous synchronization distance.
    - -
    -
    - -
    -x     falsetick
    - -
    -
    -The peer is discarded by the intersection algorithm as a falseticker.
    - -
    -
    - -
    -.     excess
    - -
    -
    -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.
    - -
    -
    - -
    --     outlyer
    - -
    -
    -The peer is discarded by the clustering algorithm as an outlyer.
    - -
    -
    - -
    -+     candidat
    - -
    -
    -The peer is a survivor and a candidate for the combining algorithm.
    - -
    -
    - -
    -#     selected
    - -
    -
    -The peer is a survivor, but not among the first six peers sorted by synchronization -distance. If the association is ephemeral, it may be demobilized to conserve -resources.
    - -
    -
    - -
    -*     sys.peer
    - -
    -
    -The peer has been declared the system peer and lends its variables to the -system variables.
    -
    - -
    - 
    - -
    -o     pps.peer
    - -
    -
    -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.
    - -
    -
    - -
    -The flash 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 TEST1 through -TEST9. The bits for each test read in increasing sequency from -the least significant bit and are defined as follows.
    - -
    - -
    -The following TEST1 through TEST4 enumerate procedure -errors. The packet timestamps may or may not be believed, but the remaining -header data are ignored.
    - -
    -
    -
    - -
    -TEST1
    - -
    -
    -Duplicate packet. A copy from somewhere.
    -
    - -
    -
    -
    - -
    -TEST2
    - -
    -
    -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.
    - -
    -
    - -
    -TEST3
    - -
    -
    -Unsynchronized. One or more timestamp fields are missing. This normally -happens when the first packet from a peer is received.
    - -
    -
    - -
    -TEST4
    - -
    -
    -Either peer delay or peer dispersion is greater than one second. Ya gotta -be kidding.
    - -
    -
    - -
    -The following TEST5 through TEST10 ennumerate errors -in the packet header. The packet is discarded without inspecting its contents.
    - -
    -
    -
    - -
    -TEST5
    - -
    -
    -Cryptographic authentication fails. See the Authentication -Options page.
    - -
    -
    - -
    -TEST6
    - -
    -
    -Peer is unsynchronized. Wind up its clock first.
    - -
    -
    - -
    -TEST7
    - -
    -
    -Peer stratum is greater than 15. The peer is probably unsynchronized.
    - -
    -
    - -
    -TEST8
    - -
    -
    -Either root delay or root dispersion is greater than one second. Too far -from home.
    -
    - -
    -
    -
    - -
    -TEST9
    - -
    -
    -Peer cryptographic authentication fails. Either the key identifier or key -is wrong or somebody trashed our packet.
    - -
    -
    - -
    -TEST10
    - -
    -
    -Access is denied. See the Access Control Options -page.
    - -
    -
    - -
    -pstatus assocID
    - -
    -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 hexadecimal and in pidgeon English.
    - -
    - -
    -readlist [ assocID ]
    - -
    rl [ assocID ] -
    -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.
    - -
    - -
    -readvar assocID variable_name [ = value ] [ ... -]
    - -
    rv assocID [ variable_name [ = value ] [ ... -] -
    -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.
    - -
    - -
    -writevar assocID variable_name [ = value [ ... -]
    - -
    -Like the readvar request, except the specified variables are written instead -of read.
    - -
    - -
    -writelist [ assocID ]
    - -
    -Like the readlist request, except the internal list variables are written -instead of read.
    -
    - -

    -Bugs

    -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.  -
    -
    -David L. Mills (mills@udel.edu)
    - - - diff --git a/dist/ntp/html/ntptime.htm b/dist/ntp/html/ntptime.htm deleted file mode 100644 index 3cc454487de3..000000000000 --- a/dist/ntp/html/ntptime.htm +++ /dev/null @@ -1,96 +0,0 @@ - - - - - ntptime - read kernel time variables - - - - -

    -ntptime - read kernel time variables

    - -
    -

    -Synopsis

    -ntptime [ -chr ] [ -e est_error ] [ -f frequency ] [ --m max_error ] [ -o offset ] [ -s status ] [ -t time_constant -] -

    -Description

    -This program is useful only with special kernels described in the A -Kernel Model for Precision Timekeeping page. It reads and displays -time-related kernel variables using the ntp_gettime() system call. -A similar display can be obtained using the ntpdc program and -kerninfo command. -

    -Options

    - -
    -
    --c
    - -
    -Display the execution time of ntptime itself.
    - -
    --e est_error
    - -
    -Specify estimated error, in microseconds.
    - -
    --f frequency
    - -
    -Specify frequency offset, in parts per million.
    - -
    --h
    - -
    -Display times in Unix timeval format. Default is NTP format.
    - -
    --l
    - -
    -Specify the leap bits as a code from 0 to 3.
    - -
    --m max_error
    - -
    -Display help information.
    - -
    --o offset
    - -
    -Specify clock offset, in microseconds.
    - -
    --r
    - -
    -Display Unix and NTP times in raw format.
    - -
    --s status
    - -
    -Specify clock status. Better know what you are doing.
    - -
    --t time_constant
    - -
    -Specify time constant, an integer in the range 0-4.
    -
    - -
    -
    -David L. Mills (mills@udel.edu)
    - - - diff --git a/dist/ntp/html/ntptrace.htm b/dist/ntp/html/ntptrace.htm deleted file mode 100644 index 675c347a566a..000000000000 --- a/dist/ntp/html/ntptrace.htm +++ /dev/null @@ -1,82 +0,0 @@ - - - - - ntptrace - trace a chain of NTP servers back to the primary -source - - - - -

    -ntptrace - trace a chain of NTP servers back to the primary source

    - -
    -

    -Synopsis

    -ntptrace [ -vdn ] [ -r retries ] [ -t timeout ] [ server -] -

    -Description

    -ntptrace 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 localhost. -Here is an example of the output from ntptrace: -
    % 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'
    -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 ntptrace; -this is why it is not always zero for "localhost"), 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. -

    -Options

    - -
    -
    --d
    - -
    -Turns on some debugging output.
    - -
    --n
    - -
    -Turns off the printing of host names; instead, host IP addresses are given. -This may be useful if a nameserver is down.
    - -
    --r retries
    - -
    -Sets the number of retransmission attempts for each host (default = 5).
    - -
    --t timeout
    - -
    -Sets the retransmission timeout (in seconds) (default = 2).
    - -
    --v
    - -
    -Prints verbose information about the NTP servers.
    -
    - -

    -Bugs

    -This program makes no attempt to improve accuracy by doing multiple samples.  -
    -
    -David L. Mills (mills@udel.edu)
    - - - diff --git a/dist/ntp/html/parsedata.htm b/dist/ntp/html/parsedata.htm deleted file mode 100644 index a756079cefc2..000000000000 --- a/dist/ntp/html/parsedata.htm +++ /dev/null @@ -1,407 +0,0 @@ - -NTP PARSE clock data formats -

    NTP PARSE clock data formats

    - -

    The parse driver currently supports several clocks with different -query mechanisms. In order for you to find a sample that might be -similar to a clock you might want to integrate into parse i'll sum -up the major features of the clocks (this information is distributed -in the parse/clk_*.c and ntpd/refclock_parse.c files). - -


    -

    Meinberg clocks

    -
    -Meinberg: start=<STX>, end=<ETX>, sync on start
    -      pattern="\2D:  .  .  ;T: ;U:  .  .  ;    \3"
    -      pattern="\2  .  .  ;  ;   :  :  ;        \3"
    -      pattern="\2  .  .  ;  ;   :  :  ;    :  ;        ;   .         .       "
    -
    -

    - Meinberg is a german manufacturer of time code receivers. Those clocks - have a pretty common output format in the stock version. In order to - support NTP Meinberg was so kind to produce some special versions of - the firmware for the use with NTP. So, if you are going to use a - Meinberg clock please ask whether there is a special Uni Erlangen - version. - You can reach Meinberg via the Web. - Information can also be ordered via eMail from info@meinberg.de - -

    - General characteristics: -
    - Meinberg clocks primarily output pulse per second and a describing - ASCII string. This string can be produced in two modes. either upon - the reception of a question mark or every second. NTP uses the latter - mechanism. The DCF77 variants have a pretty good relationship between - RS232 time code and the PPS signal while the GPS receiver has no fixed - timeing between the datagram and the pulse (you need to use PPS with - GPS!) on DCF77 you might get away without the PPS signal. -

    -	The preferred tty setting for Meinberg is:
    -		CFLAG		(B9600|CS7|PARENB|CREAD|HUPCL)
    -		IFLAG		(IGNBRK|IGNPAR|ISTRIP)
    -		OFLAG		0
    -		LFLAG		0
    -        
    -
    -	The tty setting for Meinberg GPS 166/167 receivers is:
    -		CFLAG		(B19200|CS8|PARENB|CREAD|HUPCL)
    -		IFLAG		(IGNBRK|IGNPAR|ISTRIP)
    -		OFLAG		0
    -		LFLAG		0
    -        
    - -

    - The clock is run at datagram once per second. - Stock dataformat is: -

    -    <STX>D:<dd>.<mm>.<yy>;T:<w>;U:<hh>:<mm>:<ss>;<S><F><D><A><ETX>
    -pos:  0  00 00 0 00 0 11 111 1 111 12 2 22 2 22 2 2  2  3  3   3
    -      1  23 45 6 78 9 01 234 5 678 90 1 23 4 56 7 8  9  0  1   2
    -
    -<STX>           = '\002' ASCII start of text
    -<ETX>           = '\003' ASCII end of text
    -<dd>,<mm>,<yy>  = day, month, year(2 digits!!)
    -<w>             = day of week (sunday= 0)
    -<hh>,<mm>,<ss>  = hour, minute, second
    -<S>             = '#' if never synced since powerup else ' ' for DCF U/A 31
    -                  '#' if not PZF sychronisation available else ' ' for PZF 535
    -<F>             = '*' if time comes from internal quartz else ' '
    -<D>             = 'S' if daylight saving time is active else ' '
    -<D>             = 'U' if UTC time code is deliverd else ' '
    -<A>             = '!' during the hour preceeding an daylight saving time
    -                      start/end change
    -<A>             = 'A' if a leap second is announced
    -
    - -
    -        <STX><dd>.<mm>.<yy>; <w>; <hh>:<mm>:<ss>; <U><S><F><D><A><L><R><ETX>
    -    pos:  0   00 0 00 0 00 11 1 11 11 1 11 2 22 22 2  2  2  2  2  3  3   3
    -          1   23 4 56 7 89 01 2 34 56 7 89 0 12 34 5  6  7  8  9  0  1   2
    -    <STX>           = '\002' ASCII start of text
    -    <ETX>           = '\003' ASCII end of text
    -    <dd>,<mm>,<yy>  = day, month, year(2 digits!!)
    -    <w>             = day of week (sunday= 0)
    -    <hh>,<mm>,<ss>  = hour, minute, second
    -    <U>             = 'U' UTC time display
    -    <S>             = '#' if never synced since powerup else ' ' for DCF U/A 31
    -                      '#' if not PZF sychronisation available else ' ' for PZF 535
    -    <F>             = '*' if time comes from internal quartz else ' '
    -    <D>             = 'S' if daylight saving time is active else ' '
    -    <A>             = '!' during the hour preceeding an daylight saving time
    -                          start/end change
    -    <L>             = 'A' LEAP second announcement
    -    <R>             = 'R' alternate antenna
    -
    -

    Meinberg GPS166 receiver -
    - You must get the Uni-Erlangen firmware for the GPS receiver support - to work to full satisfaction ! -

    -        <STX><dd>.<mm>.<yy>; <w>; <hh>:<mm>:<ss>; <+/-><00:00>; <U><S><F><D><A><L><R><L>; <position...><ETX>
    - *
    -           000000000111111111122222222223333333333444444444455555555556666666
    -           123456789012345678901234567890123456789012345678901234567890123456
    -        \x0209.07.93; 5; 08:48:26; +00:00;        ; 49.5736N  11.0280E  373m\x03
    - *
    -    
    -    <STX>           = '\002' ASCII start of text
    -    <ETX>           = '\003' ASCII end of text
    -    <dd>,<mm>,<yy>  = day, month, year(2 digits!!)
    -    <w>             = day of week (sunday= 0)
    -    <hh>,<mm>,<ss>  = hour, minute, second
    -    <+/->,<00:00>   = offset to UTC
    -    <S>             = '#' if never synced since powerup else ' ' for DCF U/A 31
    -                      '#' if not PZF sychronisation available else ' ' for PZF 535
    -    <U>             = 'U' UTC time display
    -    <F>             = '*' if time comes from internal quartz else ' '
    -    <D>             = 'S' if daylight saving time is active else ' '
    -    <A>             = '!' during the hour preceeding an daylight saving time
    -                          start/end change
    -    <L>             = 'A' LEAP second announcement
    -    <R>             = 'R' alternate antenna (reminiscent of PZF535) usually ' '
    -    <L>		   = 'L' on 23:59:60
    -
    - -

    For the Meinberg parse look into clock_meinberg.c - -
    -

    Raw DCF77 Data via serial line

    -

    RAWDCF: end=TIMEOUT>1.5s, sync each char (any char),generate psuedo time - codes, fixed format -

    - direct DCF77 code input - -

    In Europe it is relatively easy/cheap the receive the german time code - transmitter DCF77. The simplest version to process its signal is to - feed the 100/200ms pulse of the demodulated AM signal via a level - converter to an RS232 port at 50Baud. parse/clk_rawdcf.c holds all - necessary decoding logic for the time code which is transmitted each - minute for one minute. A bit of the time code is sent once a second. - -

    -	The preferred tty setting is:
    -		CFLAG           (B50|CS8|CREAD|CLOCAL)
    -		IFLAG		0
    -		OFLAG		0
    - 		LFLAG		0
    -
    - -

    DCF77 raw time code

    - - -

    From "Zur Zeit", Physikalisch-Technische Bundesanstalt (PTB), Braunschweig -und Berlin, März 1989 -
    -

    -	Timecode transmission:
    -
    -	AM:
    -
    -	time marks are send every second except for the second before the
    -	next minute mark
    -	time marks consist of a reduction of transmitter power to 25%
    -	of the nominal level
    -	the falling edge is the time indication (on time)
    -	time marks of a 100ms duration constitute a logical 0
    -	time marks of a 200ms duration constitute a logical 1
    -
    -	FM:
    -
    -	see the spec. (basically a (non-)inverted psuedo random phase shift)
    -
    -	Encoding:
    -
    -	Second	Contents
    -	0  - 10	AM: free, FM: 0
    -	11 - 14	free
    -	15		R     - alternate antenna
    -	16		A1    - expect zone change (1 hour before)
    -	17 - 18	Z1,Z2 - time zone
    -		 0  0 illegal
    -		 0  1 MEZ  (MET)
    -		 1  0 MESZ (MED, MET DST)
    -		 1  1 illegal
    -	19		A2    - expect leap insertion/deletion (1 hour before)
    -	20		S     - start of time code (1)
    -	21 - 24	M1    - BCD (lsb first) Minutes
    -	25 - 27	M10   - BCD (lsb first) 10 Minutes
    -	28		P1    - Minute Parity (even)
    -	29 - 32	H1    - BCD (lsb first) Hours
    -	33 - 34      H10   - BCD (lsb first) 10 Hours
    -	35		P2    - Hour Parity (even)
    -	36 - 39	D1    - BCD (lsb first) Days
    -	40 - 41	D10   - BCD (lsb first) 10 Days
    -	42 - 44	DW    - BCD (lsb first) day of week (1: Monday -> 7: Sunday)
    -	45 - 49	MO    - BCD (lsb first) Month
    -	50           MO0   - 10 Months
    -	51 - 53	Y1    - BCD (lsb first) Years
    -	54 - 57	Y10   - BCD (lsb first) 10 Years
    -	58 		P3    - Date Parity (even)
    -	59		      - usually missing (minute indication), except for leap insertion
    -
    - -
    -

    Schmid clock

    - -

    - Schmid clock: needs poll, binary input, end='\xFC', sync start - -

    - The Schmid clock is a DCF77 receiver that sends a binary - time code at the reception of a flag byte. The contents - if the flag byte determined the time code format. The - binary time code is delimited by the byte 0xFC. -

    -	TTY setup is:
    -		CFLAG		(B1200|CS8|CREAD|CLOCAL)
    -		IFLAG		0
    -		OFLAG		0
    - 		LFLAG		0
    -
    -
    - - -

    The command to Schmid's DCF77 clock is a single byte; each bit - allows the user to select some part of the time string, as follows (the - output for the lsb is sent first). - -

    -	Bit 0:	time in MEZ, 4 bytes *binary, not BCD*; hh.mm.ss.tenths
    -	Bit 1:	date 3 bytes *binary, not BCD: dd.mm.yy
    -	Bit 2:	week day, 1 byte (unused here)
    -	Bit 3:	time zone, 1 byte, 0=MET, 1=MEST. (unused here)
    -	Bit 4:	clock status, 1 byte,	0=time invalid,
    -					1=time from crystal backup,
    -					3=time from DCF77
    -	Bit 5:	transmitter status, 1 byte,
    -					bit 0: backup antenna
    -					bit 1: time zone change within 1h
    -					bit 3,2: TZ 01=MEST, 10=MET
    -					bit 4: leap second will be
    -						added within one hour
    -					bits 5-7: Zero
    -	Bit 6:	time in backup mode, units of 5 minutes (unused here)
    -
    - -
    -

    Trimble SV6 ASCII time code (TAIP)

    - -

    - Trimble SV6: needs poll, ascii timecode, start='>', end='<', - query='>QTM<', eol='<' - -

    Trimble SV6 is a GPS receiver with PPS output. It needs to be polled. - It also need a special tty mode setup (EOL='<'). -

    -	TTY setup is:
    -		CFLAG            (B4800|CS8|CREAD)
    -		IFLAG            (BRKINT|IGNPAR|ISTRIP|ICRNL|IXON)
    -		OFLAG            (OPOST|ONLCR)
    -		LFLAG            (ICANON|ECHOK)
    -
    -	Special flags are:
    -		PARSE_F_PPSPPS	    - use CIOGETEV for PPS time stamping
    -		PARSE_F_PPSONSECOND - the time code is not related to
    -				      the PPS pulse (so use the time code
    -				      only for the second epoch)
    -
    -	Timecode
    -	0000000000111111111122222222223333333	/ char
    -	0123456789012345678901234567890123456	\ posn
    -	>RTMhhmmssdddDDMMYYYYoodnnvrrrrr;*xx<	Actual
    -	----33445566600112222BB7__-_____--99-	Parse
    -	>RTM                      1     ;*  < 	Check
    -
    - -
    -

    ELV DCF7000

    -

    - ELV DCF7000: end='\r', pattern=" - - - - - - - \r" -

    - The ELV DCF7000 is a cheap DCF77 receiver sending each second - a time code (though not very precise!) delimited by '`r' -

    -	Timecode
    -	  YY-MM-DD-HH-MM-SS-FF\r
    -
    -		FF&0x1	- DST
    -		FF&0x2	- DST switch warning
    -		FF&0x4  - unsynchronised
    -
    -
    -

    HOPF 6021 und Kompatible

    - -

    - HOPF Funkuhr 6021 mit serieller Schnittstelle - Created by F.Schnekenbuehl <frank@comsys.dofn.de> from clk_rcc8000.c - Nortel DASA Network Systems GmbH, Department: ND250 - A Joint venture of Daimler-Benz Aerospace and Nortel. - -

    - hopf Funkuhr 6021 
    -      used with 9600,8N1,
    -      UTC via serial line
    -      "Sekundenvorlauf" ON
    -      ETX zum Sekundenvorlauf ON
    -      dataformat 6021
    -      output time and date
    -      transmit with control characters
    -      transmit evry second
    - 
    -  Type 6021 Serial Output format
    -
    -      000000000011111111 / char
    -      012345678901234567 \ position
    -      sABHHMMSSDDMMYYnre  Actual
    -       C4110046231195     Parse
    -      s              enr  Check
    -
    -  s = STX (0x02), e = ETX (0x03)
    -  n = NL  (0x0A), r = CR  (0x0D)
    -
    -  A B - Status and weekday
    - 
    -  A - Status
    -
    -      8 4 2 1
    -      x x x 0  - no announcement
    -      x x x 1  - Summertime - wintertime - summertime announcement
    -      x x 0 x  - Wintertime
    -      x x 1 x  - Summertime
    -      0 0 x x  - Time/Date invalid
    -      0 1 x x  - Internal clock used 
    -      1 0 x x  - Radio clock
    -      1 1 x x  - Radio clock highprecision
    -
    -  B - 8 4 2 1
    -      0 x x x  - MESZ/MEZ
    -      1 x x x  - UTC
    -      x 0 0 1  - Monday
    -      x 0 1 0  - Tuesday
    -      x 0 1 1  - Wednesday
    -      x 1 0 0  - Thursday
    -      x 1 0 1  - Friday
    -      x 1 1 0  - Saturday
    -      x 1 1 1  - Sunday
    -
    -
    -

    Diem Computime Clock

    - -

    - The Computime receiver sends a datagram in the following format every minute -

       
    -   Timestamp	T:YY:MM:MD:WD:HH:MM:SSCRLF 
    -   Pos          0123456789012345678901 2 3
    -		0000000000111111111122 2 2
    -   Parse        T:  :  :  :  :  :  :  \r\n
    -   
    -   T	Startcharacter "T" specifies start of the timestamp 
    -   YY	Year MM	Month 1-12 
    -   MD	Day of the month 
    -   WD	Day of week 
    -   HH	Hour 
    -   MM   Minute 
    -   SS   Second
    -   CR   Carriage return 
    -   LF   Linefeed
    -
    -
    -

    WHARTON 400A Series Clock with a 404.2 Serial interface

    - -

    - The WHARTON 400A Series clock is able to send date/time serial messages - in 7 output formats. We use format 1 here because it is the shortest. - We set up the clock to send a datagram every second. - For use with this driver, the WHARTON 400A Series clock must be set-up - as follows : -

    -  					Programmable	Selected
    -  					Option No	Option
    -	BST or CET display		3		9 or 11
    -	No external controller		7		0
    -	Serial Output Format 1		9		1
    -	Baud rate 9600 bps		10		96
    -	Bit length 8 bits		11		8
    -	Parity even			12		E
    -
    - WHARTON 400A Series output format 1 is as follows : -
    -   Timestamp	STXssmmhhDDMMYYSETX
    -   Pos		0  12345678901234
    -  		0  00000000011111
    -  
    -   STX	start transmission (ASCII 0x02)
    -   ETX	end transmission (ASCII 0x03)
    -   ss	Second expressed in reversed decimal (units then tens)
    -   mm	Minute expressed in reversed decimal
    -   hh	Hour expressed in reversed decimal
    -   DD	Day of month expressed in reversed decimal
    -   MM	Month expressed in reversed decimal (January is 1)
    -   YY	Year (without century) expressed in reversed decimal
    -   S	Status byte : 0x30 +
    -		bit 0	0 = MSF source		1 = DCF source
    -		bit 1	0 = Winter time		1 = Summer time
    -		bit 2	0 = not synchronised	1 = synchronised
    -		bit 3	0 = no early warning	1 = early warning
    -
    diff --git a/dist/ntp/html/parsenew.htm b/dist/ntp/html/parsenew.htm deleted file mode 100644 index 0ef60bc06002..000000000000 --- a/dist/ntp/html/parsenew.htm +++ /dev/null @@ -1,237 +0,0 @@ - -Making PARSE Clocks -

    How to build new PARSE clocks

    - -

    Here is an attempt to sketch out what you need to do in order to -add another clock to the parse driver: -Currently the implementation is being cleaned up - so not all information -in here is completely correct. Refer to the included code where in doubt. - - -

    Prerequisites: -

      -
    • Does the system you want the clock connect to have the include files -termio.h or termios.h ? (You need that for the parse driver) -
    - - -

    What to do: - - -

    Make a conversion module (libparse/clk_*.c) - -

      -
    1. What ist the time code format ? -
        -
      • find year, month, day, hour, minute, second, status (synchronised or -not), possibly time zone information (you need to give the offset to UTC) -You will have to convert the data from a string into a struct clocktime: -
        -      struct clocktime                /* clock time broken up from time code */
        -      {
        -	long day;
        -	long month;
        -	long year;
        -	long hour;
        -	long minute;
        -	long second;
        -	long usecond;
        -	long utcoffset;       /* in seconds */
        -	time_t utcoffset;     /* true utc time instead of date/time */
        -	long flags;           /* current clock status */
        -      };
        -
        - -

        Conversion is usually simple and straight forward. For the flags following -values can be OR'ed together: -

        -     PARSEB_ANNOUNCE           switch time zone warning (informational only)
        -     PARSEB_POWERUP            no synchronisation - clock confused (must set then)
        -     PARSEB_NOSYNC             timecode currently not confirmed (must set then)
        -                               usually on reception error when there is still a
        -                               chance the the generated time is still ok.
        -
        -     PARSEB_DST                DST in effect (informational only)
        -     PARSEB_UTC                timecode contains UTC time (informational only)
        -     PARSEB_LEAPADD            LEAP addition warning (prior to leap happening - must set when imminent)
        -			       also used for time code that do not encode the
        -			       direction (as this is currently the default).
        -     PARSEB_LEAPDEL            LEAP deletion warning (prior to leap happening - must set when imminent)
        -     PARSEB_ALTERNATE          backup transmitter (informational only)
        -     PARSEB_POSITION           geographic position available (informational only)
        -     PARSEB_LEAPSECOND         actual leap second (this time code is the leap
        -                               second - informational only)
        -
        - -

        These are feature flags denoting items that are supported by the clock: -

        -     PARSEB_S_LEAP             supports LEAP - might set PARSEB_LEAP
        -     PARSEB_S_ANTENNA          supports ANTENNA - might set PARSEB_ALTERNATE
        -     PARSEB_S_PPS              supports PPS time stamping
        -     PARSEB_S_POSITION         supports position information (GPS)
        -   
        - -

        If the utctime field is non zero this value will be take as - time code value. This allows for conversion routines that - already have the utc time value. The utctime field gives the seconds - since Jan 1st 1970, 0:00:00. The useconds field gives the respective - usec value. The fields for date and time (down to second resolution) - will be ignored. - - -

        Conversion is done in the cvt_* routine in parse/clk_*.c files. look in - them for examples. The basic structure is: - -

        -     struct clockformat <yourclock>_format = {
        -       lots of fields for you to fill out (see below)
        -     };
        -
        -     static cvt_<yourclock>()
        -       ...
        -     {
        -       if (<I do not recognize my time code>) {
        -         return CVT_NONE;
        -       } else {
        -         if (<conversion into clockformat is ok>) {
        -           <set all necessary flags>;
        -           return CVT_OK;
        -         } else {
        -           return CVT_FAIL|CVT_BADFMT;
        -         }
        -       }
        -
        - - -

        The struct clockformat is the interface to the rest of the parse - driver - it holds all information necessary for finding the - clock message and doing the appropriate time stamping. - -

        -struct clockformat
        -{
        -  u_long (*input)();
        -  /* input routine - your routine - cvt_<yourclock> */
        -  u_long (*convert)();
        -  /* conversion routine - your routine - cvt_<yourclock> */
        -  /* routine for handling RS232 sync events (time stamps) - usually sync_simple */
        -  u_long (*syncpps)(); 
        -  /* PPS input routine - usually pps_one */
        -  void           *data;
        -  /* local parameters - any parameters/data/configuration info your conversion
        -     routine might need */
        -  char           *name;
        -  /* clock format name - Name of the time code */
        -  unsigned short  length;
        -  /* maximum length of data packet for your clock format */
        -  u_long   flags;
        - /* information for the parser what to look for */
        -};
        -
        - - -

        The above should have given you some hints on how to build a clk_*.c - file with the time code conversion. See the examples and pick a clock - closest to yours and tweak the code to match your clock. - - -

        In order to make your clk_*.c file usable a reference to the clockformat - structure must be put into parse_conf.c. -

      -
    2. TTY setup and initialisation/configuration will be done in -ntpd/refclock_parse.c. -
        -
      • Find out the exact tty settings for your clock (baud rate, parity, -stop bits, character size, ...) and note them in terms of -termio*.h c_cflag macros. -
      • in ntpd/refclock_parse.c fill out a new the struct clockinfo element -(that allocates a new "IP" address - see comments) -(see all the other clocks for example) -
        -   struct clockinfo
        -     {
        -      u_long  cl_flags;             /* operation flags (io modes) */
        -	 PARSE_F_PPSPPS       use loopfilter PPS code (CIOGETEV)
        -	 PARSE_F_PPSONSECOND  PPS pulses are on second
        -	 usually flags stay 0 as they are used only for special setups
        -
        -    void  (*cl_poll)();           /* active poll routine */
        -         The routine to call when the clock needs data sent to it in order to
        -         get a time code from the clock (e.g. Trimble clock)
        -
        -    int   (*cl_init)();           /* active poll init routine */
        -         The routine to call for very special initializations.
        -
        -    void  (*cl_event)();          /* special event handling (e.g. reset clock) */
        -         What to do, when an event happens - used to re-initialize clocks on timeout.
        -
        -    void  (*cl_end)();            /* active poll end routine */
        -         The routine to call to undo any special initialisation (free memory/timers)
        -
        -    void   *cl_data;              /* local data area for "poll" mechanism */
        -         local data for polling routines
        -
        -    u_fp    cl_rootdelay;         /* rootdelay */
        -         NTP rootdelay estimate (usually 0)
        -
        -	     u_long  cl_basedelay;         /* current offset - unsigned l_fp
        -                                              fractional part (fraction) by
        -                                              which the RS232 time code is
        -                                              delayed from the actual time. */
        -
        -    u_long  cl_ppsdelay;          /* current PPS offset - unsigned l_fp fractional
        -         time (fraction) by which the PPS time stamp is delayed (usually 0)
        -   part */
        -
        -    char   *cl_id;                /* ID code (usually "DCF") */
        -         Refclock id - (max 4 chars)
        -
        -    char   *cl_description;       /* device name */
        -         Name of this device.
        -
        -    char   *cl_format;            /* fixed format */
        -         If the data format cann not ne detected automatically this is the name
        -	 as in clk_*.c clockformat.
        -
        -    u_char  cl_type;              /* clock type (ntp control) */
        -         Type if clock as in clock status word (ntp control messages) - usually 0
        -	 
        -    u_long  cl_maxunsync;         /* time to trust oscillator after loosing synch
        -  */
        -         seconds a clock can be trusted after loosing synchronisation.
        -
        -    u_long  cl_speed;             /* terminal input & output baudrate */
        -    u_long  cl_cflag;             /* terminal io flags */
        -    u_long  cl_iflag;             /* terminal io flags */
        -    u_long  cl_oflag;             /* terminal io flags */
        -    u_long  cl_lflag;             /* terminal io flags */
        -         termio*.h tty modes.
        -
        -    u_long  cl_samples;           /* samples for median filter */
        -    u_long  cl_keep;              /* samples for median filter to keep */
        -         median filter parameters - smoothing and rejection of bad samples
        -  } clockinfo[] = {
        -  ...,<other clocks>,...
        -  { < your parameters> },
        -  };
        -
        -
        -
      -
    - -

    Well, this is very sketchy, i know. But I hope it helps a little bit. -The best way is to look which clock comes closest to your and tweak that -code. - -

    Two sorts of clocks are used with parse. Clocks that automatically send -their time code (once a second) do not need entries in the poll routines because -they send the data all the time. The second sort are the clocks that need a -command sent to them in order to reply with a time code (like the Trimble -clock). - -

    For questions: kardel@acm.org. - -

    Please include an exact description on how your clock works. (initialisation, -TTY modes, strings to be sent to it, responses received from the clock). -


    -Frank Kardel diff --git a/dist/ntp/html/patches.htm b/dist/ntp/html/patches.htm deleted file mode 100644 index 9585808b40c1..000000000000 --- a/dist/ntp/html/patches.htm +++ /dev/null @@ -1,67 +0,0 @@ - -Patching Procedures -

    -Patching Procedures -

    - -

    A distribution so widely used as this one eventually develops -numerous barnacles as the result of porting -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. - -

      - -

    1. Please submit patches to David L. -Mills <mills@udel.edu> in the form of either unified-diffs -(diff -u) or context-diffs (diff -c).
    2. - -

    3. Please include the output from -config.guess in the description of your patch. If -config.guess does not produce any output for your machine, -please fix that, too!
    4. - -

    5. 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
    6. - -

      patch -p <your_patch> - -

    7. Please avoid patching the RCS subdirectories; better yet, clean -them out before submitting patches.
    8. - -

    9. 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.
    10. - -

    11. Don't forget the documentation that may be affected by the patch. -Send us patches for the ./html files as well. See the A Beginner's Guide to HTML page for a -tutorial.
    12. - -

    13. We would be glad to include your name, electric address and -descriptive phrase in the Copyright page, -if you wish.
    14. - -
    - -

    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 -./patches directory, which might have been helpful to see -if the same problem occurred in another port, etc. Patches were saved in -that directory with file name in the form patch.nnn, -where nnn was approaching 200. All patches in that directory have -been made; so, if yours was there, it was in the distribution. - -

    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. - -

    The best way to see what's changed between two distributions is to -run a diff against them. -

    Thanks for your contribution and happy chime. - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/porting.htm b/dist/ntp/html/porting.htm deleted file mode 100644 index ac989dc5f210..000000000000 --- a/dist/ntp/html/porting.htm +++ /dev/null @@ -1,78 +0,0 @@ - -Porting Hints -

    -Porting Hints -


    - -

    NOTE: The following procedures have been replaced by GNU automake and -autoconfigure. This page is to be updated in the next release. - -

    Porting to a new machine or operating system ordinarily requires -updating the ./machines directory and the -./compilers directories in order to define the build -environment and autoconfigure means. You will probably have to modify -the ntp_machines.h file and "l_stdlib.h" files -as well. The two most famous trouble spots are the I/O code in -./ntpd/ntp_io.c and the clock adjustment code in -./ntpd/ntp_unixclock.c. - -

    These are the rules so that older bsd systems and the POSIX standard -system can coexist together. - -

      - -
    1. If you use select then include -"ntp_select.h". select is not standard, since -it is very system dependent as to where it is defined. The logic to -include the right system dependent include file is in -"ntp_select.h". - -

    2. Always use POSIX definition of strings. Include -"ntp_string.h" instead of <string.h>. - -

    3. Always include "ntp_malloc.h" if you use -malloc. - -

    4. Always include "ntp_io.h" instead of -<sys/file.h> or <fnctl.h> to get -O_* flags. - -

    5. Always include "ntp_if.h" instead of -<net/if.h>. - -

    6. Always include "ntp_stdlib.h" instead of -<stdlib.h>. - -

    7. Define any special defines needed for a system in -./include/ntp_machine.h based on system identifier. This -file is included by the "ntp_types.h" file and should -always be placed first after the <> defines. - -

    8. Define any special library prototypes left over from the system -library and include files in the "l_stdlib.h" file. This -file is included by the "ntp_stdlib.h" file and should -ordinarily be placed last in the includes list. - -

    9. Don't define a include file by the same name as a system include -file. - -
    - -

    "l_stdlib.h" can contain any extra definitions that are -needed so that gcc will shut up. They should be controlled -by a system identifier and there should be a separate section for each -system. Really this will make it easier to maintain. - -

    See include/ntp_machines.h for the various compile time -options. - -

    When you are satisfied the port works and that other ports are not -adversely affected, please send patches for -the system files you have changed, as well as any documentation that -should be updated, including the advice herein. - -

    Good luck. - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/pps.htm b/dist/ntp/html/pps.htm deleted file mode 100644 index 732f31514102..000000000000 --- a/dist/ntp/html/pps.htm +++ /dev/null @@ -1,84 +0,0 @@ - -Pulse-per-second (PPS) Signal Interfacing -

    -Pulse-per-second (PPS) Signal Interfacing -


    - -

    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 ms 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 -Gadget Box PPS Level Converter and CHU Modem -page. - -

    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 tty_clk line -discipline/streams module inserts a timestamp following this character -in the input data stream. The PPS Clock -Discipline 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. - -

    The modem control leads interface requires converting to RS232 levels -and connecting to the data carrier detect (DCD) lead of a serial port. -The ppsclock and ppsapi streams modules capture a -timestamp upon transition of the DCD signal. Note that the -ppsclock module functionality has been subsumed by the new -ppsapi 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. - -

    The tty_clk module is included in the NTP software -distribution, while the -ppsclock module can be obtained via the web at that link or by -anonymous FTP from ftp.udel.edu in the pub/ntp directory. Both -the tty_clk and ppsclock modules are described in the -Line Disciplines and Streams Drivers page. -Directions for building the modules themselves are in the -./kernel directory. Directions on how to configure -ntpd to operate with these modules is described in Building and Installing the Distribution page. - -

    The PPS driver is operates in conjunction with another reference -clock driver that produces the PPS pulse, as described in the Mitigation Rules and the prefer Keyword -page. One of the drivers described in the Reference Clock Drivers 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 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. - -

    For the utmost time quality, some Unix system kernels support a PPS -signal directly, as described in the A Kernel Model -for Precision Timekeeping 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 ntp_adjtime() system -call described in that page and the /usr/include/sys/timex.h -header file. The presence of these kernel provisions is automatically -detected and supporting code compiled. - -

    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, tty_clk module, ppsclock 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 prefer Keyword page. - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/prefer.htm b/dist/ntp/html/prefer.htm deleted file mode 100644 index edb51520dcbc..000000000000 --- a/dist/ntp/html/prefer.htm +++ /dev/null @@ -1,332 +0,0 @@ - - - - - Mitigation Rules and the ``prefer'' Keyword - - - - -

    -Mitigation Rules and the prefer Keyword

    - -
    -

    -Introduction

    -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. - -

    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 survivors 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. - -

    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 clockhop 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. -

    -The prefer Peer

    -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 prefer peer, which is specified -by including the prefer keyword with the associated server -or peer 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. - -

    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 truechimers 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. - -

    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. - -

    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. -

    -Peer Classification

    -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: -
      -
    1. -The prefer peer is designated using the prefer keyword with the -server or peer commands. All other things being equal, -this peer will be selected for synchronization over all other survivors -of the clock selection procedures.
    2. - -
        -
    3. -When a PPS signal is connected via the PPS Clock Discipline driver (type -22), this is called the PPS peer. 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.
    4. - -
        -
    5. -When the Undisciplined Local Clock driver (type 1) is configured, this -is called the local clock peer. 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 lockclock scheme, or another synchronization -protocol, such as the Digital Time Synchronization Service (DTSS).
    6. - -
        -
    7. -When a modem driver such as the Automated Computer Time Service driver -(type 18) is configured, this is called the modem peer. This is -used either as a backup reference source, should all other primary sources -fail, or as the (only) primary reference source.
    8. - -
        -
    9. -Where support is available, the PPS signal may be processed directly by -the kernel, as described in the A Kernel Model for Precision -Timekeeping page. This is called the kernel discipline. 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.
    10. -
    -Reference clock drivers operate in the manner described in the Reference -Clock Drivers 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. - -

    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. - -

    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 ntpdc 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 lockclock -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 ntp_adjtime() system call, this can be done automatically -if the external synchronization protocol uses it to discipline the kernel -time. -

    -Mitigation Rules

    -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. - -

    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. - -

    The mitigation rules establish the choice of system peer, 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. -

      -
    1. -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 disable pll 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.
    2. - -
    3. -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.
    4. - -
    5. -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.
    6. - -
    7. -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.
    8. - -
    9. -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.
    10. -
    - -

    -Using the Pulse-per-Second (PPS) Signal

    -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 -<cr>, 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 Pulse-per-second (PPS) Signal Interfacing -page. The following paragraphs discuss how the PPS signal is affected by -the mitigation rules. - -

    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 prefer -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. - -

    The PPS signal can be used in two ways to discipline the local clock, -one using a special PPS driver described in the PPS -Clock Discipline page, the other using PPS signal support in the kernel, -as described in the A Kernel Model for Precision Timekeeping -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. - -

    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. - -

    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. - -

    In order to operate, the kernel support must be enabled by the enable -pll 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.  -


    -
    -David L. Mills (mills@udel.edu)
    - - - diff --git a/dist/ntp/html/qth.htm b/dist/ntp/html/qth.htm deleted file mode 100644 index af3e3b6c691a..000000000000 --- a/dist/ntp/html/qth.htm +++ /dev/null @@ -1,64 +0,0 @@ - -Stations, Frequencies and Geographic Coordinates -

    -Stations, Frequencies and Geographic Coordinates -


    - -The following data were obtained from the International Frequency List -published by the ITU and other sources. - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    StationFrequenciesCoordinates
    WWV Ft. Collins, CO2.5/5/10/15/20 MHz40:40:49.0N 105:02:27.0W
    WWVB Ft. Collins, CO60 kHz40:40:28.3N 105:02:39.5W
    WWVH Kauai, HI2.5/5/10/15 MHz21:59:26.0N 159:46:00.0W
    CHU Ottawa, CA3330/7335/14670 kHz45:18N 75:45N
    DCF77 Mainflingen, DE77.5 kHz50:01N 9:00E
    MSF Rugby, UK60 kHz52:22N 1:11W
    TDF Allouis, FR162 kHz47:10N 2:12E
    - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/quick.htm b/dist/ntp/html/quick.htm deleted file mode 100644 index dc16a38ff67d..000000000000 --- a/dist/ntp/html/quick.htm +++ /dev/null @@ -1,86 +0,0 @@ - -Quick Start -

    -Quick Start -

    - -

    Introduction

    - -

    This page describes what to expect when the NTP daemon ntpd -is started for the first time. The discussion presumes the programs in -this distribution have been compiled and installed as described in the -Building and Installing the Distribution page. - -

    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 ntp.drift 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. - -

    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 -x option is included -on the command line that starts the daemon, the clock will never be -stepped and only slew corrections will be used. - -

    The issues should be carefully explored before deciding to use the --x 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. - -

    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 -x 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. - -

    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 ntp.drift 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 -(time.ien.it 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. - -


    Home
    David L. Mills <mills@udel.edu> -
    - diff --git a/dist/ntp/html/rdebug.htm b/dist/ntp/html/rdebug.htm deleted file mode 100644 index 472b09f67e86..000000000000 --- a/dist/ntp/html/rdebug.htm +++ /dev/null @@ -1,67 +0,0 @@ - - -Debugging Hints for Reference Clock Drivers -

    -Debugging Hints for Reference Clock Drivers -


    - -

    The ntpq and ntpdc 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 ntpd 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. - -

    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. - -

    If RS232 messages are getting to and from the clock, the variables of -interest can be inspected using the ntpq program and -various commands described on the documentation page. First, use the -pe and as 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 pe billboard and the association ID for it at -the same relative line position in the as billboard. If -things are operating correctly, after a minute or two samples should -show up in the pe display line for the clock. - -

    Additional information is available with the rv and -clockvar commands, which take as argument the association -ID shown in the as billboard. The rv command -with no argument shows the system variables, while the rv -command with association ID argument shows the peer variables for the -clock, as well as any other peers of interest. The clockvar -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 fudge parameters is included. - -

    The ntpdc utility program can be used for detailed -inspection of the clock driver status. The most useful are the -clockstat and clkbug 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. - -

    Most drivers write a message to the clockstats 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 -filegen facility described in the ntpd 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 ./scripts/stats -directory can be run from a cron 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. -


    David L. Mills (mills@udel.edu)
    diff --git a/dist/ntp/html/refclock.htm b/dist/ntp/html/refclock.htm deleted file mode 100644 index 43b1e6d05511..000000000000 --- a/dist/ntp/html/refclock.htm +++ /dev/null @@ -1,142 +0,0 @@ - -Reference Clock Drivers -

    -Reference Clock Drivers -

    - -Support for most of the commonly available radio and modem reference -clocks is included in the default configuration of the NTP daemon for -Unix ntpd. Individual clocks can be activated by configuration -file commands, specifically the server and fudge -commands described in the ntpd program manual -page. The following discussion presents Information on how to select -and configure the device drivers in a running Unix system. - -

    Radio and modem clocks by convention have addresses in the form -127.127.t.u, where t is the clock type and u 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 -/dev/deviceu to the particular hardware device involved, -where u correspond to the unit number above. - -

    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. - -

    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 Audio Drivers page. - -

    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 Stations, Frequencies and Geographic Coordinates page. -Receiver coordinates can be obtained or estimated from various sources. -The actual calculations are beyond the scope of this document. - -

    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 Copyright -Notice page. - -

    Type 1 Undisciplined Local Clock -(LOCAL) -
    Type 2 Trak 8820 GPS Receiver -(GPS_TRAK) -
    Type 3 PSTI/Traconex 1020 WWV/WWVH -Receiver -(WWV_PST) -
    Type 4 Spectracom WWVB and GPS Receivers -(WWVB_SPEC) -
    Type 5 TrueTime GPS/GOES/OMEGA Receivers -(TRUETIME) -
    Type 6 IRIG Audio Decoder -(IRIG_AUDIO) -
    Type 7 Radio CHU Audio Demodulator/Decoder -(CHU) -
    Type 8 Generic Reference Driver -(PARSE) -
    Type 9 Magnavox MX4200 GPS Receiver -(GPS_MX4200) -
    Type 10 Austron 2200A/2201A GPS Receivers -(GPS_AS2201) -
    Type 11 Arbiter 1088A/B GPS Receiver -(GPS_ARBITER) -
    Type 12 KSI/Odetics TPRO/S IRIG Interface -(IRIG_TPRO) -
    Type 13 Leitch CSD 5300 Master Clock Controller -(ATOM_LEITCH) -
    Type 14 EES M201 MSF Receiver (MSF_EES) -
    Type 15 * TrueTime generic receivers -
    Type 16 Bancomm GPS/IRIG Receiver (GPS_BANCOMM) -
    Type 17 Datum Precision Time System (GPS_DATUM) -
    Type 18 NIST Modem Time Service -(ACTS_NIST) -
    Type 19 Heath WWV/WWVH Receiver -(WWV_HEATH) -
    Type 20 Generic NMEA GPS Receiver -(NMEA) -
    Type 21 TrueTime GPS-VME Interface (GPS_VME) -
    Type 22 PPS Clock Discipline -(PPS) -
    Type 23 PTB Modem Time Service -(ACTS_PTB) -
    Type 24 USNO Modem Time Service -(ACTS_USNO) -
    Type 25 * TrueTime generic receivers -
    Type 26 Hewlett Packard 58503A GPS -Receiver (GPS_HP) -
    Type 27 Arcron MSF Receiver -(MSF_ARCRON) -
    Type 28 Shared Memory Driver -(SHM) -
    Type 29 Trimble Navigation Palisade GPS -(GPS_PALISADE) -
    Type 30 Motorola UT Oncore GPS -(GPS_ONCORE) -
    Type 31 Rockwell Jupiter GPS (GPS_JUPITER) -
    Type 34 Ultralink WWVB Receivers -
    Type 35 Conrad Parallel Port Radio Clock -(PCF) -
    Type 36 Radio WWV/H Audio -Demodulator/Decoder(WWV) -
    Type 37 Forum Graphic GPS Dating station -(FG) - -

    * 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. -

    Additional Information -

    Mitigation Rules and the prefer -Keyword -
    Debugging Hints for Reference Clock Drivers -
    Line Disciplines and Streams Drivers -
    Reference Clock Audio Drivers -
    Pulse-per-second (PPS) Signal Interfacing -
    How To Write a Reference Clock Driver -
    The Network Time Protocol (NTP) -Distribution   - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/release.htm b/dist/ntp/html/release.htm deleted file mode 100644 index 84fc4af690ed..000000000000 --- a/dist/ntp/html/release.htm +++ /dev/null @@ -1,200 +0,0 @@ - -NTP Version 4 Release Notes -

    -NTP Version 4 Release Notes -

    - -

    NTP Version 4 Release Notes

    - -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. - -

    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 - -

      - -

    1. 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.
    2. - -

    3. 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.
    4. - -

    5. A burst-mode 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. However, the interval between the first and subsequent messages -is about 20 s in order for a dialup modem to complete the call. Outlyers -due to initial dial-up delays, etc., are avoided and the server -synchronizes with its peer generally within 30 s.
    6. - -

    7. In addition to the NTPv3 authentication scheme, which uses -private-key cryptography, a new NTPv4 autokey -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.
    8. - -

    9. 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 multicast - 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 manycast 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 -somewhat better accuracy than the multicast scheme at the price of -additional network overhead.
    10. - -

    11. 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 37 -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 -/dev/audio.
    12. - -

    13. 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.
    14. - -

    15. 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.
    16. - -

    17. The entire distribution has been converted to gnu -automake, 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.
    18. -
    - -

    Nasty Surprises

    - -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: - -
      - -

    1. 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 distribution. These routines are readily -available in most countries from RSA Laboratories. Directions for their -use are in the Building and Installing the -Distribution page.
    2. - -

    3. As the result of the above, the ./authstuff 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 -rsaref2.0 package available from RSA laboratories.
    4. - -

    5. The enable and disable commands have a few changes in their -arguments see the ntpd Configuration -Options page for details.
    6. - -

    7. The scheme for enabling the ppsclock line -discipline/streams module has changed. Formerly, it was enabled by -setting ffudge flag3 for the serial port connected to the PPS -signal. Now, there is an explicit command pps used to designate -the device name. See the Reference Clock -Options page for details.
    8. - -

    9. While in fact not a new problem, some obscure option combinations -require the server and peer commands to follow the -others; in particular, the enable and pps commands -should precede these commands.
    10. - -
    - -

    Caveats

    - -This release has been compiled and tested on several systems, including -SunOS 4.1.3, Solaris 2.5.1 and 2.7, Alpha 4.0, Ultrix 4.4, Linux, -FreeBSD 3.4 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: - -
      - -

    1. The latest NTPv4 ntpdc does not work with previous versions of ntpd and previous versions of ntpdc do not work with latest ntpd. 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. - -

    2. To work properly in all cases, the enable and -pps commands, if used, should appear before the server -and fudge commands in the configuration file.
    3. - -

    4. The precision time kernel modifications formerly in stock Solaris -2.6 have 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 enable kernel -command either in the configuration file or via ntpdc.
    5. - -

    6. On Alpha 4.0 with reference clocks configured, debugging with the --d options doesn't work.
    7. - -

    8. The autokey function uses NTP header extensions fields, -which is documented in an Internet Draft and implemented in this -release. At present the keys and related cryptographic data are stored -in the form of files generated by the ntp_genkeys program. It is expected that in future -these values will be obtained automatically from the Secure DNS -following deployment.
    9. - -

    10. 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.
    11. - -

    12. 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.
    13. - -
    - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/tickadj.htm b/dist/ntp/html/tickadj.htm deleted file mode 100644 index 7891f0ff8c55..000000000000 --- a/dist/ntp/html/tickadj.htm +++ /dev/null @@ -1,90 +0,0 @@ - -<TT>tickadj</TT> - set time-related kernel variables -

    -tickadj - set time-related kernel variables -


    - -

    Synopsis

    - -tickadj [ -Aqs ] [ -a tickadj ] [ -t tick ] - -

    Description

    - -The tickadj program reads, and optionally modifies, several -timekeeping-related variables in the running kernel in some machines, -via /dev/kmem. The particular variables it is concerned with -are tick, which is the number of microseconds added to the -system time during a clock interrupt, tickadj, which sets the -slew rate and resolution used by the adjtime system call, and -dosynctodr, 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. - -

    Note that this program does NOT work in some kernels, in particular -Solaris 2.6 or later. See the -report. - -

    By default, with no arguments, tickadj 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 tickadj -variable if the intent is to run the ntpd Network Time Protocol -(NTP) daemon, and prints this as well. Since the operation of -tickadj when reading the kernel mimics the operation of similar -parts of the ntpd program fairly closely, this can be useful -when debugging problems with ntpd. - -

    Note that tickadj should be run with some caution when being -used for the first time on different types of machines. The operations -which tickadj tries to perform are not guaranteed to work on -all -Unix machines and may in rare cases cause the kernel to crash. -

    -Command Line Options

    - -
    - -
    -a tickadj
    -
    Set the kernel variable tickadj to the value -tickadjspecified.
    - -
    -A
    -
    Set the kernel variable tickadj to an internally computed -"optimal" value.
    - -
    -t tick
    -
    Set the kernel variable tick to the value -tick specified.
    - -
    -s
    -
    Set the kernel variable dosynctodr to zero, which disables -the hardware time-of-year clock, a prerequisite for running the -ntpd daemon under SunOS4.
    - -
    -q
    -
    Normally, tickadj is quite verbose about what it is doing. -The -q flag tells it to shut up about everything except -errors.
    - -
    - -

    Files

    - -
    -/vmunix
    -
    -/unix
    -
    -/dev/kmem
    - -

    Bugs

    - -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 adjtime 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 tickadj -program went away.  - -
    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/html/vxworks.htm b/dist/ntp/html/vxworks.htm deleted file mode 100644 index b6fae8069924..000000000000 --- a/dist/ntp/html/vxworks.htm +++ /dev/null @@ -1,153 +0,0 @@ - - - vxWorks Port of NTP - - - -

    VxWorks port of NTP

    - -

    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.

    - -

    Configuration issues

    - -

    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.

    - -

    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.

    - -

    WARNING: Check you are not overwriting files, before entering -the following: there should be no conflict, but check first...

    - -

    export CC="cc386 -nostdlib -m486 -DCPU=I80486 -I/usr/wind/target/h" -
    -export RANLIB=ranlib386
    -export AR=ar386
    -export VX_KERNEL=/usr/wind/target/config/ims_std_bsp/vxWorks
    -cd /usr/wind/target/sys
    -ln -s ../signal.h
    -ln -s ../time.h
    -ln -s socket.h sockio.h
    -ln -s ../selectLib.h select.h
    -ln -s ../timers.h
    -touch file.h param.h resource.h utsname.h var.h ../netdb.h ../a.out.h ../termios.h -
    -echo " ******ADD #include \"sys/times.h\" to sys/time.h -"

    - -

    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:
    -sed -e 's%main.*()%vxmain()%' configure > configure.vxnew
    -mv configure.vxnew configure
    -chmod 755 configure

    -

    The new version 4 of NTP requires some maths functions so it links in the -maths library (-lm) in the ntpd Makefile.am -change the line "ntpd_LDADD = $(LDADD) -lm" by removing the "-lm".
    -You are now ready to compile

    - - -


    -The configure.in file needed to be altered -to allow for a host-target configuration to take place.

    - -
      -
    • The define SYS_VXWORKS was added to the compilation flags.
    • - -
    • Little endianess is set if the target is of type iX86.
    • - -
    • The size of char, integer, long values are all set. If Wind River ever -changes these values they will need to be updated.
    • - -
    • clock_settime() is defined to be used for setting the clock.
    • - -
    • The Linking flags have -r added to allow for relinking into the vxWorks -kernel
    • -
    - -

    Unfortunately I have had to make use of the ntp_machine.h -file to add in the checks that would have been checked at linking stage -by autoconf, a better method should be devised.

    - -
      -
    • There is now a NO_MAIN_ALLOWED define that simulates command line args, -this allows the use of the normal startup sysntax.
    • - -
    • POSIX timers have been added.
    • - -
    • Structures normally found in netdb.h have been added with, the corresponding -code is in machines.c . Where possible -the defines for these have been kept non-vxWorks specific.
    • -
    - -

    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 ntp_machine.h -file clearly marks how to do this.

    - -

    Compilation issues

    - -

    You will need autoconf and automake ... available free from the gnu -archives worldwide.

    - -

    The variable arch is the target architecture (e.g. i486)

    - -

    mkdir A.vxworks (or whatever....)
    -cd A.vxworks
    -../configure --target=arch-wrs-vxworks [any other options]
    -make

    - -

    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.

    - -

    Running the software

    - -

    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.

    - -

    ld < ntpdate/ntpdate
    -ld < ntpd/ntpd
    -ld < ntptrace/ntptrace
    -ld < ntpq/ntpq
    -ld < ntpdc/ntpdc
    -ntpdate ("-b", "192.168.0.245")
    -sp(ntpd, "-c", "/export/home/casey/ntp/ntp.conf") -
    -ntpdc("-c", "monlist", "192.168.0.244") -
    -ntpq("-c", "peers", "192.168.0.244")
    -ntptrace("192.168.0.244")
    -

    - -

    Bugs and such

    - -

    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. -CCII Systems -(Pty) Ltd, 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.

    - -


    -

    - -

    Casey Crellin
    -casey@csc.co.za

    - -


    -

    - - - diff --git a/dist/ntp/html/y2k.htm b/dist/ntp/html/y2k.htm deleted file mode 100644 index 703a439fa9c8..000000000000 --- a/dist/ntp/html/y2k.htm +++ /dev/null @@ -1,132 +0,0 @@ - -Network Time Protocol Year 2000 Conformance Statement -

    -Network Time Protocol Year 2000 Conformance Statement -

    - -

    Introduction

    - -By the year 2000, the Network Time Protocol (NTP) will have been in -use for over two decades and remain the longest running, continuously -operating application protocol in the Internet. There is some concern, -especially in government and financial institutions, that NTP might -cause Internet applications to misbehave in terrible ways on the epoch -of the next century. This document presents an analysis of the various -hazards that might result in incorrect time values upon this epoch. It -concludes that incorrect time values due to the NTP timescale, protocol -design and reference implementation are highly unlikely. However, it is -possible that external reference time sources used by NTP could -misbehave and cause NTP servers to distribute incorrect time values to -significant portions of the Internet. Note that, while this document -addresses the issues specifically with respect to Unix systems, the -issues are equally applicable to Windows and VMS systems. - -

    The NTP Timescale

    - -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 Universal -Coordinated 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. 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. - -

    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 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 -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. 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. - -

    The Year 2000 Era

    - -With respect to the 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 latest era, the -current one of 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 -year 1999, the NTP timescale will show 3,155,672,599 and one second -later on the first second of the next century will show 3,155,672,600. -Other than this observation, the NTP timescale has no knowledge of or -provision for any of these eclectic seconds. - -

    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 its representation and Unix representation. Unix -kernels implement the time of day function using two 32-bit counters, -one representing the seconds since Unix life began and the other the -microseconds or nanoseconds of the second. In principle, the seconds -counter will wrap around in 136-year eras, the next of which will begin -in 2106. How the particular Unix semantics interprets the counter values -is of concern, but is beyond the scope of discussion here. - -

    While incorrect time values due to the NTP timescale and protocol -design or reference implementation upon the epoch of the next century -are highly unlikely, hazards remain due to incorrect software external -to NTP. These hazards include the Unix kernel and library routines which -convert Unix time 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. - -

    While it is extremely unlikely that NTP will produce incorrect time -values upon the epoch, 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. - -

    The NTP protocol specification requires the apparent NTP time derived -from external servers to be compared to the file 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 -incorrect time values. In the case of embedded computers with no file -system, the design assumption is that the current era be established -from flash memory or a clock chip previously set by manual means. - -

    It is essential that any clock synchronization protocol, including -NTP, include provisions for multiple-server redundancy and multiple- -route diversity. Past experience has demonstrated the wisdom of this -approach, which protects clients against hardware and software faults, -as well as incorrectly operating reference sources and sometimes even -buggy software. For the most reliable service, we recommend multiple -reference sources for primary servers, including a backup radio or -satellite receiver or telephone modem. We also recommend that primary -servers run NTP with other primary servers to provide additional -redundancy and mutual backup should the reference sources themselves -fail or operate incorrectly. - -


    Home
    David L. Mills <mills@udel.edu> -
    diff --git a/dist/ntp/include/adjtime.h b/dist/ntp/include/adjtime.h index 87fcc6f0d06d..ef13434270b4 100644 --- a/dist/ntp/include/adjtime.h +++ b/dist/ntp/include/adjtime.h @@ -1,4 +1,4 @@ -/* $NetBSD: adjtime.h,v 1.1.1.2 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: adjtime.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /*************************************************************************/ /* (c) Copyright Tai Jin, 1988. All Rights Reserved. */ diff --git a/dist/ntp/include/ascii.h b/dist/ntp/include/ascii.h index da12e4c38a4d..ea3ef7007085 100644 --- a/dist/ntp/include/ascii.h +++ b/dist/ntp/include/ascii.h @@ -1,4 +1,4 @@ -/* $NetBSD: ascii.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ascii.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/ascii.h,v 4.1 1998/07/11 10:05:22 kardel RELEASE_19990228_A diff --git a/dist/ntp/include/audio.h b/dist/ntp/include/audio.h index 4afe7e3c4ad8..98e910090a68 100644 --- a/dist/ntp/include/audio.h +++ b/dist/ntp/include/audio.h @@ -1,4 +1,4 @@ -/* $NetBSD: audio.h,v 1.1.1.2 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: audio.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Header file for audio drivers diff --git a/dist/ntp/include/binio.h b/dist/ntp/include/binio.h index 024499a3d1eb..180de0fd3af4 100644 --- a/dist/ntp/include/binio.h +++ b/dist/ntp/include/binio.h @@ -1,4 +1,4 @@ -/* $NetBSD: binio.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: binio.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/binio.h,v 4.2 1998/06/28 16:52:15 kardel RELEASE_19990228_A diff --git a/dist/ntp/include/global.h b/dist/ntp/include/global.h index 71ac2dc55f46..39535fe3b2a3 100644 --- a/dist/ntp/include/global.h +++ b/dist/ntp/include/global.h @@ -1,4 +1,4 @@ -/* $NetBSD: global.h,v 1.1.1.2 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: global.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* GLOBAL.H - RSAREF types and constants */ diff --git a/dist/ntp/include/gps.h b/dist/ntp/include/gps.h index 847f6907a9f4..5e2911675cfb 100644 --- a/dist/ntp/include/gps.h +++ b/dist/ntp/include/gps.h @@ -1,4 +1,4 @@ -/* $NetBSD: gps.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: gps.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /****************************************************************************/ /* gps.h */ diff --git a/dist/ntp/include/hopf6039.h b/dist/ntp/include/hopf6039.h index 47cc460c73b2..485183907c99 100644 --- a/dist/ntp/include/hopf6039.h +++ b/dist/ntp/include/hopf6039.h @@ -1,4 +1,4 @@ -/* $NetBSD: hopf6039.h,v 1.1.1.1 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: hopf6039.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /****************************************************************************/ /* hopf6039.h */ diff --git a/dist/ntp/include/icom.h b/dist/ntp/include/icom.h index 558681768219..889f3d1ed364 100644 --- a/dist/ntp/include/icom.h +++ b/dist/ntp/include/icom.h @@ -1,4 +1,4 @@ -/* $NetBSD: icom.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: icom.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Header file for ICOM radios diff --git a/dist/ntp/include/ieee754io.h b/dist/ntp/include/ieee754io.h index 7a2cdef11a36..90816ab40ff3 100644 --- a/dist/ntp/include/ieee754io.h +++ b/dist/ntp/include/ieee754io.h @@ -1,4 +1,4 @@ -/* $NetBSD: ieee754io.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ieee754io.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/ieee754io.h,v 4.0 1998/04/10 19:50:40 kardel RELEASE_19990228_A diff --git a/dist/ntp/include/iosignal.h b/dist/ntp/include/iosignal.h index dd8e52bac337..ffbe64d8dc6b 100644 --- a/dist/ntp/include/iosignal.h +++ b/dist/ntp/include/iosignal.h @@ -1,4 +1,4 @@ -/* $NetBSD: iosignal.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: iosignal.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #if !defined _ntp_iosignaled_h #define _ntp_iosignaled_h diff --git a/dist/ntp/include/isc/app.h b/dist/ntp/include/isc/app.h index 7b674bc01672..96f8fb1f5e0e 100644 --- a/dist/ntp/include/isc/app.h +++ b/dist/ntp/include/isc/app.h @@ -1,4 +1,4 @@ -/* $NetBSD: app.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: app.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/assertions.h b/dist/ntp/include/isc/assertions.h index ad1626932912..5a2b6ce89b84 100644 --- a/dist/ntp/include/isc/assertions.h +++ b/dist/ntp/include/isc/assertions.h @@ -1,4 +1,4 @@ -/* $NetBSD: assertions.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: assertions.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1997-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/boolean.h b/dist/ntp/include/isc/boolean.h index 3d285d7775c6..d8881fba10d5 100644 --- a/dist/ntp/include/isc/boolean.h +++ b/dist/ntp/include/isc/boolean.h @@ -1,4 +1,4 @@ -/* $NetBSD: boolean.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: boolean.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/error.h b/dist/ntp/include/isc/error.h index 25719340035b..cc1a5fc7aba0 100644 --- a/dist/ntp/include/isc/error.h +++ b/dist/ntp/include/isc/error.h @@ -1,4 +1,4 @@ -/* $NetBSD: error.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: error.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/formatcheck.h b/dist/ntp/include/isc/formatcheck.h index cff29ad1b37d..037bd90decca 100644 --- a/dist/ntp/include/isc/formatcheck.h +++ b/dist/ntp/include/isc/formatcheck.h @@ -1,4 +1,4 @@ -/* $NetBSD: formatcheck.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: formatcheck.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2000, 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/int.h b/dist/ntp/include/isc/int.h index 466ea5f6d638..4b8238c04265 100644 --- a/dist/ntp/include/isc/int.h +++ b/dist/ntp/include/isc/int.h @@ -1,4 +1,4 @@ -/* $NetBSD: int.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: int.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/interfaceiter.h b/dist/ntp/include/isc/interfaceiter.h index 894c1bb43582..9d57768837f4 100644 --- a/dist/ntp/include/isc/interfaceiter.h +++ b/dist/ntp/include/isc/interfaceiter.h @@ -1,4 +1,4 @@ -/* $NetBSD: interfaceiter.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: interfaceiter.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/ipv6.h b/dist/ntp/include/isc/ipv6.h index 25dcc4176cfc..8879d5558b6f 100644 --- a/dist/ntp/include/isc/ipv6.h +++ b/dist/ntp/include/isc/ipv6.h @@ -1,4 +1,4 @@ -/* $NetBSD: ipv6.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ipv6.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/lang.h b/dist/ntp/include/isc/lang.h index 4c86038a8ccc..1e178236764d 100644 --- a/dist/ntp/include/isc/lang.h +++ b/dist/ntp/include/isc/lang.h @@ -1,4 +1,4 @@ -/* $NetBSD: lang.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: lang.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/lib.h b/dist/ntp/include/isc/lib.h index 39eb2b67eb6a..28252f257db7 100644 --- a/dist/ntp/include/isc/lib.h +++ b/dist/ntp/include/isc/lib.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: lib.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/list.h b/dist/ntp/include/isc/list.h index ccb070f813ac..8dc0f8b29ed0 100644 --- a/dist/ntp/include/isc/list.h +++ b/dist/ntp/include/isc/list.h @@ -1,4 +1,4 @@ -/* $NetBSD: list.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: list.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1997-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/magic.h b/dist/ntp/include/isc/magic.h index 53d7551fe883..246f94fc8ab5 100644 --- a/dist/ntp/include/isc/magic.h +++ b/dist/ntp/include/isc/magic.h @@ -1,4 +1,4 @@ -/* $NetBSD: magic.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: magic.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/mem.h b/dist/ntp/include/isc/mem.h index 5e33fa3ba1f6..03719dd7f084 100644 --- a/dist/ntp/include/isc/mem.h +++ b/dist/ntp/include/isc/mem.h @@ -1,4 +1,4 @@ -/* $NetBSD: mem.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: mem.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1997-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/msgcat.h b/dist/ntp/include/isc/msgcat.h index f414da97e565..085ea2e51640 100644 --- a/dist/ntp/include/isc/msgcat.h +++ b/dist/ntp/include/isc/msgcat.h @@ -1,4 +1,4 @@ -/* $NetBSD: msgcat.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: msgcat.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/msgs.h b/dist/ntp/include/isc/msgs.h index 8afdac30c130..9049479b577d 100644 --- a/dist/ntp/include/isc/msgs.h +++ b/dist/ntp/include/isc/msgs.h @@ -1,4 +1,4 @@ -/* $NetBSD: msgs.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: msgs.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2000, 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/mutex.h b/dist/ntp/include/isc/mutex.h index 569c946587c8..5264e37cd71b 100644 --- a/dist/ntp/include/isc/mutex.h +++ b/dist/ntp/include/isc/mutex.h @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: mutex.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2000, 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/net.h b/dist/ntp/include/isc/net.h index b2b9369696a5..4e043b203674 100644 --- a/dist/ntp/include/isc/net.h +++ b/dist/ntp/include/isc/net.h @@ -1,4 +1,4 @@ -/* $NetBSD: net.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: net.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/netaddr.h b/dist/ntp/include/isc/netaddr.h index feb7e698095c..c15b385f8fb2 100644 --- a/dist/ntp/include/isc/netaddr.h +++ b/dist/ntp/include/isc/netaddr.h @@ -1,4 +1,4 @@ -/* $NetBSD: netaddr.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: netaddr.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2002 Internet Software Consortium. diff --git a/dist/ntp/include/isc/offset.h b/dist/ntp/include/isc/offset.h index c2798da60d1c..fc4828b3c27e 100644 --- a/dist/ntp/include/isc/offset.h +++ b/dist/ntp/include/isc/offset.h @@ -1,4 +1,4 @@ -/* $NetBSD: offset.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: offset.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2000, 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/once.h b/dist/ntp/include/isc/once.h index 6cbdd315c3c4..e4bbd9b499e7 100644 --- a/dist/ntp/include/isc/once.h +++ b/dist/ntp/include/isc/once.h @@ -1,4 +1,4 @@ -/* $NetBSD: once.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: once.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2000, 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/platform.h b/dist/ntp/include/isc/platform.h index 61a3e44b6c6f..1a515497e540 100644 --- a/dist/ntp/include/isc/platform.h +++ b/dist/ntp/include/isc/platform.h @@ -1,4 +1,4 @@ -/* $NetBSD: platform.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: platform.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/print.h b/dist/ntp/include/isc/print.h index 33b9262bc316..6fea86c907d8 100644 --- a/dist/ntp/include/isc/print.h +++ b/dist/ntp/include/isc/print.h @@ -1,4 +1,4 @@ -/* $NetBSD: print.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: print.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/result.h b/dist/ntp/include/isc/result.h index d6950ccd882b..6cb0e696bc97 100644 --- a/dist/ntp/include/isc/result.h +++ b/dist/ntp/include/isc/result.h @@ -1,4 +1,4 @@ -/* $NetBSD: result.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: result.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/sockaddr.h b/dist/ntp/include/isc/sockaddr.h index b01350922351..9856eb14c636 100644 --- a/dist/ntp/include/isc/sockaddr.h +++ b/dist/ntp/include/isc/sockaddr.h @@ -1,4 +1,4 @@ -/* $NetBSD: sockaddr.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: sockaddr.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2002 Internet Software Consortium. diff --git a/dist/ntp/include/isc/strerror.h b/dist/ntp/include/isc/strerror.h index 485f146280f2..3a54fc8718c3 100644 --- a/dist/ntp/include/isc/strerror.h +++ b/dist/ntp/include/isc/strerror.h @@ -1,4 +1,4 @@ -/* $NetBSD: strerror.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: strerror.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/string.h b/dist/ntp/include/isc/string.h index 3699b62013fb..31b86173e2d1 100644 --- a/dist/ntp/include/isc/string.h +++ b/dist/ntp/include/isc/string.h @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: string.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2000, 2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/types.h b/dist/ntp/include/isc/types.h index 250f002a5885..ad7f6b389c2c 100644 --- a/dist/ntp/include/isc/types.h +++ b/dist/ntp/include/isc/types.h @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: types.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/include/isc/util.h b/dist/ntp/include/isc/util.h index 09198ea616fd..d520eb0a1f66 100644 --- a/dist/ntp/include/isc/util.h +++ b/dist/ntp/include/isc/util.h @@ -1,4 +1,4 @@ -/* $NetBSD: util.h,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: util.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2001 Internet Software Consortium. diff --git a/dist/ntp/include/l_stdlib.h b/dist/ntp/include/l_stdlib.h index 1d904bbcd170..9d2f24c2d83f 100644 --- a/dist/ntp/include/l_stdlib.h +++ b/dist/ntp/include/l_stdlib.h @@ -1,4 +1,4 @@ -/* $NetBSD: l_stdlib.h,v 1.1.1.2 2003/12/04 16:05:21 drochner Exp $ */ +/* $NetBSD: l_stdlib.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Proto types for machines that are not ANSI and POSIX compliant. diff --git a/dist/ntp/include/mbg_gps166.h b/dist/ntp/include/mbg_gps166.h index 6fab6deae390..2bf852ff6dff 100644 --- a/dist/ntp/include/mbg_gps166.h +++ b/dist/ntp/include/mbg_gps166.h @@ -1,4 +1,4 @@ -/* $NetBSD: mbg_gps166.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: mbg_gps166.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/mbg_gps166.h,v 4.1 1998/06/12 15:07:30 kardel RELEASE_19990228_A diff --git a/dist/ntp/include/md5.h b/dist/ntp/include/md5.h deleted file mode 100644 index a15c220c4deb..000000000000 --- a/dist/ntp/include/md5.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: md5.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ - -/* MD5.H - header file for MD5C.C - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -#ifndef _MD5_H_ -#define _MD5_H_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/*#include "global.h" */ - -/* MD5 context. */ -typedef struct { - UINT4 state[4]; /* state (ABCD) */ - UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; - -void MD5Init PROTO_LIST ((MD5_CTX *)); -void MD5Update PROTO_LIST - ((MD5_CTX *, unsigned char *, unsigned int)); -void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/dist/ntp/include/mx4200.h b/dist/ntp/include/mx4200.h index 2910e82efcee..34f5575034a5 100644 --- a/dist/ntp/include/mx4200.h +++ b/dist/ntp/include/mx4200.h @@ -1,4 +1,4 @@ -/* $NetBSD: mx4200.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: mx4200.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* records transmitted from extern CDU to MX 4200 */ diff --git a/dist/ntp/include/ntif.h b/dist/ntp/include/ntif.h index 6e35141ee877..045f7a26746a 100644 --- a/dist/ntp/include/ntif.h +++ b/dist/ntp/include/ntif.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntif.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntif.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* this is a hacked version of if.h from unix to contain the stuff we need only to build named (bind) with the minimal amount of changes... by l. kahn */ diff --git a/dist/ntp/include/ntp.h b/dist/ntp/include/ntp.h index e0dd08e0de97..a93a17020370 100644 --- a/dist/ntp/include/ntp.h +++ b/dist/ntp/include/ntp.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp.h,v 1.1.1.3 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp.h - NTP definitions for the masses diff --git a/dist/ntp/include/ntp_calendar.h b/dist/ntp/include/ntp_calendar.h index d5afab2ad275..6583718a2cf7 100644 --- a/dist/ntp/include/ntp_calendar.h +++ b/dist/ntp/include/ntp_calendar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_calendar.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntp_calendar.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_calendar.h - definitions for the calendar time-of-day routine diff --git a/dist/ntp/include/ntp_cmdargs.h b/dist/ntp/include/ntp_cmdargs.h index fd0f23011cfe..92a1bb9a143d 100644 --- a/dist/ntp/include/ntp_cmdargs.h +++ b/dist/ntp/include/ntp_cmdargs.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_cmdargs.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_cmdargs.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #include "ntp_types.h" diff --git a/dist/ntp/include/ntp_config.h b/dist/ntp/include/ntp_config.h index 31ce4294f07a..925dd11b11da 100644 --- a/dist/ntp/include/ntp_config.h +++ b/dist/ntp/include/ntp_config.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_config.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_config.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Configuration file name diff --git a/dist/ntp/include/ntp_control.h b/dist/ntp/include/ntp_control.h index 742ab47dcac3..87249759a0df 100644 --- a/dist/ntp/include/ntp_control.h +++ b/dist/ntp/include/ntp_control.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_control.h,v 1.1.1.3 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_control.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_control.h - definitions related to NTP mode 6 control messages diff --git a/dist/ntp/include/ntp_crypto.h b/dist/ntp/include/ntp_crypto.h index 9358d82207b0..30c07f475390 100644 --- a/dist/ntp/include/ntp_crypto.h +++ b/dist/ntp/include/ntp_crypto.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_crypto.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_crypto.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_crypto.h - definitions for cryptographic operations diff --git a/dist/ntp/include/ntp_datum.h b/dist/ntp/include/ntp_datum.h index e82ca31772e8..7374336ff359 100644 --- a/dist/ntp/include/ntp_datum.h +++ b/dist/ntp/include/ntp_datum.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_datum.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntp_datum.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ struct btfp_time /* Structure for reading 5 time words */ /* in one ioctl(2) operation. */ diff --git a/dist/ntp/include/ntp_filegen.h b/dist/ntp/include/ntp_filegen.h index 940614e7186d..c32d289bca87 100644 --- a/dist/ntp/include/ntp_filegen.h +++ b/dist/ntp/include/ntp_filegen.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_filegen.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntp_filegen.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_filegen.h,v 3.9 1996/12/01 16:02:45 kardel Exp diff --git a/dist/ntp/include/ntp_fp.h b/dist/ntp/include/ntp_fp.h index 7aa60f30b3f2..d1dd06febda2 100644 --- a/dist/ntp/include/ntp_fp.h +++ b/dist/ntp/include/ntp_fp.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_fp.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_fp.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_fp.h - definitions for NTP fixed/floating-point arithmetic diff --git a/dist/ntp/include/ntp_if.h b/dist/ntp/include/ntp_if.h index 3726b43bed29..25b2f4eb8967 100644 --- a/dist/ntp/include/ntp_if.h +++ b/dist/ntp/include/ntp_if.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_if.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_if.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Sockets are not standard. diff --git a/dist/ntp/include/ntp_io.h b/dist/ntp/include/ntp_io.h index a17d6b44f500..4b2387a77ade 100644 --- a/dist/ntp/include/ntp_io.h +++ b/dist/ntp/include/ntp_io.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_io.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #if !defined _NTP_IO_H #define _NTP_IO_H diff --git a/dist/ntp/include/ntp_machine.h b/dist/ntp/include/ntp_machine.h index 1b77b5036d49..99761f3ef4d9 100644 --- a/dist/ntp/include/ntp_machine.h +++ b/dist/ntp/include/ntp_machine.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_machine.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_machine.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Collect all machine dependent idiosyncrasies in one place. diff --git a/dist/ntp/include/ntp_malloc.h b/dist/ntp/include/ntp_malloc.h index 8b3854090da6..83c39ba0276f 100644 --- a/dist/ntp/include/ntp_malloc.h +++ b/dist/ntp/include/ntp_malloc.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_malloc.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntp_malloc.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Define malloc and friends. diff --git a/dist/ntp/include/ntp_md5.h b/dist/ntp/include/ntp_md5.h index 688aa9feadcb..4acae5226a84 100644 --- a/dist/ntp/include/ntp_md5.h +++ b/dist/ntp/include/ntp_md5.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_md5.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_md5.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_md5.h: deal with md5.h headers diff --git a/dist/ntp/include/ntp_proto.h b/dist/ntp/include/ntp_proto.h index 2e01e42f97cf..900d27de7551 100644 --- a/dist/ntp/include/ntp_proto.h +++ b/dist/ntp/include/ntp_proto.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_proto.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_proto.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #ifndef __ntp_proto_h #define __ntp_proto_h diff --git a/dist/ntp/include/ntp_refclock.h b/dist/ntp/include/ntp_refclock.h index 782acf1f34e2..ded096f0b29c 100644 --- a/dist/ntp/include/ntp_refclock.h +++ b/dist/ntp/include/ntp_refclock.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_refclock.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_refclock.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_refclock.h - definitions for reference clock support diff --git a/dist/ntp/include/ntp_request.h b/dist/ntp/include/ntp_request.h index 1553316a05da..c585b5e44c7b 100644 --- a/dist/ntp/include/ntp_request.h +++ b/dist/ntp/include/ntp_request.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_request.h,v 1.1.1.3 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_request.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_request.h - definitions for the ntpd remote query facility diff --git a/dist/ntp/include/ntp_rfc2553.h b/dist/ntp/include/ntp_rfc2553.h index f38ab3bee965..254596c7b081 100644 --- a/dist/ntp/include/ntp_rfc2553.h +++ b/dist/ntp/include/ntp_rfc2553.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_rfc2553.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_rfc2553.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. diff --git a/dist/ntp/include/ntp_select.h b/dist/ntp/include/ntp_select.h index 7114a29eec2f..1766683cc16c 100644 --- a/dist/ntp/include/ntp_select.h +++ b/dist/ntp/include/ntp_select.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_select.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntp_select.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Not all machines define FD_SET in sys/types.h diff --git a/dist/ntp/include/ntp_sprintf.h b/dist/ntp/include/ntp_sprintf.h index 000955f6a47f..655e27920dcf 100644 --- a/dist/ntp/include/ntp_sprintf.h +++ b/dist/ntp/include/ntp_sprintf.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_sprintf.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_sprintf.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Handle ancient char* *s*printf*() systems diff --git a/dist/ntp/include/ntp_stdlib.h b/dist/ntp/include/ntp_stdlib.h index 9001646ba334..6c7a1e6f5fbe 100644 --- a/dist/ntp/include/ntp_stdlib.h +++ b/dist/ntp/include/ntp_stdlib.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_stdlib.h,v 1.1.1.3 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_stdlib.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_stdlib.h - Prototypes for NTP lib. diff --git a/dist/ntp/include/ntp_string.h b/dist/ntp/include/ntp_string.h index a43cd307a403..ebf4cbc15418 100644 --- a/dist/ntp/include/ntp_string.h +++ b/dist/ntp/include/ntp_string.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_string.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: ntp_string.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Define string ops: strchr strrchr memcmp memmove memset diff --git a/dist/ntp/include/ntp_syscall.h b/dist/ntp/include/ntp_syscall.h index 052d3357574a..1ab525b89fb2 100644 --- a/dist/ntp/include/ntp_syscall.h +++ b/dist/ntp/include/ntp_syscall.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_syscall.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_syscall.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_syscall.h - various ways to perform the ntp_adjtime() and ntp_gettime() diff --git a/dist/ntp/include/ntp_syslog.h b/dist/ntp/include/ntp_syslog.h index 9b97fdae5913..fc2bec39f468 100644 --- a/dist/ntp/include/ntp_syslog.h +++ b/dist/ntp/include/ntp_syslog.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_syslog.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_syslog.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * A hack for platforms which require specially built syslog facilities diff --git a/dist/ntp/include/ntp_tty.h b/dist/ntp/include/ntp_tty.h index 964d4f69e102..358d526a1b91 100644 --- a/dist/ntp/include/ntp_tty.h +++ b/dist/ntp/include/ntp_tty.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_tty.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_tty.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_tty.h - header file for serial lines handling diff --git a/dist/ntp/include/ntp_types.h b/dist/ntp/include/ntp_types.h index 529857234317..2f4b0d8e48de 100644 --- a/dist/ntp/include/ntp_types.h +++ b/dist/ntp/include/ntp_types.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_types.h,v 1.1.1.3 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_types.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_types.h - defines how int32 and u_int32 are treated. diff --git a/dist/ntp/include/ntp_unixtime.h b/dist/ntp/include/ntp_unixtime.h index cc2d1b4b1fbe..f65d13181967 100644 --- a/dist/ntp/include/ntp_unixtime.h +++ b/dist/ntp/include/ntp_unixtime.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_unixtime.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntp_unixtime.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntp_unixtime.h - contains constants and macros for converting between diff --git a/dist/ntp/include/ntpd.h b/dist/ntp/include/ntpd.h index 6a94e646f891..449f28102580 100644 --- a/dist/ntp/include/ntpd.h +++ b/dist/ntp/include/ntpd.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntpd.h,v 1.2 2001/09/16 07:51:54 manu Exp $ */ +/* $NetBSD: ntpd.h,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* * ntpd.h - Prototypes for ntpd. @@ -12,9 +12,6 @@ #include "ntp_refclock.h" #include "recvbuff.h" -#define MAXINTERFACES 512 -#define MAXFILENAME 128 /* maximum length of a file name */ - #ifdef SYS_WINNT #define exit service_exit extern void service_exit (int); @@ -23,19 +20,16 @@ void service_main (DWORD, LPTSTR *); void service_ctrl (DWORD); void worker_thread (void *); #define sleep(x) Sleep((DWORD) x * 1000 /* milliseconds */ ); -#else -#define closesocket close #endif /* SYS_WINNT */ /* ntp_config.c */ -extern void getstartup P((int, char **)); extern void getconfig P((int, char **)); /* ntp_config.c */ extern void ctl_clr_stats P((void)); -extern int ctlclrtrap P((struct sockaddr_in *, struct interface *, int)); +extern int ctlclrtrap P((struct sockaddr_storage *, struct interface *, int)); extern u_short ctlpeerstatus P((struct peer *)); -extern int ctlsettrap P((struct sockaddr_in *, struct interface *, int, int)); +extern int ctlsettrap P((struct sockaddr_storage *, struct interface *, int, int)); extern u_short ctlsysstatus P((void)); extern void init_control P((void)); extern void process_control P((struct recvbuf *, int)); @@ -68,30 +62,30 @@ struct ctl_var { #define WO (CAN_WRITE) #define RW (CAN_READ|CAN_WRITE) -extern char * add_var P((struct ctl_var **, unsigned long, int)); +extern char * add_var P((struct ctl_var **, u_long, u_short)); extern void free_varlist P((struct ctl_var *)); -extern void set_var P((struct ctl_var **, const char *, unsigned long, int)); -extern void set_sys_var P((char *, unsigned long, int)); +extern void set_var P((struct ctl_var **, const char *, u_long, u_short)); +extern void set_sys_var P((char *, u_long, u_short)); /* ntp_intres.c */ -extern void ntp_res_name P((u_int32, u_short)); +extern void ntp_res_name P((struct sockaddr_storage, 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 *findinterface P((struct sockaddr_storage *)); +extern struct interface *findbcastinter P((struct sockaddr_storage *)); extern void init_io P((void)); extern void input_handler P((l_fp *)); extern void io_clr_stats P((void)); extern void io_setbclient P((void)); extern void io_unsetbclient P((void)); -extern void io_multicast_add P((u_int32)); -extern void io_multicast_del P((u_int32)); -extern void kill_asyncio P((void)); +extern void io_multicast_add P((struct sockaddr_storage)); +extern void io_multicast_del P((struct sockaddr_storage)); +extern void kill_asyncio P((int)); -extern void sendpkt P((struct sockaddr_in *, struct interface *, int, struct pkt *, int)); +extern void sendpkt P((struct sockaddr_storage *, struct interface *, int, struct pkt *, int)); #ifdef HAVE_SIGNALED_IO extern void wait_for_signal P((void)); extern void unblock_io_and_alarm P((void)); @@ -115,6 +109,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)); @@ -124,27 +119,46 @@ extern void ntp_monitor P((struct recvbuf *)); /* ntp_peer.c */ 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 *findexistingpeer P((struct sockaddr_storage *, struct peer *, int)); +extern struct peer *findpeer P((struct sockaddr_storage *, struct interface *, int, int, int *)); +extern struct peer *findpeerbyassoc P((u_int)); +extern struct peer *newpeer P((struct sockaddr_storage *, struct interface *, int, int, int, int, u_int, u_char, 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, keyid_t, u_char *)); +extern struct peer *peer_config P((struct sockaddr_storage *, 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 int peer_unconfig P((struct sockaddr_storage *, struct interface *, int)); extern void unpeer P((struct peer *)); extern void clear_all P((void)); +#ifdef OPENSSL extern void expire_all P((void)); -extern struct peer *findmanycastpeer P((l_fp *)); -extern void peer_config_manycast P((struct peer *, struct peer *)); +#endif /* OPENSSL */ +extern struct peer *findmanycastpeer P((struct recvbuf *)); +extern void resetmanycast P((void)); + +/* ntp_crypto.c */ +#ifdef OPENSSL +extern int crypto_recv P((struct peer *, struct recvbuf *)); +extern int crypto_xmit P((struct pkt *, struct sockaddr_storage *, int, struct exten *, keyid_t)); +extern keyid_t session_key P((struct sockaddr_storage *, struct sockaddr_storage *, 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_update P((void)); +extern void crypto_config P((int, char *)); +extern void crypto_setup P((void)); +extern u_int crypto_ident P((struct peer *)); +extern struct exten *crypto_args P((struct peer *, u_int, char *)); +extern int crypto_public P((struct peer *, u_char *, u_int)); +extern void value_free P((struct value *)); +#endif /* OPENSSL */ /* ntp_proto.c */ extern void transmit P((struct peer *)); extern void receive P((struct recvbuf *)); -extern void peer_clear P((struct peer *)); +extern void peer_clear P((struct peer *, char *)); extern void process_packet P((struct peer *, struct pkt *, l_fp *)); extern void clock_select P((void)); +extern void kod_proto P((void)); /* * there seems to be a bug in the IRIX 4 compiler which prevents @@ -157,7 +171,7 @@ extern void poll_update P((struct peer *, int)); extern void clear P((struct peer *)); extern void clock_filter P((struct peer *, double, double, double)); extern void init_proto P((void)); -extern void proto_config P((int, u_long, double)); +extern void proto_config P((int, u_long, double, struct sockaddr_storage*)); extern void proto_clr_stats P((void)); #ifdef REFCLOCK @@ -175,27 +189,30 @@ extern void process_private P((struct recvbuf *, int)); /* ntp_restrict.c */ extern void init_restrict P((void)); -extern int restrictions P((struct sockaddr_in *)); -extern void hack_restrict P((int, struct sockaddr_in *, struct sockaddr_in *, int, int)); +extern int restrictions P((struct sockaddr_storage *)); +extern void hack_restrict P((int, struct sockaddr_storage *, struct sockaddr_storage *, int, int)); /* ntp_timer.c */ extern void init_timer P((void)); +extern void reinit_timer P((void)); extern void timer P((void)); extern void timer_clr_stats P((void)); -#ifdef AUTOKEY +#ifdef OPENSSL extern char *sys_hostname; -extern u_int sys_hostnamelen; extern l_fp sys_revoketime; -#endif /* AUTOKEY */ +#endif /* OPENSSL */ /* 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_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 *)); +extern void record_peer_stats P((struct sockaddr_storage *, int, double, double, double, double)); +extern void record_loop_stats P((double, double, double, double, int)); +extern void record_clock_stats P((struct sockaddr_storage *, const char *)); +extern void record_raw_stats P((struct sockaddr_storage *, struct sockaddr_storage *, l_fp *, l_fp *, l_fp *, l_fp *)); +extern void record_sys_stats P((void)); +extern void record_crypto_stats P((struct sockaddr_storage *, const char *)); +extern int sock_hash P((struct sockaddr_storage *)); /* * Variable declarations for ntpd. @@ -255,8 +272,9 @@ 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 ipv4 interface */ +extern struct interface *any6_interface;/* default ipv6 interface */ +extern struct interface *loopback_interface; /* loopback interface */ /* * File descriptor masks etc. for call to select @@ -265,10 +283,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 @@ -276,21 +300,25 @@ 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_panic; /* allow panic correction */ +extern int mode_ntpdate; /* exit on first clock set */ +extern int peer_ntpdate; /* count of ntpdate peers */ +extern int forground_process; /* run the process in the forground */ /* * 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 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; @@ -328,6 +356,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 */ /* @@ -338,20 +367,27 @@ extern double sys_bdelay; /* broadcast client default delay */ extern int sys_authenticate; /* requre authentication for config */ extern l_fp sys_authdelay; /* authentication delay */ extern keyid_t sys_private; /* private value for session seed */ -extern int sys_manycastserver; /* 1 => respond to manycast client pkts */ +extern int sys_manycastserver; /* respond to manycast client pkts */ +extern int sys_minclock; /* minimum survivors */ +extern int sys_minsane; /* minimum candidates */ +extern int sys_floor; /* cluster stratum floor */ +extern int sys_ceiling; /* cluster stratum ceiling */ +extern u_char sys_ttl[]; /* ttl mapping vector */ +extern int sys_ttlmax; /* max ttl mapping vector index */ /* * Statistics counters */ extern u_long sys_stattime; /* time when we started recording */ -extern u_long sys_badstratum; /* packets with invalid stratum */ -extern u_long sys_oldversionpkt; /* old version packets received */ -extern u_long sys_newversionpkt; /* new version packets received */ +extern u_long sys_restricted; /* restricted packets */ +extern u_long sys_oldversionpkt; /* old version packets */ +extern u_long sys_newversionpkt; /* new version packets */ extern u_long sys_unknownversion; /* don't know version packets */ -extern u_long sys_badlength; /* packets with bad length */ +extern u_long sys_badlength; /* bad length or format */ extern u_long sys_processed; /* packets processed */ -extern u_long sys_badauth; /* packets dropped because of auth */ -extern u_long sys_limitrejected; /* pkts rejected due to client count per net */ +extern u_long sys_badauth; /* bad authentication */ +extern u_long sys_limitrejected; /* rate limit exceeded */ +extern u_long sys_received; /* packets received */ /* ntp_refclock.c */ #ifdef REFCLOCK @@ -364,13 +400,15 @@ extern int fdpps; /* pps file descriptor */ extern keyid_t info_auth_keyid; /* keyid used to authenticate requests */ /* ntp_restrict.c */ -extern struct restrictlist *restrictlist; /* the restriction list */ -extern u_long client_limit; -extern u_long client_limit_period; +extern struct restrictlist *restrictlist; /* the ipv4 restriction list */ +extern struct restrictlist6 *restrictlist6; /* the ipv6 restriction list */ +extern u_long res_min_interval; +extern u_long res_avg_interval; +extern u_long mon_age; /* monitor preempt age */ /* ntp_timer.c */ extern volatile int alarm_flag; /* alarm flag */ -extern u_long sys_revoke; /* keys revoke timeout */ +extern u_char sys_revoke; /* keys revoke timeout (log2 s) */ extern volatile u_long alarm_overflow; extern u_long current_time; /* current time (s) */ extern u_long timer_timereset; diff --git a/dist/ntp/include/ntpsim.h b/dist/ntp/include/ntpsim.h index 12cd82616d50..6f1989273edf 100644 --- a/dist/ntp/include/ntpsim.h +++ b/dist/ntp/include/ntpsim.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntpsim.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: ntpsim.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * ntpsim.h - Prototypes for ntpsim diff --git a/dist/ntp/include/parse.h b/dist/ntp/include/parse.h index 1d01653fdec8..f4e6f3b5c397 100644 --- a/dist/ntp/include/parse.h +++ b/dist/ntp/include/parse.h @@ -1,4 +1,4 @@ -/* $NetBSD: parse.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: parse.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/parse.h,v 4.5 1998/08/09 22:23:32 kardel RELEASE_19990228_A diff --git a/dist/ntp/include/parse_conf.h b/dist/ntp/include/parse_conf.h index fdd74d9d6820..ce98cd403a10 100644 --- a/dist/ntp/include/parse_conf.h +++ b/dist/ntp/include/parse_conf.h @@ -1,4 +1,4 @@ -/* $NetBSD: parse_conf.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: parse_conf.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/parse_conf.h,v 4.2 1998/06/14 21:09:28 kardel RELEASE_19990228_A diff --git a/dist/ntp/include/recvbuff.h b/dist/ntp/include/recvbuff.h index a5e4a7a41cc2..693e39d15ae2 100644 --- a/dist/ntp/include/recvbuff.h +++ b/dist/ntp/include/recvbuff.h @@ -1,4 +1,4 @@ -/* $NetBSD: recvbuff.h,v 1.1.1.2 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: recvbuff.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #if !defined __recvbuff_h #define __recvbuff_h diff --git a/dist/ntp/include/rsa_md5.h b/dist/ntp/include/rsa_md5.h index 24fe4f2197f8..cbcc814cbea9 100644 --- a/dist/ntp/include/rsa_md5.h +++ b/dist/ntp/include/rsa_md5.h @@ -1,4 +1,4 @@ -/* $NetBSD: rsa_md5.h,v 1.1.1.1 2003/12/04 16:05:22 drochner Exp $ */ +/* $NetBSD: rsa_md5.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* MD5.H - header file for MD5C.C */ diff --git a/dist/ntp/include/trimble.h b/dist/ntp/include/trimble.h index 1f8d9f6cdff7..30e2f96a1ef8 100644 --- a/dist/ntp/include/trimble.h +++ b/dist/ntp/include/trimble.h @@ -1,4 +1,4 @@ -/* $NetBSD: trimble.h,v 1.1.1.1 2000/03/29 12:38:48 simonb Exp $ */ +/* $NetBSD: trimble.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/include/trimble.h,v 4.4 1999/02/28 11:41:11 kardel RELEASE_19990228_A diff --git a/dist/ntp/kernel/chuinit.c b/dist/ntp/kernel/chuinit.c index 1c06714dc9bf..98a0b5d1cae0 100644 --- a/dist/ntp/kernel/chuinit.c +++ b/dist/ntp/kernel/chuinit.c @@ -1,4 +1,4 @@ -/* $NetBSD: chuinit.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: chuinit.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* ** dynamically loadable chu driver diff --git a/dist/ntp/kernel/clkinit.c b/dist/ntp/kernel/clkinit.c index f3d208a13c49..40659a036c80 100644 --- a/dist/ntp/kernel/clkinit.c +++ b/dist/ntp/kernel/clkinit.c @@ -1,4 +1,4 @@ -/* $NetBSD: clkinit.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: clkinit.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* ** dynamically loadable clk driver diff --git a/dist/ntp/kernel/sys/bsd_audioirig.h b/dist/ntp/kernel/sys/bsd_audioirig.h index 2576cb7a094f..fcda2b1cffff 100644 --- a/dist/ntp/kernel/sys/bsd_audioirig.h +++ b/dist/ntp/kernel/sys/bsd_audioirig.h @@ -1,4 +1,4 @@ -/* $NetBSD: bsd_audioirig.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: bsd_audioirig.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * $Header: bsd_audioirig.h,v 1.0 93/08/02 12:42:00 diff --git a/dist/ntp/kernel/sys/chudefs.h b/dist/ntp/kernel/sys/chudefs.h index dd5b4e7a9ea4..f3bd157131b7 100644 --- a/dist/ntp/kernel/sys/chudefs.h +++ b/dist/ntp/kernel/sys/chudefs.h @@ -1,4 +1,4 @@ -/* $NetBSD: chudefs.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: chudefs.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Definitions for the CHU line discipline v2.0 diff --git a/dist/ntp/kernel/sys/clkdefs.h b/dist/ntp/kernel/sys/clkdefs.h index 65053fe544c7..0c0a84fe6fb7 100644 --- a/dist/ntp/kernel/sys/clkdefs.h +++ b/dist/ntp/kernel/sys/clkdefs.h @@ -1,4 +1,4 @@ -/* $NetBSD: clkdefs.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: clkdefs.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Defines for the "clk" timestamping STREAMS module diff --git a/dist/ntp/kernel/sys/i8253.h b/dist/ntp/kernel/sys/i8253.h index 25567a5438f0..432bbbffd6c2 100644 --- a/dist/ntp/kernel/sys/i8253.h +++ b/dist/ntp/kernel/sys/i8253.h @@ -1,4 +1,4 @@ -/* $NetBSD: i8253.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: i8253.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* Copyright (c) 1995 Vixie Enterprises * diff --git a/dist/ntp/kernel/sys/parsestreams.h b/dist/ntp/kernel/sys/parsestreams.h index f8d83ff1daea..b32d06c753b6 100644 --- a/dist/ntp/kernel/sys/parsestreams.h +++ b/dist/ntp/kernel/sys/parsestreams.h @@ -1,4 +1,4 @@ -/* $NetBSD: parsestreams.h,v 1.1.1.2 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: parsestreams.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/kernel/sys/parsestreams.h,v 4.4 1998/06/14 21:09:32 kardel RELEASE_19990228_A diff --git a/dist/ntp/kernel/sys/pcl720.h b/dist/ntp/kernel/sys/pcl720.h index 497d34fd16dc..5e48335bbc3a 100644 --- a/dist/ntp/kernel/sys/pcl720.h +++ b/dist/ntp/kernel/sys/pcl720.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcl720.h,v 1.1.1.2 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: pcl720.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* Copyright (c) 1995 Vixie Enterprises * diff --git a/dist/ntp/kernel/sys/ppsclock.h b/dist/ntp/kernel/sys/ppsclock.h index 492caa6535a4..e3a6f7b1adce 100644 --- a/dist/ntp/kernel/sys/ppsclock.h +++ b/dist/ntp/kernel/sys/ppsclock.h @@ -1,4 +1,4 @@ -/* $NetBSD: ppsclock.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: ppsclock.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * This software was developed by the Computer Systems Engineering group diff --git a/dist/ntp/kernel/sys/timex.h b/dist/ntp/kernel/sys/timex.h index 8818db52a93a..aa1044852195 100644 --- a/dist/ntp/kernel/sys/timex.h +++ b/dist/ntp/kernel/sys/timex.h @@ -1,4 +1,4 @@ -/* $NetBSD: timex.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: timex.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /****************************************************************************** * * diff --git a/dist/ntp/kernel/sys/tpro.h b/dist/ntp/kernel/sys/tpro.h index 03d5392e0a20..db33c4aeb402 100644 --- a/dist/ntp/kernel/sys/tpro.h +++ b/dist/ntp/kernel/sys/tpro.h @@ -1,4 +1,4 @@ -/* $NetBSD: tpro.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: tpro.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Structure for the KSI/Odetics TPRO-S data returned in reponse to a diff --git a/dist/ntp/kernel/sys/tt560_api.h b/dist/ntp/kernel/sys/tt560_api.h index a678c6e365d7..8a944106cfa0 100644 --- a/dist/ntp/kernel/sys/tt560_api.h +++ b/dist/ntp/kernel/sys/tt560_api.h @@ -1,4 +1,4 @@ -/* $NetBSD: tt560_api.h,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: tt560_api.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /*********************************************************************** * diff --git a/dist/ntp/kernel/tty_chu.c b/dist/ntp/kernel/tty_chu.c index 3be2b6b347be..8bebfb6c9559 100644 --- a/dist/ntp/kernel/tty_chu.c +++ b/dist/ntp/kernel/tty_chu.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty_chu.c,v 1.2 2002/05/16 19:40:53 wiz Exp $ */ +/* $NetBSD: tty_chu.c,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* tty_chu.c,v 3.1 1993/07/06 01:07:30 jbj Exp * tty_chu.c - CHU line driver @@ -275,4 +275,4 @@ win: splx(s); return (1); } -#endif /* NCHU */ +#endif NCHU diff --git a/dist/ntp/kernel/tty_chu_STREAMS.c b/dist/ntp/kernel/tty_chu_STREAMS.c index c1097a1aaccc..d1fa0eb386f6 100644 --- a/dist/ntp/kernel/tty_chu_STREAMS.c +++ b/dist/ntp/kernel/tty_chu_STREAMS.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty_chu_STREAMS.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: tty_chu_STREAMS.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * CHU STREAMS module for SunOS diff --git a/dist/ntp/kernel/tty_clk.c b/dist/ntp/kernel/tty_clk.c index a91d2d6e0d10..141a9478b792 100644 --- a/dist/ntp/kernel/tty_clk.c +++ b/dist/ntp/kernel/tty_clk.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty_clk.c,v 1.2 2002/05/16 19:41:36 wiz Exp $ */ +/* $NetBSD: tty_clk.c,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* tty_clk.c,v 3.1 1993/07/06 01:07:33 jbj Exp * tty_clk.c - Generic line driver for receiving radio clock timecodes @@ -316,4 +316,4 @@ clkioctl(tp, cmd, data, flag) } return (ENOTTY); /* not quite appropriate */ } -#endif /* NCLK */ +#endif NCLK diff --git a/dist/ntp/kernel/tty_clk_STREAMS.c b/dist/ntp/kernel/tty_clk_STREAMS.c index 904c12038888..a5df9d9d6c03 100644 --- a/dist/ntp/kernel/tty_clk_STREAMS.c +++ b/dist/ntp/kernel/tty_clk_STREAMS.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty_clk_STREAMS.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: tty_clk_STREAMS.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* tty_clk_STREAMS.c,v 3.1 1993/07/06 01:07:34 jbj Exp * Timestamp STREAMS module for SunOS 4.1 diff --git a/dist/ntp/libisc/assertions.c b/dist/ntp/libisc/assertions.c index 777e17a7762b..f256549bec3a 100644 --- a/dist/ntp/libisc/assertions.c +++ b/dist/ntp/libisc/assertions.c @@ -1,4 +1,4 @@ -/* $NetBSD: assertions.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: assertions.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1997-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/error.c b/dist/ntp/libisc/error.c index 1b878ab5c8fb..23603867a3cc 100644 --- a/dist/ntp/libisc/error.c +++ b/dist/ntp/libisc/error.c @@ -1,4 +1,4 @@ -/* $NetBSD: error.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: error.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1998-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/ifiter_ioctl.c b/dist/ntp/libisc/ifiter_ioctl.c index 9375d585fe84..2d1642f33865 100644 --- a/dist/ntp/libisc/ifiter_ioctl.c +++ b/dist/ntp/libisc/ifiter_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ifiter_ioctl.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: ifiter_ioctl.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/ifiter_sysctl.c b/dist/ntp/libisc/ifiter_sysctl.c index 27989d1cfa24..cdeefb81abd8 100644 --- a/dist/ntp/libisc/ifiter_sysctl.c +++ b/dist/ntp/libisc/ifiter_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ifiter_sysctl.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: ifiter_sysctl.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/inet_ntop.c b/dist/ntp/libisc/inet_ntop.c index 5139a2da6df3..d78d82d163d9 100644 --- a/dist/ntp/libisc/inet_ntop.c +++ b/dist/ntp/libisc/inet_ntop.c @@ -1,4 +1,4 @@ -/* $NetBSD: inet_ntop.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: inet_ntop.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1996-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/interfaceiter.c b/dist/ntp/libisc/interfaceiter.c index 51e30e7e263a..380dce35f808 100644 --- a/dist/ntp/libisc/interfaceiter.c +++ b/dist/ntp/libisc/interfaceiter.c @@ -1,4 +1,4 @@ -/* $NetBSD: interfaceiter.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: interfaceiter.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/isc_strerror.c b/dist/ntp/libisc/isc_strerror.c index a2e1ef47ae8b..4d590e8aaf76 100644 --- a/dist/ntp/libisc/isc_strerror.c +++ b/dist/ntp/libisc/isc_strerror.c @@ -1,4 +1,4 @@ -/* $NetBSD: isc_strerror.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: isc_strerror.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/lib.c b/dist/ntp/libisc/lib.c index be80a4a2a4d5..42d613792405 100644 --- a/dist/ntp/libisc/lib.c +++ b/dist/ntp/libisc/lib.c @@ -1,4 +1,4 @@ -/* $NetBSD: lib.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: lib.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/mem.c b/dist/ntp/libisc/mem.c index 0cc922683c52..b99451deb4f6 100644 --- a/dist/ntp/libisc/mem.c +++ b/dist/ntp/libisc/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: mem.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1997-2002 Internet Software Consortium. diff --git a/dist/ntp/libisc/msgcat.c b/dist/ntp/libisc/msgcat.c index 725509e1ca9a..5b6e7f7d8b7a 100644 --- a/dist/ntp/libisc/msgcat.c +++ b/dist/ntp/libisc/msgcat.c @@ -1,4 +1,4 @@ -/* $NetBSD: msgcat.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: msgcat.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/net.c b/dist/ntp/libisc/net.c index c6231bcfe656..99ca458584c6 100644 --- a/dist/ntp/libisc/net.c +++ b/dist/ntp/libisc/net.c @@ -1,4 +1,4 @@ -/* $NetBSD: net.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: net.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 1999-2001 Internet Software Consortium. diff --git a/dist/ntp/libisc/strerror.c b/dist/ntp/libisc/strerror.c index 2e375803e21a..3eb7a615f101 100644 --- a/dist/ntp/libisc/strerror.c +++ b/dist/ntp/libisc/strerror.c @@ -1,4 +1,4 @@ -/* $NetBSD: strerror.c,v 1.1.1.1 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: strerror.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (C) 2001 Internet Software Consortium. diff --git a/dist/ntp/libntp/a_md5encrypt.c b/dist/ntp/libntp/a_md5encrypt.c index de9d27917aa5..1f39ae5f2f72 100644 --- a/dist/ntp/libntp/a_md5encrypt.c +++ b/dist/ntp/libntp/a_md5encrypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: a_md5encrypt.c,v 1.1.1.3 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: a_md5encrypt.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * MD5 interface for rsaref2.0 diff --git a/dist/ntp/libntp/adjtime.c b/dist/ntp/libntp/adjtime.c index e027c8158515..dd0605b03fb4 100644 --- a/dist/ntp/libntp/adjtime.c +++ b/dist/ntp/libntp/adjtime.c @@ -1,4 +1,4 @@ -/* $NetBSD: adjtime.c,v 1.1.1.2 2003/12/04 16:05:23 drochner Exp $ */ +/* $NetBSD: adjtime.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #ifdef HAVE_CONFIG_H # include diff --git a/dist/ntp/libntp/adjtimex.c b/dist/ntp/libntp/adjtimex.c index 5cbc067f9a1c..afa6fe68e714 100644 --- a/dist/ntp/libntp/adjtimex.c +++ b/dist/ntp/libntp/adjtimex.c @@ -1,4 +1,4 @@ -/* $NetBSD: adjtimex.c,v 1.2 2002/05/16 19:53:37 wiz Exp $ */ +/* $NetBSD: adjtimex.c,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -8,7 +8,7 @@ #ifndef lint _sccsid:.asciz "11/19/91 ULTRIX @(#)adjtime.c 6.1" -#endif /* not lint */ +#endif not lint #include "SYS.h" diff --git a/dist/ntp/libntp/atoint.c b/dist/ntp/libntp/atoint.c index 29537d8c01ab..75b567493c3f 100644 --- a/dist/ntp/libntp/atoint.c +++ b/dist/ntp/libntp/atoint.c @@ -1,4 +1,4 @@ -/* $NetBSD: atoint.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: atoint.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * atoint - convert an ascii string to a signed long, with error checking diff --git a/dist/ntp/libntp/atolfp.c b/dist/ntp/libntp/atolfp.c index 76660f4677c1..e3ce88f05ffc 100644 --- a/dist/ntp/libntp/atolfp.c +++ b/dist/ntp/libntp/atolfp.c @@ -1,4 +1,4 @@ -/* $NetBSD: atolfp.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: atolfp.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * atolfp - convert an ascii string to an l_fp number diff --git a/dist/ntp/libntp/atouint.c b/dist/ntp/libntp/atouint.c index 2ef0668f9417..9078bb45ee18 100644 --- a/dist/ntp/libntp/atouint.c +++ b/dist/ntp/libntp/atouint.c @@ -1,4 +1,4 @@ -/* $NetBSD: atouint.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: atouint.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * atouint - convert an ascii string to an unsigned long, with error checking diff --git a/dist/ntp/libntp/audio.c b/dist/ntp/libntp/audio.c index f9486d12f9cc..594a225da417 100644 --- a/dist/ntp/libntp/audio.c +++ b/dist/ntp/libntp/audio.c @@ -1,43 +1,205 @@ -/* $NetBSD: audio.c,v 1.2 2000/04/17 05:46:46 simonb Exp $ */ +/* $NetBSD: audio.c,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* * audio.c - audio interface for reference clock audio drivers */ #ifdef HAVE_CONFIG_H -#include +# include #endif +#if defined(HAVE_SYS_AUDIOIO_H) || defined(HAVE_SUN_AUDIOIO_H) || \ + defined(HAVE_SYS_SOUNDCARD_H) || defined(HAVE_MACHINE_SOUNDCARD_H) + #include "audio.h" -#include +#include "ntp_stdlib.h" +#include "ntp_syslog.h" +#ifdef HAVE_UNISTD_H +# include +#endif #include -#include +#include "ntp_string.h" #ifdef HAVE_SYS_AUDIOIO_H -#include +# include #endif /* HAVE_SYS_AUDIOIO_H */ + #ifdef HAVE_SUN_AUDIOIO_H -#include +# include +# include #endif /* HAVE_SUN_AUDIOIO_H */ + #ifdef HAVE_SYS_IOCTL_H -#include +# include #endif /* HAVE_SYS_IOCTL_H */ #include +#ifdef HAVE_MACHINE_SOUNDCARD_H +# include +# define PCM_STYLE_SOUND +#else +# ifdef HAVE_SYS_SOUNDCARD_H +# include +# define PCM_STYLE_SOUND +# endif +#endif + +#ifdef PCM_STYLE_SOUND +# include +#endif + /* * Global variables */ #ifdef HAVE_SYS_AUDIOIO_H static struct audio_device device; /* audio device ident */ -static struct audio_info info; /* audio device info */ -static int ctl_fd; /* audio control file descriptor */ #endif /* HAVE_SYS_AUDIOIO_H */ +#ifdef PCM_STYLE_SOUND +# define INIT_FILE "/etc/ntp.audio" +int agc = SOUND_MIXER_WRITE_RECLEV; /* or IGAIN or LINE */ +int monitor = SOUND_MIXER_WRITE_VOLUME; /* or OGAIN */ +int devmask = 0; +int recmask = 0; +char cf_c_dev[100], cf_i_dev[100], cf_agc[100], cf_monitor[100]; +const char *m_names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; +#else /* not PCM_STYLE_SOUND */ +static struct audio_info info; /* audio device info */ +#endif /* not PCM_STYLE_SOUND */ +static int ctl_fd; /* audio control file descriptor */ + +#ifdef PCM_STYLE_SOUND +static void audio_config_read P((int, char **, char **)); +static int mixer_name P((const char *, int)); + + +int +mixer_name( + const char *m_name, + int m_mask + ) +{ + int i; + + for (i = 0; i < SOUND_MIXER_NRDEVICES; ++i) + if (((1 << i) & m_mask) + && !strcmp(m_names[i], m_name)) + break; + + return (SOUND_MIXER_NRDEVICES == i) + ? -1 + : i + ; +} + + +/* + * Check: + * + * /etc/ntp.audio# where # is the unit number + * /etc/ntp.audio.# where # is the unit number + * /etc/ntp.audio + * + * for contents of the form: + * + * idev /dev/input_device + * cdev /dev/control_device + * agc pcm_input_device {igain,line,line1,...} + * monitor pcm_monitor_device {ogain,...} + * + * The device names for the "agc" and "monitor" keywords + * can be found by running either the "mixer" program or the + * util/audio-pcm program. + * + * Great hunks of this subroutine were swiped from refclock_oncore.c + */ +static void +audio_config_read( + int unit, + char **c_dev, /* Control device */ + char **i_dev /* input device */ + ) +{ + FILE *fd; + char device[20], line[100], ab[100]; + + sprintf(device, "%s%d", INIT_FILE, unit); + if ((fd = fopen(device, "r")) == NULL) { + printf("audio_config_read: <%s> NO\n", device); + sprintf(device, "%s.%d", INIT_FILE, unit); + if ((fd = fopen(device, "r")) == NULL) { + printf("audio_config_read: <%s> NO\n", device); + sprintf(device, "%s.%d", INIT_FILE, unit); + if ((fd = fopen(device, "r")) == NULL) { + printf("audio_config_read: <%s> NO\n", device); + return; + } + } + } + printf("audio_config_read: reading <%s>\n", device); + while (fgets(line, sizeof line, fd)) { + char *cp, *cc, *ca; + int i; + + /* Remove comments */ + if ((cp = strchr(line, '#'))) + *cp = '\0'; + + /* Remove any trailing spaces */ + for (i = strlen(line); + i > 0 && isascii((int)line[i - 1]) && isspace((int)line[i - 1]); + ) + line[--i] = '\0'; + + /* Remove leading space */ + for (cc = line; *cc && isascii((int)*cc) && isspace((int)*cc); cc++) + continue; + + /* Stop if nothing left */ + if (!*cc) + continue; + + /* Uppercase the command and find the arg */ + for (ca = cc; *ca; ca++) { + if (isascii((int)*ca)) { + if (islower((int)*ca)) { + *ca = toupper(*ca); + } else if (isspace((int)*ca) || (*ca == '=')) + break; + } + } + + /* Remove space (and possible =) leading the arg */ + for (; *ca && isascii((int)*ca) && (isspace((int)*ca) || (*ca == '=')); ca++) + continue; + + if (!strncmp(cc, "IDEV", (size_t) 4)) { + sscanf(ca, "%s", ab); + strcpy(cf_i_dev, ab); + printf("idev <%s>\n", ab); + } else if (!strncmp(cc, "CDEV", (size_t) 4)) { + sscanf(ca, "%s", ab); + strcpy(cf_c_dev, ab); + printf("cdev <%s>\n", ab); + } else if (!strncmp(cc, "AGC", (size_t) 3)) { + sscanf(ca, "%s", ab); + strcpy(cf_agc, ab); + printf("agc <%s> %d\n", ab, i); + } else if (!strncmp(cc, "MONITOR", (size_t) 7)) { + sscanf(ca, "%s", ab); + strcpy(cf_monitor, ab); + printf("monitor <%s> %d\n", ab, mixer_name(ab, -1)); + } + } + fclose(fd); + return; +} +#endif /* PCM_STYLE_SOUND */ /* * audio_init - open and initialize audio device * - * This code works with SunOS 4.x and Solaris 2.x; however, it is + * This code works with SunOS 4.x, Solaris 2.x, and PCM; however, it is * believed generic and applicable to other systems with a minor twid * or two. All it does is open the device, set the buffer size (Solaris * only), preset the gain and set the input port. It assumes that the @@ -46,29 +208,56 @@ static int ctl_fd; /* audio control file descriptor */ * default. */ int -audio_init(void) +audio_init( + char *dname, /* device name */ + int bufsiz, /* buffer size */ + int unit /* device unit (0-3) */ + ) { +#ifdef PCM_STYLE_SOUND +# define ACTL_DEV "/dev/mixer%d" + char actl_dev[30]; +# ifdef HAVE_STRUCT_SND_SIZE + struct snd_size s_size; +# endif +# ifdef AIOGFMT + snd_chan_param s_c_p; +# endif +#endif int fd; -#ifdef HAVE_SYS_AUDIOIO_H int rval; -#endif /* HAVE_SYS_AUDIOIO_H */ + char *actl = +#ifdef PCM_STYLE_SOUND + actl_dev +#else + "/dev/audioctl" +#endif + ; + +#ifdef PCM_STYLE_SOUND + (void)sprintf(actl_dev, ACTL_DEV, unit); + + audio_config_read(unit, &actl, &dname); + /* If we have values for cf_c_dev or cf_i_dev, use them. */ + if (*cf_c_dev) + dname = cf_c_dev; + if (*cf_i_dev) + actl = cf_i_dev; +#endif /* - * 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); + ctl_fd = open(actl, O_RDWR); if (ctl_fd < 0) { - perror("audioctl:"); + msyslog(LOG_ERR, "audio_init: invalid control device <%s>\n", actl); close(fd); return(ctl_fd); } @@ -76,46 +265,181 @@ audio_init(void) /* * Set audio device parameters. */ - rval = audio_gain((AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) / 2, - AUDIO_MICROPHONE); +#ifdef PCM_STYLE_SOUND + printf("audio_init: <%s> bufsiz %d\n", dname, bufsiz); + rval = fd; + +# ifdef HAVE_STRUCT_SND_SIZE + if (ioctl(fd, AIOGSIZE, &s_size) == -1) + printf("audio_init: AIOGSIZE: %s\n", strerror(errno)); + else + printf("audio_init: orig: play_size %d, rec_size %d\n", + s_size.play_size, s_size.rec_size); + + s_size.play_size = s_size.rec_size = bufsiz; + printf("audio_init: want: play_size %d, rec_size %d\n", + s_size.play_size, s_size.rec_size); + + if (ioctl(fd, AIOSSIZE, &s_size) == -1) + printf("audio_init: AIOSSIZE: %s\n", strerror(errno)); + else + printf("audio_init: set: play_size %d, rec_size %d\n", + s_size.play_size, s_size.rec_size); +# endif /* HAVE_STRUCT_SND_SIZE */ + +# ifdef AIOGFMT + if (ioctl(fd, AIOGFMT, &s_c_p) == -1) + printf("audio_init: AIOGFMT: %s\n", strerror(errno)); + else + printf("audio_init: play_rate %lu, rec_rate %lu, play_format %#lx, rec_format %#lx\n", + s_c_p.play_rate, s_c_p.rec_rate, s_c_p.play_format, s_c_p.rec_format); +# endif + + /* Grab the device and record masks */ + + if (ioctl(ctl_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) + printf("SOUND_MIXER_READ_DEVMASK: %s\n", strerror(errno)); + if (ioctl(ctl_fd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) + printf("SOUND_MIXER_READ_RECMASK: %s\n", strerror(errno)); + + /* validate and set any specified config file stuff */ + if (*cf_agc) { + int i; + + i = mixer_name(cf_agc, recmask); + if (i >= 0) + agc = MIXER_WRITE(i); + else + printf("input %s not in recmask %#x\n", + cf_agc, recmask); + } + + if (*cf_monitor) { + int i; + + /* devmask */ + i = mixer_name(cf_monitor, devmask); + if (i >= 0) + monitor = MIXER_WRITE(i); + else + printf("monitor %s not in devmask %#x\n", + cf_monitor, devmask); + } + +#else /* not PCM_STYLE_SOUND */ + AUDIO_INITINFO(&info); + info.play.gain = AUDIO_MAX_GAIN; + info.play.port = AUDIO_SPEAKER; +# ifdef HAVE_SYS_AUDIOIO_H + info.record.buffer_size = bufsiz; +# endif /* HAVE_SYS_AUDIOIO_H */ + rval = ioctl(ctl_fd, (int)AUDIO_SETINFO, (char *)&info); 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); + rval = fd; +#endif /* not PCM_STYLE_SOUND */ + return (rval); } /* - * audio_gain - adjust codec gain and port + * audio_gain - adjust codec gains and port */ int audio_gain( - int gain, /* gain 0-255 */ - int port /* port */ + int gain, /* volume level (gain) 0-255 */ + int mongain, /* input to output mix (monitor gain) 0-255 */ + int port /* selected I/O port: 1 mic/2 line in */ ) { -#ifdef HAVE_SYS_AUDIOIO_H int rval; -#endif /* HAVE_SYS_AUDIOIO_H */ + static int o_mongain = -1; + static int o_port = -1; -#ifdef HAVE_SYS_AUDIOIO_H - AUDIO_INITINFO(&info); - info.record.buffer_size = AUDIO_BUFSIZ; - 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:"); +#ifdef PCM_STYLE_SOUND + int l, r; + + rval = 0; + + r = l = 100 * gain / 255; /* Normalize to 0-100 */ +# ifdef DEBUG + if (debug > 1) + printf("audio_gain: gain %d/%d\n", gain, l); +# endif + /* figure out what channel(s) to use. just nuke right for now. */ + r = 0 ; /* setting to zero nicely mutes the channel */ + + l |= r << 8; + if (port == 2) { + rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_LINE, &l); + } else { + rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_MIC, &l); + } + if (rval == -1) { + printf("audio_gain: agc write: %s\n", strerror(errno)); return (rval); } - return (info.record.error); -#else - return (0); -#endif /* HAVE_SYS_AUDIOIO_H */ + + if (o_mongain != mongain) { + r = l = 100 * mongain / 255; /* Normalize to 0-100 */ +# ifdef DEBUG + if (debug > 1) + printf("audio_gain: mongain %d/%d\n", mongain, l); +# endif + l |= r << 8; + rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_VOLUME, &l); + if (rval == -1) { + printf("audio_gain: mongain write: %s\n", + strerror(errno)); + return (rval); + } + o_mongain = mongain; + } + + if (o_port != port) { +# ifdef DEBUG + if (debug > 1) + printf("audio_gain: port %d\n", port); +# endif + l = (1 << ((port == 2) ? SOUND_MIXER_LINE : SOUND_MIXER_MIC)); + rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_RECSRC, &l); + if (rval == -1) { + printf("SOUND_MIXER_WRITE_RECSRC: %s\n", + strerror(errno)); + return (rval); + } +# ifdef DEBUG + if (debug > 1) { + if (ioctl(ctl_fd, SOUND_MIXER_READ_RECSRC, &l) == -1) + printf("SOUND_MIXER_WRITE_RECSRC: %s\n", + strerror(errno)); + else + printf("audio_gain: recsrc is %d\n", l); + } +# endif + o_port = port; + } +#else /* not PCM_STYLE_SOUND */ + ioctl(ctl_fd, (int)AUDIO_GETINFO, (char *)&info); + info.record.encoding = AUDIO_ENCODING_ULAW; + info.record.error = 0; + info.record.gain = gain; + if (o_mongain != mongain) + o_mongain = info.monitor_gain = mongain; + if (o_port != port) + o_port = info.record.port = port; + rval = ioctl(ctl_fd, (int)AUDIO_SETINFO, (char *)&info); + if (rval < 0) { + msyslog(LOG_ERR, "audio_gain: %m"); + return (rval); + } + rval = info.record.error; +#endif /* not PCM_STYLE_SOUND */ + return (rval); } @@ -128,61 +452,32 @@ audio_gain( void audio_show(void) { -#ifdef HAVE_SYS_AUDIOIO_H +#ifdef PCM_STYLE_SOUND + int recsrc = 0; + + printf("audio_show: ctl_fd %d\n", ctl_fd); + if (ioctl(ctl_fd, SOUND_MIXER_READ_RECSRC, &recsrc) == -1) + printf("SOUND_MIXER_READ_RECSRC: %s\n", strerror(errno)); + +#else /* not PCM_STYLE_SOUND */ +# ifdef HAVE_SYS_AUDIOIO_H ioctl(ctl_fd, (int)AUDIO_GETDEV, &device); printf("audio: name %s, version %s, config %s\n", device.name, device.version, device.config); - ioctl(ctl_fd, (int)AUDIO_GETINFO, &info); +# endif /* HAVE_SYS_AUDIOIO_H */ + ioctl(ctl_fd, (int)AUDIO_GETINFO, (char *)&info); printf( - "audio: samples %d, channels %d, precision %d, encoding %d\n", + "audio: rate %d, chan %d, prec %d, code %d, gain %d, mon %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.gain, info.record.port); + info.record.precision, info.record.encoding, + info.record.gain, info.monitor_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); - - { - int cnt = 0; /* this will handle clean line wraps someday */ - /* Right now, I think we're under 75 columns... */ - - printf("audio: monitor %d", info.monitor_gain); - cnt += 17; - -#ifdef HAVE_STRUCT_AUDIO_INFO_OUTPUT_MUTED - printf(", muted %d", info.output_muted); - cnt += 9; -#endif - -#ifdef HAVE_STRUCT_AUDIO_INFO_BLOCKSIZE - printf(", blocksize %d", info.blocksize); - cnt += 16; -#endif - -#ifdef HAVE_STRUCT_AUDIO_INFO_HIWAT - printf(", hiwat %d", info.hiwat); - cnt += 11; -#endif - -#ifdef HAVE_STRUCT_AUDIO_INFO_LOWAT - printf(", lowat %d", info.lowat); - cnt += 11; -#endif - -#ifdef HAVE_STRUCT_AUDIO_INFO_MODE - printf(", mode %d", info.mode); - cnt += 8; -#endif - if (cnt) { - printf("\n"); - cnt = 0; - } - } -#endif /* HAVE_SYS_AUDIOIO_H */ +#endif /* not PCM_STYLE_SOUND */ } +#else +int audio_bs; +#endif /* HAVE_{SYS_AUDIOIO,SUN_AUDIOIO,MACHINE_SOUNDCARD,SYS_SOUNDCARD}_H */ diff --git a/dist/ntp/libntp/authencrypt.c b/dist/ntp/libntp/authencrypt.c deleted file mode 100644 index 810fe74a1b26..000000000000 --- a/dist/ntp/libntp/authencrypt.c +++ /dev/null @@ -1,99 +0,0 @@ -/* $NetBSD: authencrypt.c,v 1.1.1.2 2000/04/22 14:52:55 simonb Exp $ */ - -/* - * DES interface for rsaref2.0 - * - * These routines implement an interface for the RSA Laboratories - * implementation of the Data Encryption Standard (DES) algorithm - * operating in Cipher-Block Chaining (CBC) mode. This algorithm is - * included in the rsaref2.0 package available from RSA in the US and - * foreign countries. Further information is available at www.rsa.com. - */ - -#include "ntp_machine.h" - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef DES -#include "ntp_types.h" -#include "ntp_fp.h" -#include "ntp_string.h" -#include "global.h" -#include "des.h" -#include "ntp_stdlib.h" - -#define BLOCK_OCTETS 8 /* message digest size */ -#define MAXTPKT 128 /* max packet size */ - - -/* - * DESauthencrypt - generate DES-CBC message authenticator - * - * Returns length of authenticator field. - */ -int -DESauthencrypt( - u_char *key, /* key pointer */ - u_int32 *pkt, /* packet pointer */ - int length /* packet length */ - ) -{ - DES_CBC_CTX ctx; - u_int32 tpkt[MAXTPKT]; - u_int32 work[2]; - int i, j; - - /* - * DES-CBC with zero IV. Note the encrypted text is discarded. - */ - work[0] = work[1] = 0; - DES_CBCInit(&ctx, key, (u_char *)work, 1); - DES_CBCUpdate(&ctx, (u_char *)tpkt, (u_char *)pkt, - (u_int)length); - i = length / 4 + 1; - j = i - 3; - pkt[i++] = (u_int32)htonl(tpkt[j++]); - pkt[i] = (u_int32)htonl(tpkt[j]); - return (BLOCK_OCTETS + 4); -} - - -/* - * DESauthdecrypt - verify DES message authenticator - * - * Returns one if authenticator valid, zero if invalid. - */ -int -DESauthdecrypt( - u_char *key, /* key pointer */ - u_int32 *pkt, /* packet pointer */ - int length, /* packet length */ - int size /* size of MAC field */ - ) -{ - DES_CBC_CTX ctx; - u_int32 tpkt[MAXTPKT]; - u_int32 work[2]; - int i, j; - - /* - * DES-CBC with zero IV. Note the encrypted text is discarded. - */ - if (size != BLOCK_OCTETS + 4) - return (0); - work[0] = work[1] = 0; - DES_CBCInit (&ctx, key, (u_char *)work, 1); - DES_CBCUpdate (&ctx, (u_char *)tpkt, (u_char *)pkt, - (u_int)length); - i = length / 4 + 1; - j = i - 3; - if ((u_int32)ntohl(pkt[i++]) == tpkt[j++] && - (u_int32)ntohl(pkt[i]) == tpkt[j]) - return (1); - return (0); -} -#else -int authencrypt_bs; -#endif /* DES */ diff --git a/dist/ntp/libntp/authkeys.c b/dist/ntp/libntp/authkeys.c index e672565f1e74..0ac743cea580 100644 --- a/dist/ntp/libntp/authkeys.c +++ b/dist/ntp/libntp/authkeys.c @@ -1,4 +1,4 @@ -/* $NetBSD: authkeys.c,v 1.1.1.3 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: authkeys.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * authkeys.c - routines to manage the storage of authentication keys diff --git a/dist/ntp/libntp/authparity.c b/dist/ntp/libntp/authparity.c deleted file mode 100644 index 41af11a1e937..000000000000 --- a/dist/ntp/libntp/authparity.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: authparity.c,v 1.2 2000/04/17 05:47:22 simonb Exp $ */ - -/* - * auth_parity - set parity on a key/check for odd parity - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef DES -#include "ntp_stdlib.h" - -int -DESauth_parity( - u_int32 *key - ) -{ - u_int32 mask; - int parity_err; - int bitcount; - int half; - int byte; - int i; - - /* - * Go through counting bits in each byte. Check to see if - * each parity bit was set correctly. If not, note the error - * and set it right. - */ - parity_err = 0; - for (half = 0; half < 2; half++) { /* two halves of key */ - mask = 0x80000000; - for (byte = 0; byte < 4; byte++) { /* 4 bytes per half */ - bitcount = 0; - for (i = 0; i < 7; i++) { /* 7 data bits / byte */ - if (key[half] & mask) - bitcount++; - mask >>= 1; - } - - /* - * If bitcount is even, parity must be set. If - * bitcount is odd, parity must be clear. - */ - if ((bitcount & 0x1) == 0) { - if (!(key[half] & mask)) { - parity_err++; - key[half] |= mask; - } - } else { - if (key[half] & mask) { - parity_err++; - key[half] &= ~mask; - } - } - mask >>= 1; - } - } - - /* - * Return the result of the parity check. - */ - return (parity_err == 0); -} -#endif /* DES */ diff --git a/dist/ntp/libntp/authreadkeys.c b/dist/ntp/libntp/authreadkeys.c index 5a0035e1f081..8eb3c6598337 100644 --- a/dist/ntp/libntp/authreadkeys.c +++ b/dist/ntp/libntp/authreadkeys.c @@ -1,4 +1,4 @@ -/* $NetBSD: authreadkeys.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: authreadkeys.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * authreadkeys.c - routines to support the reading of the key file diff --git a/dist/ntp/libntp/authusekey.c b/dist/ntp/libntp/authusekey.c index ca24b31b70e1..09f0e4578673 100644 --- a/dist/ntp/libntp/authusekey.c +++ b/dist/ntp/libntp/authusekey.c @@ -1,4 +1,4 @@ -/* $NetBSD: authusekey.c,v 1.1.1.3 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: authusekey.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * authusekey - decode a key from ascii and use it diff --git a/dist/ntp/libntp/binio.c b/dist/ntp/libntp/binio.c index 4a56289d37e3..03873ed40d95 100644 --- a/dist/ntp/libntp/binio.c +++ b/dist/ntp/libntp/binio.c @@ -1,4 +1,4 @@ -/* $NetBSD: binio.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: binio.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/libntp/binio.c,v 4.2 1999/02/21 12:17:34 kardel RELEASE_19990228_A diff --git a/dist/ntp/libntp/buftvtots.c b/dist/ntp/libntp/buftvtots.c index c1c4cfe4ade2..d5b3683708a3 100644 --- a/dist/ntp/libntp/buftvtots.c +++ b/dist/ntp/libntp/buftvtots.c @@ -1,4 +1,4 @@ -/* $NetBSD: buftvtots.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: buftvtots.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * buftvtots - pull a Unix-format (struct timeval) time stamp out of diff --git a/dist/ntp/libntp/caljulian.c b/dist/ntp/libntp/caljulian.c index 7e3f3c53cd99..e8cc57022639 100644 --- a/dist/ntp/libntp/caljulian.c +++ b/dist/ntp/libntp/caljulian.c @@ -1,4 +1,4 @@ -/* $NetBSD: caljulian.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: caljulian.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * caljulian - determine the Julian date from an NTP time. diff --git a/dist/ntp/libntp/calleapwhen.c b/dist/ntp/libntp/calleapwhen.c index 2539796cddec..0b4fee2b4c15 100644 --- a/dist/ntp/libntp/calleapwhen.c +++ b/dist/ntp/libntp/calleapwhen.c @@ -1,4 +1,4 @@ -/* $NetBSD: calleapwhen.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: calleapwhen.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * calleapwhen - determine the number of seconds to the next possible diff --git a/dist/ntp/libntp/caltontp.c b/dist/ntp/libntp/caltontp.c index 972c7e331821..ed34d1117ff3 100644 --- a/dist/ntp/libntp/caltontp.c +++ b/dist/ntp/libntp/caltontp.c @@ -1,4 +1,4 @@ -/* $NetBSD: caltontp.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: caltontp.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * caltontp - convert a date to an NTP time diff --git a/dist/ntp/libntp/calyearstart.c b/dist/ntp/libntp/calyearstart.c index 8b459796303c..f742daf23b13 100644 --- a/dist/ntp/libntp/calyearstart.c +++ b/dist/ntp/libntp/calyearstart.c @@ -1,4 +1,4 @@ -/* $NetBSD: calyearstart.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: calyearstart.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * calyearstart - determine the NTP time at midnight of January 1 in diff --git a/dist/ntp/libntp/clocktime.c b/dist/ntp/libntp/clocktime.c index a43a2f2a2ee4..5831a7b8a46c 100644 --- a/dist/ntp/libntp/clocktime.c +++ b/dist/ntp/libntp/clocktime.c @@ -1,4 +1,4 @@ -/* $NetBSD: clocktime.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: clocktime.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * clocktime - compute the NTP date from a day of year, hour, minute diff --git a/dist/ntp/libntp/clocktypes.c b/dist/ntp/libntp/clocktypes.c index d1ce9ef5949d..5bcd9437a964 100644 --- a/dist/ntp/libntp/clocktypes.c +++ b/dist/ntp/libntp/clocktypes.c @@ -1,4 +1,4 @@ -/* $NetBSD: clocktypes.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: clocktypes.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Data for pretty printing clock types diff --git a/dist/ntp/libntp/decodenetnum.c b/dist/ntp/libntp/decodenetnum.c index d7ab4d768868..aa943857d798 100644 --- a/dist/ntp/libntp/decodenetnum.c +++ b/dist/ntp/libntp/decodenetnum.c @@ -1,4 +1,4 @@ -/* $NetBSD: decodenetnum.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: decodenetnum.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * decodenetnum - return a net number (this is crude, but careful) diff --git a/dist/ntp/libntp/dofptoa.c b/dist/ntp/libntp/dofptoa.c index 33fe81f97b58..51e89fdcc3fa 100644 --- a/dist/ntp/libntp/dofptoa.c +++ b/dist/ntp/libntp/dofptoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: dofptoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: dofptoa.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * dofptoa - do the grunge work to convert an fp number to ascii diff --git a/dist/ntp/libntp/dolfptoa.c b/dist/ntp/libntp/dolfptoa.c index f08c20932a84..61d007068e1d 100644 --- a/dist/ntp/libntp/dolfptoa.c +++ b/dist/ntp/libntp/dolfptoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: dolfptoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: dolfptoa.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * dolfptoa - do the grunge work of converting an l_fp number to decimal diff --git a/dist/ntp/libntp/emalloc.c b/dist/ntp/libntp/emalloc.c index 7b04f7767146..a218bc987be4 100644 --- a/dist/ntp/libntp/emalloc.c +++ b/dist/ntp/libntp/emalloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: emalloc.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: emalloc.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * emalloc - return new memory obtained from the system. Belch if none. diff --git a/dist/ntp/libntp/findconfig.c b/dist/ntp/libntp/findconfig.c index 38e6f5509f17..fb8a84fa9b81 100644 --- a/dist/ntp/libntp/findconfig.c +++ b/dist/ntp/libntp/findconfig.c @@ -1,4 +1,4 @@ -/* $NetBSD: findconfig.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: findconfig.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ #ifdef HAVE_CONFIG_H diff --git a/dist/ntp/libntp/fptoa.c b/dist/ntp/libntp/fptoa.c index 65a8083d170b..4efd665b7f99 100644 --- a/dist/ntp/libntp/fptoa.c +++ b/dist/ntp/libntp/fptoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: fptoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: fptoa.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * fptoa - return an asciized representation of an s_fp number diff --git a/dist/ntp/libntp/fptoms.c b/dist/ntp/libntp/fptoms.c index aa6b0ed5e9f9..dff68f81c1f5 100644 --- a/dist/ntp/libntp/fptoms.c +++ b/dist/ntp/libntp/fptoms.c @@ -1,4 +1,4 @@ -/* $NetBSD: fptoms.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: fptoms.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * fptoms - return an asciized s_fp number in milliseconds diff --git a/dist/ntp/libntp/getopt.c b/dist/ntp/libntp/getopt.c index 43537fad4d35..1bcbc0a2e618 100644 --- a/dist/ntp/libntp/getopt.c +++ b/dist/ntp/libntp/getopt.c @@ -1,4 +1,4 @@ -/* $NetBSD: getopt.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: getopt.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * getopt - get option letter from argv diff --git a/dist/ntp/libntp/gpstolfp.c b/dist/ntp/libntp/gpstolfp.c index fa7e4607804d..c26cda2058ba 100644 --- a/dist/ntp/libntp/gpstolfp.c +++ b/dist/ntp/libntp/gpstolfp.c @@ -1,4 +1,4 @@ -/* $NetBSD: gpstolfp.c,v 1.2 2000/04/17 05:48:36 simonb Exp $ */ +/* $NetBSD: gpstolfp.c,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/libntp/gpstolfp.c,v 4.3 1999/02/28 11:42:44 kardel RELEASE_19990228_A @@ -9,7 +9,7 @@ */ #include "ntp_fp.h" -#define GPSORIGIN (unsigned long)(2524953600UL) /* 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/dist/ntp/libntp/hextoint.c b/dist/ntp/libntp/hextoint.c index 09fe2f2a7de5..0f47a04e50a9 100644 --- a/dist/ntp/libntp/hextoint.c +++ b/dist/ntp/libntp/hextoint.c @@ -1,4 +1,4 @@ -/* $NetBSD: hextoint.c,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: hextoint.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * hextoint - convert an ascii string in hex to an unsigned diff --git a/dist/ntp/libntp/hextolfp.c b/dist/ntp/libntp/hextolfp.c index a66095652a28..3ff40639957c 100644 --- a/dist/ntp/libntp/hextolfp.c +++ b/dist/ntp/libntp/hextolfp.c @@ -1,4 +1,4 @@ -/* $NetBSD: hextolfp.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: hextolfp.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * hextolfp - convert an ascii hex string to an l_fp number diff --git a/dist/ntp/libntp/humandate.c b/dist/ntp/libntp/humandate.c index b21fda4fbb55..e11312044e3f 100644 --- a/dist/ntp/libntp/humandate.c +++ b/dist/ntp/libntp/humandate.c @@ -1,4 +1,4 @@ -/* $NetBSD: humandate.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: humandate.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * humandate - convert an NTP (or the current) time to something readable diff --git a/dist/ntp/libntp/icom.c b/dist/ntp/libntp/icom.c index 29f3c923edd7..5411bedddab4 100644 --- a/dist/ntp/libntp/icom.c +++ b/dist/ntp/libntp/icom.c @@ -1,4 +1,4 @@ -/* $NetBSD: icom.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: icom.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * Program to control ICOM radios diff --git a/dist/ntp/libntp/ieee754io.c b/dist/ntp/libntp/ieee754io.c index 91d5e4d0613a..4b76fd7e55f9 100644 --- a/dist/ntp/libntp/ieee754io.c +++ b/dist/ntp/libntp/ieee754io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ieee754io.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: ieee754io.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * /src/NTP/ntp-4/libntp/ieee754io.c,v 4.8 1999/02/21 12:17:36 kardel RELEASE_19990228_A diff --git a/dist/ntp/libntp/inttoa.c b/dist/ntp/libntp/inttoa.c index 9ac91947f373..0055f0495627 100644 --- a/dist/ntp/libntp/inttoa.c +++ b/dist/ntp/libntp/inttoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: inttoa.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: inttoa.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * inttoa - return an asciized signed integer diff --git a/dist/ntp/libntp/iosignal.c b/dist/ntp/libntp/iosignal.c index 2d74e49407ac..60225bd42846 100644 --- a/dist/ntp/libntp/iosignal.c +++ b/dist/ntp/libntp/iosignal.c @@ -1,4 +1,4 @@ -/* $NetBSD: iosignal.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: iosignal.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * iosignal.c - input/output routines for ntpd. The socket-opening code diff --git a/dist/ntp/libntp/lib_strbuf.c b/dist/ntp/libntp/lib_strbuf.c index 3dbd5cfd0e99..a8eae81accc6 100644 --- a/dist/ntp/libntp/lib_strbuf.c +++ b/dist/ntp/libntp/lib_strbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: lib_strbuf.c,v 1.2 2000/04/17 05:49:11 simonb Exp $ */ +/* $NetBSD: lib_strbuf.c,v 1.3 2003/12/04 16:23:36 drochner Exp $ */ /* * lib_strbuf - library string storage diff --git a/dist/ntp/libntp/lib_strbuf.h b/dist/ntp/libntp/lib_strbuf.h index 2bd4462b0b2a..5858d1fa9f2f 100644 --- a/dist/ntp/libntp/lib_strbuf.h +++ b/dist/ntp/libntp/lib_strbuf.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib_strbuf.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: lib_strbuf.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* * lib_strbuf.h - definitions for routines which use the common string buffers diff --git a/dist/ntp/libntp/log.c b/dist/ntp/libntp/log.c index cad7011c7de5..23b0b26074ce 100644 --- a/dist/ntp/libntp/log.c +++ b/dist/ntp/libntp/log.c @@ -1,4 +1,4 @@ -/* $NetBSD: log.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: log.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */ /* Microsoft Developer Support Copyright (c) 1993 Microsoft Corporation. */ diff --git a/dist/ntp/libntp/log.h b/dist/ntp/libntp/log.h index 708ba30e3426..95a73db9eb82 100644 --- a/dist/ntp/libntp/log.h +++ b/dist/ntp/libntp/log.h @@ -1,4 +1,4 @@ -/* $NetBSD: log.h,v 1.1.1.1 2000/03/29 12:38:49 simonb Exp $ */ +/* $NetBSD: log.h,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * log.h - Used only under Windows NT by msyslog.c diff --git a/dist/ntp/libntp/machines.c b/dist/ntp/libntp/machines.c index fc4d16941088..806c9d2c8b9f 100644 --- a/dist/ntp/libntp/machines.c +++ b/dist/ntp/libntp/machines.c @@ -1,4 +1,4 @@ -/* $NetBSD: machines.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: machines.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* machines.c - provide special support for peculiar architectures * diff --git a/dist/ntp/libntp/md5c.c b/dist/ntp/libntp/md5c.c index 3e3a709274a0..8bd6e987f034 100644 --- a/dist/ntp/libntp/md5c.c +++ b/dist/ntp/libntp/md5c.c @@ -1,4 +1,4 @@ -/* $NetBSD: md5c.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: md5c.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ diff --git a/dist/ntp/libntp/memmove.c b/dist/ntp/libntp/memmove.c index ec2ff1864486..98d1e8c7f95e 100644 --- a/dist/ntp/libntp/memmove.c +++ b/dist/ntp/libntp/memmove.c @@ -1,4 +1,4 @@ -/* $NetBSD: memmove.c,v 1.2 2003/08/07 09:21:11 agc Exp $ */ +/* $NetBSD: memmove.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -15,7 +15,11 @@ * 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. Neither the name of the University nor the names of its contributors + * 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. * @@ -46,6 +50,8 @@ static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; #endif #include +#include "l_stdlib.h" + /* * sizeof(word) MUST BE A POWER OF TWO * SO THAT wmask BELOW IS ALL ONES @@ -101,7 +107,8 @@ memmove( * Copy whole words, then mop up any trailing bytes. */ t = length / wsize; - TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + TLOOP(*(word *)dst = *(const word *)src; src += wsize; + dst += wsize); t = length & wmask; TLOOP(*dst++ = *src++); } else { @@ -122,7 +129,8 @@ memmove( TLOOP1(*--dst = *--src); } t = length / wsize; - TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + TLOOP(src -= wsize; dst -= wsize; + *(word *)dst = *(const word *)src); t = length & wmask; TLOOP(*--dst = *--src); } diff --git a/dist/ntp/libntp/mfp_mul.c b/dist/ntp/libntp/mfp_mul.c index ab9c03b60111..7bc45ae46164 100644 --- a/dist/ntp/libntp/mfp_mul.c +++ b/dist/ntp/libntp/mfp_mul.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfp_mul.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: mfp_mul.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libntp/mfp_mul.c,v 4.3 1999/02/21 12:17:37 kardel RELEASE_19990228_A diff --git a/dist/ntp/libntp/mfptoa.c b/dist/ntp/libntp/mfptoa.c index 91618f101515..62dcfc21e499 100644 --- a/dist/ntp/libntp/mfptoa.c +++ b/dist/ntp/libntp/mfptoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfptoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: mfptoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * mfptoa - Return an asciized representation of a signed long fp number diff --git a/dist/ntp/libntp/mfptoms.c b/dist/ntp/libntp/mfptoms.c index 998fd72ca2d8..2e659fed25d6 100644 --- a/dist/ntp/libntp/mfptoms.c +++ b/dist/ntp/libntp/mfptoms.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfptoms.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: mfptoms.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * mfptoms - Return an asciized signed long fp number in milliseconds diff --git a/dist/ntp/libntp/mktime.c b/dist/ntp/libntp/mktime.c index d21f12c00dd6..2494dfdc0b05 100644 --- a/dist/ntp/libntp/mktime.c +++ b/dist/ntp/libntp/mktime.c @@ -1,4 +1,4 @@ -/* $NetBSD: mktime.c,v 1.2 2003/08/07 09:21:11 agc Exp $ */ +/* $NetBSD: mktime.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * Copyright (c) 1987, 1989 Regents of the University of California. @@ -15,7 +15,11 @@ * 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. Neither the name of the University nor the names of its contributors + * 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. * @@ -58,9 +62,9 @@ * by hand. Sorry about that. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "ntp_machine.h" + +#if !HAVE_MKTIME || !HAVE_TIMEGM #ifndef DSTMINUTES #define DSTMINUTES 60 @@ -82,13 +86,7 @@ #define TM_YEAR_BASE 1900 #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#include - -extern time_t time(); +extern time_t time P((time_t *)); static int mon_lengths[2][MONSPERYEAR] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, @@ -183,7 +181,8 @@ tmcomp( static time_t time2( struct tm * tmp, - int * okayp + int * okayp, + int usezn ) { register int dir; @@ -231,7 +230,10 @@ time2( */ t = (t < 0) ? 0 : ((time_t) 1 << bits); for ( ; ; ) { - mytm = *localtime(&t); + if (usezn) + mytm = *localtime(&t); + else + mytm = *gmtime(&t); dir = tmcomp(&mytm, &yourtm); if (dir != 0) { if (bits-- < 0) @@ -249,11 +251,18 @@ time2( return WRONG; } t += saved_seconds; - *tmp = *localtime(&t); + if (usezn) + *tmp = *localtime(&t); + else + *tmp = *gmtime(&t); *okayp = TRUE; return t; } +#else +int mktime_bs; +#endif /* !HAVE_MKTIME || !HAVE_TIMEGM */ +#if !HAVE_MKTIME static time_t time1( struct tm * tmp @@ -264,7 +273,7 @@ time1( if (tmp->tm_isdst > 1) tmp->tm_isdst = 1; - t = time2(tmp, &okay); + t = time2(tmp, &okay, 1); if (okay || tmp->tm_isdst < 0) return t; @@ -278,3 +287,22 @@ mktime( { return time1(tmp); } +#endif /* !HAVE_MKTIME */ + +#if !HAVE_TIMEGM +time_t +timegm( + struct tm * tmp + ) +{ + register time_t t; + int okay; + + tmp->tm_isdst = 0; + t = time2(tmp, &okay, 0); + if (okay || tmp->tm_isdst < 0) + return t; + + return WRONG; +} +#endif /* !HAVE_TIMEGM */ diff --git a/dist/ntp/libntp/modetoa.c b/dist/ntp/libntp/modetoa.c index fef8934b4122..5e966d67728b 100644 --- a/dist/ntp/libntp/modetoa.c +++ b/dist/ntp/libntp/modetoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: modetoa.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: modetoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * modetoa - return an asciized mode diff --git a/dist/ntp/libntp/mstolfp.c b/dist/ntp/libntp/mstolfp.c index a2f2613f5739..44edc8ed408f 100644 --- a/dist/ntp/libntp/mstolfp.c +++ b/dist/ntp/libntp/mstolfp.c @@ -1,4 +1,4 @@ -/* $NetBSD: mstolfp.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: mstolfp.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * mstolfp - convert an ascii string in milliseconds to an l_fp number diff --git a/dist/ntp/libntp/msutotsf.c b/dist/ntp/libntp/msutotsf.c index 899bc7ea148e..41cdcd0c759b 100644 --- a/dist/ntp/libntp/msutotsf.c +++ b/dist/ntp/libntp/msutotsf.c @@ -1,4 +1,4 @@ -/* $NetBSD: msutotsf.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: msutotsf.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * msutotsf - tables for converting from a subsecond millisecond value diff --git a/dist/ntp/libntp/msyslog.c b/dist/ntp/libntp/msyslog.c index d48951346696..0d95819e9824 100644 --- a/dist/ntp/libntp/msyslog.c +++ b/dist/ntp/libntp/msyslog.c @@ -1,4 +1,4 @@ -/* $NetBSD: msyslog.c,v 1.2 2000/10/09 14:57:21 is Exp $ */ +/* $NetBSD: msyslog.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * msyslog - either send a message to the terminal or print it on @@ -22,10 +22,11 @@ #include "ntp_types.h" #include "ntp_string.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #ifdef SYS_WINNT +# include # include "..\ports\winnt\libntp\log.h" # include "..\ports\winnt\libntp\messages.h" #endif @@ -37,16 +38,97 @@ FILE *syslog_file = NULL; u_long ntp_syslogmask = ~ (u_long) 0; #ifdef SYS_WINNT -HANDLE hEventSource; -LPTSTR lpszStrings[1]; -static WORD event_type[] = { - EVENTLOG_ERROR_TYPE, EVENTLOG_ERROR_TYPE, EVENTLOG_ERROR_TYPE, EVENTLOG_ERROR_TYPE, - EVENTLOG_WARNING_TYPE, - EVENTLOG_INFORMATION_TYPE, EVENTLOG_INFORMATION_TYPE, EVENTLOG_INFORMATION_TYPE, -}; +static char separator = '\\'; +#else +static char separator = '/'; #endif /* SYS_WINNT */ extern char *progname; +/* Declare the local functions */ +void addto_syslog P((int, char *)); +void format_errmsg P((char *, int, const char *, int)); + + +/* + * This routine adds the contents of a buffer to the log + */ +void +addto_syslog(int level, char * buf) +{ + char *prog; + FILE *out_file = syslog_file; + +#if !defined(VMS) && !defined (SYS_VXWORKS) + if (syslogit) + syslog(level, "%s", buf); + else +#endif /* VMS && SYS_VXWORKS*/ + { + out_file = syslog_file ? syslog_file: level <= LOG_ERR ? stderr : stdout; + /* syslog() provides the timestamp, so if we're not using + syslog, we must provide it. */ + prog = strrchr(progname, separator); + if (prog == NULL) + prog = progname; + else + prog++; + (void) fprintf(out_file, "%s ", humanlogtime ()); + (void) fprintf(out_file, "%s[%d]: %s", prog, (int)getpid(), buf); + fflush (out_file); + } +#if DEBUG + if (debug && out_file != stdout && out_file != stderr) + printf("addto_syslog: %s\n", buf); +#endif +} +void +format_errmsg(char *nfmt, int lennfmt, const char *fmt, int errval) +{ + register char c; + register char *n; + register const char *f; + + char *err; + + n = nfmt; + f = fmt; + while ((c = *f++) != '\0' && n < (nfmt+lennfmt - 2)) { + if (c != '%') { + *n++ = c; + continue; + } + if ((c = *f++) != 'm') { + *n++ = '%'; + *n++ = c; + continue; + } + err = 0; + err = strerror(errval); + /* Make sure we have enough space for the error message */ + if ((n + strlen(err)) < (nfmt + lennfmt -2)) { + strcpy(n, err); + n += strlen(err); + } + } +#if !defined(VMS) + if (!syslogit) +#endif /* VMS */ + *n++ = '\n'; + *n = '\0'; +} + +/* + * The externally called functions are defined here + * but share the internal function above to fetch + * any error message strings, This is done so that we can + * have two different functions to perform the logging + * since Windows gets it's error information from different + * places depending on whether or not it's network I/O. + * msyslog() is for general use while netsyslog() is for + * network I/O functions. They are virtually identical + * in implementation. + */ + #if defined(__STDC__) || defined(HAVE_STDARG_H) void msyslog(int level, const char *fmt, ...) #else /* defined(__STDC__) || defined(HAVE_STDARG_H) */ @@ -62,18 +144,15 @@ void msyslog(int level, const char *fmt, ...) #endif va_list ap; char buf[1025], nfmt[256]; -#if !defined(VMS) - char xerr[50]; + + /* + * Save the error value as soon as possible + */ +#ifdef SYS_WINNT + int errval = GetLastError(); +#else + int errval = errno; #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; #if defined(__STDC__) || defined(HAVE_STDARG_H) va_start(ap, fmt); @@ -83,91 +162,48 @@ void msyslog(int level, const char *fmt, ...) level = va_arg(ap, int); fmt = va_arg(ap, char *); #endif + format_errmsg(nfmt, sizeof(nfmt), fmt, errval); - olderrno = errno; - n = nfmt; - f = fmt; - while ((c = *f++) != '\0' && c != '\n' && n < &nfmt[252]) { - if (c != '%') { - *n++ = c; - continue; - } - if ((c = *f++) != 'm') { - *n++ = '%'; - *n++ = c; - 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) - err = strerror(olderrno); -#else /* SYS_WINNT */ - err = xerr; - FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - (LPTSTR) err, - sizeof(xerr), - NULL); - -#endif /* VMS && SYS_WINNT */ - if ((n + strlen(err)) < &nfmt[254]) { - strcpy(n, err); - n += strlen(err); - } - } -#if !defined(VMS) - if (!syslogit) -#endif /* VMS */ - *n++ = '\n'; - *n = '\0'; - - fmt = nfmt; - vsprintf(buf, fmt, ap); -#if !defined(VMS) && !defined (SYS_VXWORKS) - if (syslogit) -#ifndef SYS_WINNT - syslog(level, "%s", buf); -#else - { - lpszStrings[0] = buf; - - switch (event_type[level]) - { - case EVENTLOG_ERROR_TYPE: - reportAnEEvent(NTP_ERROR,1,lpszStrings); - break; - case EVENTLOG_INFORMATION_TYPE: - reportAnIEvent(NTP_INFO,1,lpszStrings); - break; - case EVENTLOG_WARNING_TYPE: - reportAnWEvent(NTP_WARNING,1,lpszStrings); - break; - } /* switch end */ - - } -#endif /* SYS_WINNT */ - else -#endif /* VMS && SYS_VXWORKS*/ - { - FILE *out_file = syslog_file ? syslog_file - : level <= LOG_ERR ? stderr : stdout; - /* syslog() provides the timestamp, so if we're not using - syslog, we must provide it. */ - prog = strrchr(progname, '/'); - if (prog == NULL) - prog = progname; - else - prog++; - (void) fprintf(out_file, "%s ", humanlogtime ()); - (void) fprintf(out_file, "%s[%d]: %s", prog, (int)getpid(), buf); - fflush (out_file); - } + vsnprintf(buf, sizeof(buf), nfmt, ap); + addto_syslog(level, buf); + va_end(ap); +} +#if defined(__STDC__) || defined(HAVE_STDARG_H) +void netsyslog(int level, const char *fmt, ...) +#else /* defined(__STDC__) || defined(HAVE_STDARG_H) */ + /*VARARGS*/ + void netsyslog(va_alist) + va_dcl +#endif /* defined(__STDC__) || defined(HAVE_STDARG_H) */ +{ +#if defined(__STDC__) || defined(HAVE_STDARG_H) +#else + int level; + const char *fmt; +#endif + va_list ap; + char buf[1025], nfmt[256]; + + /* + * Save the error value as soon as possible + */ +#ifdef SYS_WINNT + int errval = WSAGetLastError(); +#else + int errval = errno; +#endif + +#if defined(__STDC__) || defined(HAVE_STDARG_H) + va_start(ap, fmt); +#else + va_start(ap); + + level = va_arg(ap, int); + fmt = va_arg(ap, char *); +#endif + format_errmsg(nfmt, sizeof(nfmt), fmt, errval); + + vsnprintf(buf, sizeof(buf), nfmt, ap); + addto_syslog(level, buf); va_end(ap); } diff --git a/dist/ntp/libntp/netof.c b/dist/ntp/libntp/netof.c index d0d8df1da96e..ac02bac74d6d 100644 --- a/dist/ntp/libntp/netof.c +++ b/dist/ntp/libntp/netof.c @@ -1,4 +1,4 @@ -/* $NetBSD: netof.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: netof.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * netof - return the net address part of an ip address in a sockaddr_storage structure diff --git a/dist/ntp/libntp/ntp_rfc2553.c b/dist/ntp/libntp/ntp_rfc2553.c index 0fbda59a6062..721fbe1056e3 100644 --- a/dist/ntp/libntp/ntp_rfc2553.c +++ b/dist/ntp/libntp/ntp_rfc2553.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_rfc2553.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: ntp_rfc2553.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. diff --git a/dist/ntp/libntp/numtoa.c b/dist/ntp/libntp/numtoa.c index 47f3f6c985b8..548b0cb72d3a 100644 --- a/dist/ntp/libntp/numtoa.c +++ b/dist/ntp/libntp/numtoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: numtoa.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: numtoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * numtoa - return asciized network numbers store in local array space diff --git a/dist/ntp/libntp/numtohost.c b/dist/ntp/libntp/numtohost.c index 28212ef6b455..0f58575b1ef0 100644 --- a/dist/ntp/libntp/numtohost.c +++ b/dist/ntp/libntp/numtohost.c @@ -1,4 +1,4 @@ -/* $NetBSD: numtohost.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: numtohost.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * numtohost - convert network number to host name. diff --git a/dist/ntp/libntp/octtoint.c b/dist/ntp/libntp/octtoint.c index 7755c8f79ec4..d953796f9368 100644 --- a/dist/ntp/libntp/octtoint.c +++ b/dist/ntp/libntp/octtoint.c @@ -1,4 +1,4 @@ -/* $NetBSD: octtoint.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: octtoint.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * octtoint - convert an ascii string in octal to an unsigned diff --git a/dist/ntp/libntp/prettydate.c b/dist/ntp/libntp/prettydate.c index 5fbbcb9c8c18..fa7ffcb3f5bc 100644 --- a/dist/ntp/libntp/prettydate.c +++ b/dist/ntp/libntp/prettydate.c @@ -1,4 +1,4 @@ -/* $NetBSD: prettydate.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: prettydate.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * prettydate - convert a time stamp to something readable diff --git a/dist/ntp/libntp/random.c b/dist/ntp/libntp/random.c index dcc59b1740f3..6f31d1375c44 100644 --- a/dist/ntp/libntp/random.c +++ b/dist/ntp/libntp/random.c @@ -1,4 +1,4 @@ -/* $NetBSD: random.c,v 1.2 2003/08/07 09:21:11 agc Exp $ */ +/* $NetBSD: random.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * Copyright (c) 1983, 1993 @@ -12,7 +12,11 @@ * 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. Neither the name of the University nor the names of its contributors + * 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. * diff --git a/dist/ntp/libntp/ranny.c b/dist/ntp/libntp/ranny.c index 32b103bbb8bb..3b58f26bf3f6 100644 --- a/dist/ntp/libntp/ranny.c +++ b/dist/ntp/libntp/ranny.c @@ -1,4 +1,4 @@ -/* $NetBSD: ranny.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: ranny.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * Random number generator is: diff --git a/dist/ntp/libntp/recvbuff.c b/dist/ntp/libntp/recvbuff.c index 102fcb80e260..78cf0abca163 100644 --- a/dist/ntp/libntp/recvbuff.c +++ b/dist/ntp/libntp/recvbuff.c @@ -1,4 +1,4 @@ -/* $NetBSD: recvbuff.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: recvbuff.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #ifdef HAVE_CONFIG_H # include diff --git a/dist/ntp/libntp/refnumtoa.c b/dist/ntp/libntp/refnumtoa.c index 526ba918f5c3..a15e693aa662 100644 --- a/dist/ntp/libntp/refnumtoa.c +++ b/dist/ntp/libntp/refnumtoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: refnumtoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: refnumtoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refnumtoa - return asciized refclock addresses stored in local array space diff --git a/dist/ntp/libntp/snprintf.c b/dist/ntp/libntp/snprintf.c index 4987be6caad3..d3ccc226f6dd 100644 --- a/dist/ntp/libntp/snprintf.c +++ b/dist/ntp/libntp/snprintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: snprintf.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: snprintf.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #include diff --git a/dist/ntp/libntp/socktoa.c b/dist/ntp/libntp/socktoa.c index 9e0bc40909d6..3868e9f214a4 100644 --- a/dist/ntp/libntp/socktoa.c +++ b/dist/ntp/libntp/socktoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: socktoa.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: socktoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * socktoa - return a numeric host name from a sockaddr_storage structure diff --git a/dist/ntp/libntp/socktohost.c b/dist/ntp/libntp/socktohost.c index d6d890960e26..3b08d551fbe9 100644 --- a/dist/ntp/libntp/socktohost.c +++ b/dist/ntp/libntp/socktohost.c @@ -1,4 +1,4 @@ -/* $NetBSD: socktohost.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: socktohost.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * socktoa - return a numeric host name from a sockaddr_storage structure diff --git a/dist/ntp/libntp/statestr.c b/dist/ntp/libntp/statestr.c index 5af735d984bd..c6fa0166ea6c 100644 --- a/dist/ntp/libntp/statestr.c +++ b/dist/ntp/libntp/statestr.c @@ -1,4 +1,4 @@ -/* $NetBSD: statestr.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: statestr.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * pretty printing of status information diff --git a/dist/ntp/libntp/strdup.c b/dist/ntp/libntp/strdup.c index b8bb055e6e1f..659b023402ee 100644 --- a/dist/ntp/libntp/strdup.c +++ b/dist/ntp/libntp/strdup.c @@ -1,4 +1,4 @@ -/* $NetBSD: strdup.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: strdup.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #include "ntp_malloc.h" diff --git a/dist/ntp/libntp/strerror.c b/dist/ntp/libntp/strerror.c index c82215ead145..af57b7b5a4ea 100644 --- a/dist/ntp/libntp/strerror.c +++ b/dist/ntp/libntp/strerror.c @@ -1,4 +1,4 @@ -/* $NetBSD: strerror.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: strerror.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #include diff --git a/dist/ntp/libntp/strstr.c b/dist/ntp/libntp/strstr.c index f68f1d402a60..b507699c22e4 100644 --- a/dist/ntp/libntp/strstr.c +++ b/dist/ntp/libntp/strstr.c @@ -1,4 +1,4 @@ -/* $NetBSD: strstr.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: strstr.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #include @@ -31,7 +31,7 @@ * University of Maryland at College Park */ /* - * $Id: strstr.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ + * $Id: strstr.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ * * replacement for missing ANSI-C strstr function */ diff --git a/dist/ntp/libntp/syssignal.c b/dist/ntp/libntp/syssignal.c index 8c639fbea067..46eebbe8ea0a 100644 --- a/dist/ntp/libntp/syssignal.c +++ b/dist/ntp/libntp/syssignal.c @@ -1,4 +1,4 @@ -/* $NetBSD: syssignal.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: syssignal.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #ifdef HAVE_CONFIG_H # include diff --git a/dist/ntp/libntp/systime.c b/dist/ntp/libntp/systime.c index f0702dc2d12d..97f35421f4a7 100644 --- a/dist/ntp/libntp/systime.c +++ b/dist/ntp/libntp/systime.c @@ -1,16 +1,21 @@ -/* $NetBSD: systime.c,v 1.2 2000/04/22 15:49:31 simonb Exp $ */ +/* $NetBSD: systime.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * systime -- routines to fiddle a UNIX clock. + * + * ATTENTION: Get approval from Dave Mills on all changes to this file! + * */ +#include "ntp_machine.h" +#include "ntp_fp.h" +#include "ntp_syslog.h" +#include "ntp_unixtime.h" +#include "ntp_stdlib.h" -#ifdef HAVE_CONFIG_H -# include -#endif +#ifdef SIM +#include "ntpsim.h" +#endif /*SIM */ -#include -#include -#include #ifdef HAVE_SYS_PARAM_H # include #endif @@ -21,158 +26,123 @@ # include #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 - * bits of NTP and the peculiarities of dealing with the Unix system - * clock. + * These routines (get_systime, step_systime, adj_systime) implement an + * interface between the system independent NTP clock and the Unix + * system clock in various architectures and operating systems. + * + * Time is a precious quantity in these routines and every effort is + * made to minimize errors by always rounding toward zero and amortizing + * adjustment residues. By default the adjustment quantum is 1 us for + * the usual Unix tickadj() system call, but this can be increased if + * necessary by a configuration command. For instance, when the + * adjtime() quantum is a clock tick for a 100-Hz clock, the quantum + * should be 10 ms. */ -double sys_residual = 0; /* residual from previous adjustment */ -double sys_maxfreq = MAXFREQ; /* max frequency correction */ +double sys_tick = 1e-6; /* tickadj() quantum (s) */ +double sys_residual = 0; /* adjustment residue (s) */ +#ifndef SIM /* - * get_systime - return the system time in timestamp format biased by - * the current time offset. + * get_systime - return system time in NTP timestamp format. */ void get_systime( - l_fp *now + l_fp *now /* system time */ ) { -#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_GETCLOCK) - struct timespec ts; -#else - struct timeval tv; -#endif double dtemp; - /* - * We use nanosecond time if we can get it. Watch out for - * rounding wiggles, which may overflow the fraction. - */ #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_GETCLOCK) + struct timespec ts; /* seconds and nanoseconds */ + + /* + * Convert Unix clock from seconds and nanoseconds to seconds. + */ # ifdef HAVE_CLOCK_GETTIME - (void) clock_gettime(CLOCK_REALTIME, &ts); + clock_gettime(CLOCK_REALTIME, &ts); # else - (void) getclock(TIMEOFDAY, &ts); + getclock(TIMEOFDAY, &ts); # endif now->l_i = ts.tv_sec + JAN_1970; - dtemp = ts.tv_nsec * FRAC / 1e9; - if (dtemp >= FRAC) - now->l_i++; - now->l_uf = (u_int32)dtemp; -#else /* HAVE_CLOCK_GETTIME */ - (void) GETTIMEOFDAY(&tv, (struct timezone *)0); + dtemp = ts.tv_nsec / 1e9; + +#else /* HAVE_CLOCK_GETTIME || HAVE_GETCLOCK */ + struct timeval tv; /* seconds and microseconds */ + + /* + * Convert Unix clock from seconds and microseconds to seconds. + */ + GETTIMEOFDAY(&tv, NULL); now->l_i = tv.tv_sec + JAN_1970; + dtemp = tv.tv_usec / 1e6; -#if defined RELIANTUNIX_CLOCK || defined SCO5_CLOCK - if (systime_10ms_ticks) { - /* fake better than 10ms resolution by interpolating - accumulated residual (in adj_systime(), see below) */ - dtemp = tv.tv_usec / 1e6; - if (sys_residual < 5000e-6 && sys_residual > -5000e-6) { - dtemp += sys_residual; - if (dtemp < 0) { - now->l_i--; - dtemp++; - } - } - dtemp *= FRAC; - } else -#endif +#endif /* HAVE_CLOCK_GETTIME || HAVE_GETCLOCK */ - dtemp = tv.tv_usec * FRAC / 1e6; - - if (dtemp >= FRAC) + /* + * Renormalize to seconds past 1900 and fraction. + */ + dtemp += sys_residual; + if (dtemp >= 1) { + dtemp -= 1; now->l_i++; + } else if (dtemp < -1) { + dtemp += 1; + now->l_i--; + } + dtemp *= FRAC; now->l_uf = (u_int32)dtemp; -#endif /* HAVE_CLOCK_GETTIME */ - } /* - * adj_systime - called once every second to make system time adjustments. - * Returns 1 if okay, 0 if trouble. + * adj_systime - adjust system time by the argument. */ #if !defined SYS_WINNT -int +int /* 0 okay, 1 error */ adj_systime( - double now + double now /* adjustment (s) */ ) { - double dtemp; - struct timeval adjtv; - u_char isneg = 0; - struct timeval oadjtv; + struct timeval adjtv; /* new adjustment */ + struct timeval oadjtv; /* residual adjustment */ + double dtemp; + long ticks; + int isneg = 0; /* - * Add the residual from the previous adjustment to the new - * adjustment, bound and round. + * Most Unix adjtime() implementations adjust the system clock + * in microsecond quanta, but some adjust in 10-ms quanta. We + * carefully round the adjustment to the nearest quantum, then + * adjust in quanta and keep the residue for later. */ - dtemp = sys_residual + now; - sys_residual = 0; + dtemp = now + sys_residual; if (dtemp < 0) { isneg = 1; dtemp = -dtemp; } - -#if defined RELIANTUNIX_CLOCK || defined SCO5_CLOCK - if (systime_10ms_ticks) { - /* accumulate changes until we have enough to adjust a tick */ - if (dtemp < 5000e-6) { - if (isneg) sys_residual = -dtemp; - else sys_residual = dtemp; - dtemp = 0; - } else { - if (isneg) sys_residual = 10000e-6 - dtemp; - else sys_residual = dtemp - 10000e-6; - dtemp = 10000e-6; - } - } else -#endif - if (dtemp > sys_maxfreq) - dtemp = sys_maxfreq; - - dtemp = dtemp * 1e6 + .5; - - if (isneg) - dtemp = -dtemp; - adjtv.tv_sec = 0; - adjtv.tv_usec = (int32)dtemp; + adjtv.tv_sec = (long)dtemp; + dtemp -= adjtv.tv_sec; + ticks = (long)(dtemp / sys_tick + .5); + adjtv.tv_usec = (long)(ticks * sys_tick * 1e6); + dtemp -= adjtv.tv_usec / 1e6; + sys_residual = dtemp; /* - * Here we do the actual adjustment. If for some reason the adjtime() - * call fails, like it is not implemented or something like that, - * we honk to the log. If the previous adjustment did not complete, - * we correct the residual offset. + * Convert to signed seconds and microseconds for the Unix + * adjtime() system call. Note we purposely lose the adjtime() + * leftover. */ - /* casey - we need a posix type thang here */ - if (adjtime(&adjtv, &oadjtv) < 0) - { - msyslog(LOG_ERR, "Can't adjust time (%ld sec, %ld usec): %m", - (long)adjtv.tv_sec, (long)adjtv.tv_usec); - return 0; - } - else { - sys_residual += oadjtv.tv_usec / 1e6; + if (isneg) { + adjtv.tv_sec = -adjtv.tv_sec; + adjtv.tv_usec = -adjtv.tv_usec; } -#ifdef DEBUG - if (debug > 6) - printf("adj_systime: adj %.9f -> remaining residual %.9f\n", now, sys_residual); -#endif - return 1; + if (adjtime(&adjtv, &oadjtv) < 0) { + msyslog(LOG_ERR, "adj_systime: %m"); + return (0); + } + return (1); } #endif @@ -197,12 +167,12 @@ step_systime( isneg = 1; dtemp = - dtemp; adjtv.tv_sec = (int32)dtemp; - adjtv.tv_usec = (u_int32)((dtemp - (double)adjtv.tv_sec) * - 1e6 + .5); + adjtv.tv_usec = (u_int32)((dtemp - + (double)adjtv.tv_sec) * 1e6 + .5); } else { adjtv.tv_sec = (int32)dtemp; - adjtv.tv_usec = (u_int32)((dtemp - (double)adjtv.tv_sec) * - 1e6 + .5); + adjtv.tv_usec = (u_int32)((dtemp - + (double)adjtv.tv_sec) * 1e6 + .5); } #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_GETCLOCK) #ifdef HAVE_CLOCK_GETTIME @@ -237,8 +207,8 @@ step_systime( timetv.tv_usec -= 1000000; } } - if (ntp_set_tod(&timetv, (struct timezone *)0) != 0) { - msyslog(LOG_ERR, "Can't set time of day: %m"); + if (ntp_set_tod(&timetv, NULL) != 0) { + msyslog(LOG_ERR, "step-systime: %m"); return (0); } sys_residual = 0; @@ -266,8 +236,8 @@ step_systime( */ /* - * Write old and new time entries in utmp and wtmp if step adjustment - * is greater than one second. + * Write old and new time entries in utmp and wtmp if step + * adjustment is greater than one second. * * This might become even Uglier... */ @@ -369,3 +339,185 @@ step_systime( } return (1); } + +#else /* SIM */ +/* + * Clock routines for the simulator - Harish Nair, with help + */ +/* + * get_systime - return the system time in NTP timestamp format + */ +void +get_systime( + l_fp *now /* current system time in l_fp */ ) +{ + /* + * To fool the code that determines the local clock precision, + * we advance the clock a minimum of 200 nanoseconds on every + * clock read. This is appropriate for a typical modern machine + * with nanosecond clocks. Note we make no attempt here to + * simulate reading error, since the error is so small. This may + * change when the need comes to implement picosecond clocks. + */ + if (ntp_node.ntp_time == ntp_node.last_time) + ntp_node.ntp_time += 200e-9; + ntp_node.last_time = ntp_node.ntp_time; + DTOLFP(ntp_node.ntp_time, now); +} + + +/* + * adj_systime - advance or retard the system clock exactly like the + * real thng. + */ +int /* always succeeds */ +adj_systime( + double now /* time adjustment (s) */ + ) +{ + struct timeval adjtv; /* new adjustment */ + double dtemp; + long ticks; + int isneg = 0; + + /* + * Most Unix adjtime() implementations adjust the system clock + * in microsecond quanta, but some adjust in 10-ms quanta. We + * carefully round the adjustment to the nearest quantum, then + * adjust in quanta and keep the residue for later. + */ + dtemp = now + sys_residual; + if (dtemp < 0) { + isneg = 1; + dtemp = -dtemp; + } + adjtv.tv_sec = (long)dtemp; + dtemp -= adjtv.tv_sec; + ticks = (long)(dtemp / sys_tick + .5); + adjtv.tv_usec = (long)(ticks * sys_tick * 1e6); + dtemp -= adjtv.tv_usec / 1e6; + sys_residual = dtemp; + + /* + * Convert to signed seconds and microseconds for the Unix + * adjtime() system call. Note we purposely lose the adjtime() + * leftover. + */ + if (isneg) { + adjtv.tv_sec = -adjtv.tv_sec; + adjtv.tv_usec = -adjtv.tv_usec; + sys_residual = -sys_residual; + } + + /* + * We went to all the trouble just to be sure the emulation is + * precise. We now return to our regularly scheduled concert. + */ + ntp_node.clk_time -= adjtv.tv_sec + adjtv.tv_usec / 1e6; + return (1); +} + + +/* + * step_systime - step the system clock. We are religious here. + */ +int /* always succeeds */ +step_systime( + double now /* step adjustment (s) */ + ) +{ + ntp_node.adj = now; + return (1); +} + +/* + * node_clock - update the clocks + */ +int /* always succeeds */ +node_clock( + Node *n, /* global node pointer */ + double t /* node time */ + ) +{ + double dtemp; + + /* + * Advance client clock (ntp_time). Advance server clock + * (clk_time) adjusted for systematic and random frequency + * errors. The random error is a random walk computed as the + * integral of samples from a Gaussian distribution. + */ + dtemp = t - n->ntp_time; + n->time = t; + n->ntp_time += dtemp; + n->ferr += gauss(0, dtemp * n->fnse); + n->clk_time += dtemp * (1 + n->ferr); + + /* + * Perform the adjtime() function. If the adjustment completed + * in the previous interval, amortize the entire amount; if not, + * carry the leftover to the next interval. + */ + dtemp *= n->slew; + if (dtemp < fabs(n->adj)) { + if (n->adj < 0) { + n->adj += dtemp; + n->ntp_time -= dtemp; + } else { + n->adj -= dtemp; + n->ntp_time += dtemp; + } + } else { + n->ntp_time += n->adj; + n->adj = 0; + } + return (0); +} + + +/* + * gauss() - returns samples from a gaussion distribution + */ +double /* Gaussian sample */ +gauss( + double m, /* sample mean */ + double s /* sample standard deviation (sigma) */ + ) +{ + double q1, q2; + + /* + * Roll a sample from a Gaussian distribution with mean m and + * standard deviation s. For m = 0, s = 1, mean(y) = 0, + * std(y) = 1. + */ + if (s == 0) + return (m); + while ((q1 = drand48()) == 0); + q2 = drand48(); + return (m + s * sqrt(-2. * log(q1)) * cos(2. * PI * q2)); +} + + +/* + * poisson() - returns samples from a network delay distribution + */ +double /* delay sample (s) */ +poisson( + double m, /* fixed propagation delay (s) */ + double s /* exponential parameter (mu) */ + ) +{ + double q1; + + /* + * Roll a sample from a composite distribution with propagation + * delay m and exponential distribution time with parameter s. + * For m = 0, s = 1, mean(y) = std(y) = 1. + */ + if (s == 0) + return (m); + while ((q1 = drand48()) == 0); + return (m - s * log(q1 * s)); +} +#endif /* SIM */ diff --git a/dist/ntp/libntp/systime_s.c b/dist/ntp/libntp/systime_s.c index 098575000b18..d3a4b1ec5726 100644 --- a/dist/ntp/libntp/systime_s.c +++ b/dist/ntp/libntp/systime_s.c @@ -1,4 +1,4 @@ -/* $NetBSD: systime_s.c,v 1.1.1.1 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: systime_s.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ #define SIM #include "systime.c" diff --git a/dist/ntp/libntp/tsftomsu.c b/dist/ntp/libntp/tsftomsu.c index af336765e885..9650d1bceb9f 100644 --- a/dist/ntp/libntp/tsftomsu.c +++ b/dist/ntp/libntp/tsftomsu.c @@ -1,4 +1,4 @@ -/* $NetBSD: tsftomsu.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: tsftomsu.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * tsftomsu - convert from a time stamp fraction to milliseconds diff --git a/dist/ntp/libntp/tstotv.c b/dist/ntp/libntp/tstotv.c index 42278d52a2dd..6e6d9b615fe7 100644 --- a/dist/ntp/libntp/tstotv.c +++ b/dist/ntp/libntp/tstotv.c @@ -1,4 +1,4 @@ -/* $NetBSD: tstotv.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: tstotv.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * tstotv - tables for converting from NTP time stamps to struct timeval diff --git a/dist/ntp/libntp/tvtoa.c b/dist/ntp/libntp/tvtoa.c index 4bfce7cb2bde..c98265f31f74 100644 --- a/dist/ntp/libntp/tvtoa.c +++ b/dist/ntp/libntp/tvtoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: tvtoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: tvtoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * tvtoa - return an asciized representation of a struct timeval diff --git a/dist/ntp/libntp/tvtots.c b/dist/ntp/libntp/tvtots.c index 7c85a54bfe6c..a0b13eafb4ed 100644 --- a/dist/ntp/libntp/tvtots.c +++ b/dist/ntp/libntp/tvtots.c @@ -1,4 +1,4 @@ -/* $NetBSD: tvtots.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: tvtots.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * tvtots - tables for converting from Unix struct timeval's to diff --git a/dist/ntp/libntp/uglydate.c b/dist/ntp/libntp/uglydate.c index 0d18981427f8..399d7ccc1771 100644 --- a/dist/ntp/libntp/uglydate.c +++ b/dist/ntp/libntp/uglydate.c @@ -1,4 +1,4 @@ -/* $NetBSD: uglydate.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: uglydate.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * uglydate - convert a time stamp to something barely readable diff --git a/dist/ntp/libntp/uinttoa.c b/dist/ntp/libntp/uinttoa.c index bec77d2279dc..a957472228fe 100644 --- a/dist/ntp/libntp/uinttoa.c +++ b/dist/ntp/libntp/uinttoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: uinttoa.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: uinttoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * uinttoa - return an asciized unsigned integer diff --git a/dist/ntp/libntp/utvtoa.c b/dist/ntp/libntp/utvtoa.c index 89d6d9b46823..964b10c95c31 100644 --- a/dist/ntp/libntp/utvtoa.c +++ b/dist/ntp/libntp/utvtoa.c @@ -1,4 +1,4 @@ -/* $NetBSD: utvtoa.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: utvtoa.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * utvtoa - return an asciized representation of an unsigned struct timeval diff --git a/dist/ntp/libntp/ymd2yd.c b/dist/ntp/libntp/ymd2yd.c index 2444d67ed131..d1c69426b9a9 100644 --- a/dist/ntp/libntp/ymd2yd.c +++ b/dist/ntp/libntp/ymd2yd.c @@ -1,4 +1,4 @@ -/* $NetBSD: ymd2yd.c,v 1.1.1.1 2000/03/29 12:38:50 simonb Exp $ */ +/* $NetBSD: ymd2yd.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ymd2yd - compute the date in the year from y/m/d diff --git a/dist/ntp/libparse/clk_computime.c b/dist/ntp/libparse/clk_computime.c index 0a7a0940ea98..8b8a055bc2d2 100644 --- a/dist/ntp/libparse/clk_computime.c +++ b/dist/ntp/libparse/clk_computime.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_computime.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_computime.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ #ifdef HAVE_CONFIG_H # include @@ -25,10 +25,6 @@ * */ - -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -143,7 +139,7 @@ inp_computime( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/clk_dcf7000.c b/dist/ntp/libparse/clk_dcf7000.c index 019359810784..b8b13d90672f 100644 --- a/dist/ntp/libparse/clk_dcf7000.c +++ b/dist/ntp/libparse/clk_dcf7000.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_dcf7000.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_dcf7000.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_dcf7000.c,v 4.6 1999/11/28 09:13:49 kardel RELEASE_19991128_A @@ -22,9 +22,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_DCF7000) -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -142,7 +139,7 @@ inp_dcf7000( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/clk_hopf6021.c b/dist/ntp/libparse/clk_hopf6021.c index dbb57df662fb..980732ff9391 100644 --- a/dist/ntp/libparse/clk_hopf6021.c +++ b/dist/ntp/libparse/clk_hopf6021.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_hopf6021.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_hopf6021.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_hopf6021.c,v 4.7 1999/11/28 09:13:49 kardel RELEASE_19991128_A @@ -24,9 +24,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_HOPF6021) -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -231,7 +228,7 @@ inp_hopf6021( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/clk_meinberg.c b/dist/ntp/libparse/clk_meinberg.c index 63ee6c204a03..e73a7e7cfff5 100644 --- a/dist/ntp/libparse/clk_meinberg.c +++ b/dist/ntp/libparse/clk_meinberg.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_meinberg.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_meinberg.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_meinberg.c,v 4.8 1999/11/28 09:13:50 kardel RELEASE_19991128_A @@ -22,9 +22,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_MEINBERG) -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -414,7 +411,7 @@ mbg_input( { unsigned int rtc; - parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { @@ -582,7 +579,7 @@ gps_input( msg_buf = (struct msg_buf *)parseio->parse_pdata; - parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); if (!msg_buf) return PARSE_INP_SKIP; diff --git a/dist/ntp/libparse/clk_rawdcf.c b/dist/ntp/libparse/clk_rawdcf.c index 9363b353ec7f..4c8d5e680654 100644 --- a/dist/ntp/libparse/clk_rawdcf.c +++ b/dist/ntp/libparse/clk_rawdcf.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_rawdcf.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_rawdcf.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_rawdcf.c,v 4.9 1999/12/06 13:42:23 kardel Exp @@ -22,9 +22,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_RAWDCF) -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -551,7 +548,7 @@ inp_rawdcf( { static struct timeval timeout = { 1, 500000 }; /* 1.5 secongs denote second #60 */ - parseprintf(DD_PARSE, ("inp_rawdcf(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, 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/dist/ntp/libparse/clk_rcc8000.c b/dist/ntp/libparse/clk_rcc8000.c index c61634b799bc..736cb4d70295 100644 --- a/dist/ntp/libparse/clk_rcc8000.c +++ b/dist/ntp/libparse/clk_rcc8000.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_rcc8000.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_rcc8000.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_rcc8000.c,v 4.6 1999/11/28 09:13:51 kardel RELEASE_19991128_A @@ -21,9 +21,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_RCC8000) -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -145,7 +142,7 @@ inp_rcc8000( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/clk_schmid.c b/dist/ntp/libparse/clk_schmid.c index a199f873abd2..5b71ad1a8bbe 100644 --- a/dist/ntp/libparse/clk_schmid.c +++ b/dist/ntp/libparse/clk_schmid.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_schmid.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_schmid.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_schmid.c,v 4.5 1999/11/28 09:13:51 kardel RELEASE_19991128_A @@ -22,9 +22,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_SCHMID) -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -189,7 +186,7 @@ inp_schmid( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/clk_trimtaip.c b/dist/ntp/libparse/clk_trimtaip.c index 58e405b7923f..8159385d2822 100644 --- a/dist/ntp/libparse/clk_trimtaip.c +++ b/dist/ntp/libparse/clk_trimtaip.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_trimtaip.c,v 1.2 2001/04/21 21:57:16 thorpej Exp $ */ +/* $NetBSD: clk_trimtaip.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_trimtaip.c,v 4.7 1999/11/28 09:13:51 kardel RELEASE_19991128_A @@ -13,8 +13,6 @@ #endif #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_TRIMTAIP) -#include -#include #include "ntp_fp.h" #include "ntp_unixtime.h" @@ -130,7 +128,7 @@ inp_trimtaip( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/clk_trimtsip.c b/dist/ntp/libparse/clk_trimtsip.c index 911925dad4b9..221606fe78db 100644 --- a/dist/ntp/libparse/clk_trimtsip.c +++ b/dist/ntp/libparse/clk_trimtsip.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_trimtsip.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: clk_trimtsip.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_trimtsip.c,v 4.13 1999/11/28 09:13:51 kardel RELEASE_19991128_A diff --git a/dist/ntp/libparse/clk_varitext.c b/dist/ntp/libparse/clk_varitext.c index 9b30217fa354..8c684bc74811 100644 --- a/dist/ntp/libparse/clk_varitext.c +++ b/dist/ntp/libparse/clk_varitext.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_varitext.c,v 1.3 2002/04/09 02:42:50 thorpej Exp $ */ +/* $NetBSD: clk_varitext.c,v 1.4 2003/12/04 16:23:37 drochner Exp $ */ #ifdef HAVE_CONFIG_H # include @@ -21,9 +21,6 @@ * */ -#include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -31,19 +28,19 @@ #include "parse.h" #ifndef PARSESTREAM -#include "ntp_stdlib.h" -#include +# include "ntp_stdlib.h" +# include #else -#include "sys/parsestreams.h" +# include "sys/parsestreams.h" extern void printf P((const char *, ...)); #endif -#define VT_INITIALISED 0x01 -#define VT_SYNCHRONISED 0x02 -#define VT_ALARM_STATE 0x04 -#define VT_BST 0x08 -#define VT_SEASON_CHANGE 0x10 -#define VT_LAST_TELEGRAM_OK 0x20 +static const u_char VT_INITIALISED = 0x01; +static const u_char VT_SYNCHRONISED = 0x02; +static const u_char VT_ALARM_STATE = 0x04; +static const u_char VT_BST = 0x08; +static const u_char VT_SEASON_CHANGE = 0x10; +static const u_char VT_LAST_TELEGRAM_OK = 0x20; /* * The Varitext receiver sends a datagram in the following format every minute @@ -149,7 +146,7 @@ cvt_varitext( clock_time->utcoffset = -1*60*60; clock_time->flags |= PARSEB_DST; } -#if 0 + /* if (!((*f) & VT_INITIALISED)) Clock not initialised clock_time->flags |= PARSEB_POWERUP; @@ -158,7 +155,7 @@ cvt_varitext( if (((*f) & VT_SEASON_CHANGE)) Seasonal change expected in the next hour clock_time->flags |= PARSEB_ANNOUNCE; -#endif + */ return CVT_OK; } } @@ -174,7 +171,7 @@ inp_varitext( struct varitext *t = (struct varitext *)parseio->parse_pdata; int rtc; - parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, 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/dist/ntp/libparse/clk_wharton.c b/dist/ntp/libparse/clk_wharton.c index 5cd7642de6b5..e88af01ba4c3 100644 --- a/dist/ntp/libparse/clk_wharton.c +++ b/dist/ntp/libparse/clk_wharton.c @@ -1,4 +1,4 @@ -/* $NetBSD: clk_wharton.c,v 1.2 2001/04/21 21:57:17 thorpej Exp $ */ +/* $NetBSD: clk_wharton.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/clk_wharton.c,v 4.1 1999/02/28 15:27:24 kardel RELEASE_19990228_A @@ -136,7 +136,7 @@ inp_wharton_400a( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_wharton_400a(0x%lx, 0x%x, ...)\n", (unsigned long)parseio, ch)); + parseprintf(DD_PARSE, ("inp_wharton_400a(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/dist/ntp/libparse/data_mbg.c b/dist/ntp/libparse/data_mbg.c index 9989606c2db1..d593cf9aeb71 100644 --- a/dist/ntp/libparse/data_mbg.c +++ b/dist/ntp/libparse/data_mbg.c @@ -1,4 +1,4 @@ -/* $NetBSD: data_mbg.c,v 1.1.1.1 2000/03/29 12:38:51 simonb Exp $ */ +/* $NetBSD: data_mbg.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/data_mbg.c,v 4.3 1999/02/21 12:17:42 kardel RELEASE_19991128_A diff --git a/dist/ntp/libparse/info_trimble.c b/dist/ntp/libparse/info_trimble.c index 7e09fbbbf813..604f3c65b3b7 100644 --- a/dist/ntp/libparse/info_trimble.c +++ b/dist/ntp/libparse/info_trimble.c @@ -1,4 +1,4 @@ -/* $NetBSD: info_trimble.c,v 1.1.1.1 2000/03/29 12:38:51 simonb Exp $ */ +/* $NetBSD: info_trimble.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * Automatically generated - do not modify diff --git a/dist/ntp/libparse/parse.c b/dist/ntp/libparse/parse.c index 946f4a85e4a9..31133cdc68ef 100644 --- a/dist/ntp/libparse/parse.c +++ b/dist/ntp/libparse/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: parse.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/parse.c,v 4.14 1999/11/28 09:13:52 kardel RELEASE_19991128_A diff --git a/dist/ntp/libparse/parse_conf.c b/dist/ntp/libparse/parse_conf.c index 4469e8f6be38..8a7623d1c6f7 100644 --- a/dist/ntp/libparse/parse_conf.c +++ b/dist/ntp/libparse/parse_conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse_conf.c,v 1.1.1.2 2003/12/04 16:05:24 drochner Exp $ */ +/* $NetBSD: parse_conf.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/parse_conf.c,v 4.5 1999/11/28 09:13:53 kardel RELEASE_19991128_A diff --git a/dist/ntp/libparse/parsesolaris.c b/dist/ntp/libparse/parsesolaris.c index 05e7bd70ca35..97c3d41a2087 100644 --- a/dist/ntp/libparse/parsesolaris.c +++ b/dist/ntp/libparse/parsesolaris.c @@ -1,4 +1,4 @@ -/* $NetBSD: parsesolaris.c,v 1.1.1.2 2003/12/04 16:05:25 drochner Exp $ */ +/* $NetBSD: parsesolaris.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/parsesolaris.c,v 4.6 1998/11/15 21:56:08 kardel RELEASE_19991128_A diff --git a/dist/ntp/libparse/parsestreams.c b/dist/ntp/libparse/parsestreams.c index ee36404756b9..46b290b8e5db 100644 --- a/dist/ntp/libparse/parsestreams.c +++ b/dist/ntp/libparse/parsestreams.c @@ -1,4 +1,4 @@ -/* $NetBSD: parsestreams.c,v 1.1.1.1 2000/03/29 12:38:52 simonb Exp $ */ +/* $NetBSD: parsestreams.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/parsestreams.c,v 4.7 1999/11/28 09:13:53 kardel RELEASE_19991128_A diff --git a/dist/ntp/libparse/trim_info.c b/dist/ntp/libparse/trim_info.c index f730b0b48c66..128b6e5476a8 100644 --- a/dist/ntp/libparse/trim_info.c +++ b/dist/ntp/libparse/trim_info.c @@ -1,4 +1,4 @@ -/* $NetBSD: trim_info.c,v 1.1.1.1 2000/03/29 12:38:51 simonb Exp $ */ +/* $NetBSD: trim_info.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/libparse/trim_info.c,v 4.2 1998/12/20 23:45:31 kardel RELEASE_19990228_A diff --git a/dist/ntp/librsaref/Makefile.am b/dist/ntp/librsaref/Makefile.am deleted file mode 100644 index 9a2bb04682d3..000000000000 --- a/dist/ntp/librsaref/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies -#AUTOMAKE_OPTIONS = ../util/ansi2knr -noinst_LIBRARIES = @MAKE_LIBRSAREF@ -EXTRA_LIBRARIES = librsaref.a -CLEANFILES = $(EXTRA_LIBRARIES) - -# NOTES: -# don't use RSAREF's global.h - we use ours. - -nodist_librsaref_a_SOURCES = \ - desc.c \ - digit.c \ - md2c.c \ - md5c.c \ - nn.c \ - prime.c \ - r_dh.c \ - r_encode.c \ - r_enhanc.c \ - r_keygen.c \ - r_random.c \ - r_stdlib.c \ - rsa.c \ - des.h \ - digit.h \ - md2.h \ - md5.h \ - nn.h \ - prime.h \ - r_random.h \ - rsa.h \ - rsaref.h - -BUILT_SOURCES = $(nodist_librsaref_a_SOURCES) -INCLUDES = -I$(top_srcdir)/include -ETAGS_ARGS = Makefile.am - -#EXTRA_DIST = - -$(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 ;; \ - *) case "$$i" in \ - *.h) r_dst=$(srcdir)/$$i ;; \ - *) r_dst=$$i ;; \ - esac ; \ - cmp -s $${r_dst} $(srcdir)/../rsaref2/source/$$i 2>/dev/null \ - || cp $(srcdir)/../rsaref2/source/$$i $${r_dst} ;; \ - esac ; \ - done - @echo timestamp > stamp-rsarefT 2> /dev/null - @mv stamp-rsarefT stamp-rsaref diff --git a/dist/ntp/librsaref/Makefile.in b/dist/ntp/librsaref/Makefile.in deleted file mode 100644 index f7853cbda7aa..000000000000 --- a/dist/ntp/librsaref/Makefile.in +++ /dev/null @@ -1,389 +0,0 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 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. - -# 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. - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -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@ -AMDEP = @AMDEP@ -AMTAR = @AMTAR@ -AWK = @AWK@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CHUTEST = @CHUTEST@ -CLKTEST = @CLKTEST@ -CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DCFD = @DCFD@ -DEPDIR = @DEPDIR@ -LDFLAGS = @LDFLAGS@ -LIBPARSE = @LIBPARSE@ -LIBRSAREF = @LIBRSAREF@ -LN_S = @LN_S@ -MAKEINFO = @MAKEINFO@ -MAKE_ADJTIMED = @MAKE_ADJTIMED@ -MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@ -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@ -PACKAGE = @PACKAGE@ -PATH_PERL = @PATH_PERL@ -PATH_SH = @PATH_SH@ -PROPDELAY = @PROPDELAY@ -RANLIB = @RANLIB@ -RSAREF = @RSAREF@ -TESTDCF = @TESTDCF@ -U = @U@ -VERSION = @VERSION@ -install_sh = @install_sh@ - -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies -#AUTOMAKE_OPTIONS = ../util/ansi2knr - - -noinst_LIBRARIES = @MAKE_LIBRSAREF@ -EXTRA_LIBRARIES = librsaref.a -CLEANFILES = $(EXTRA_LIBRARIES) - -# NOTES: -# don't use RSAREF's global.h - we use ours. - -nodist_librsaref_a_SOURCES = \ - desc.c \ - digit.c \ - md2c.c \ - md5c.c \ - nn.c \ - prime.c \ - r_dh.c \ - r_encode.c \ - r_enhanc.c \ - r_keygen.c \ - r_random.c \ - r_stdlib.c \ - rsa.c \ - des.h \ - digit.h \ - md2.h \ - md5.h \ - nn.h \ - prime.h \ - r_random.h \ - rsa.h \ - rsaref.h - - -BUILT_SOURCES = $(nodist_librsaref_a_SOURCES) -INCLUDES = -I$(top_srcdir)/include -ETAGS_ARGS = Makefile.am -subdir = librsaref -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I.. -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -librsaref_a_AR = $(AR) cru -librsaref_a_LIBADD = -nodist_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 = $(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 = -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -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 = $(nodist_librsaref_a_SOURCES) -OBJECTS = $(nodist_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 - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -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) - $(RANLIB) librsaref.a - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -mostlyclean-tags: - -clean-tags: - -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: - -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 $@ $< - -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 - -install-data-am: -install-data: install-data-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: - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -rm -f Makefile.in - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ - clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-tags distclean-depend distclean-generic \ - clean-am - -distclean: distclean-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." - -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 - - -#EXTRA_DIST = - -$(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 ;; \ - *) case "$$i" in \ - *.h) r_dst=$(srcdir)/$$i ;; \ - *) r_dst=$$i ;; \ - esac ; \ - cmp -s $${r_dst} $(srcdir)/../rsaref2/source/$$i 2>/dev/null \ - || cp $(srcdir)/../rsaref2/source/$$i $${r_dst} ;; \ - esac ; \ - done - @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. -.NOEXPORT: diff --git a/dist/ntp/ntp_update b/dist/ntp/ntp_update deleted file mode 100755 index 87b2fa95c5d2..000000000000 --- a/dist/ntp/ntp_update +++ /dev/null @@ -1,68 +0,0 @@ -#! /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 , 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 -# 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 generated 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 -do - touch $f -done diff --git a/dist/ntp/ntpd/check_y2k.c b/dist/ntp/ntpd/check_y2k.c index 72d2aa6959d4..bb00a757ad52 100644 --- a/dist/ntp/ntpd/check_y2k.c +++ b/dist/ntp/ntpd/check_y2k.c @@ -1,4 +1,4 @@ -/* $NetBSD: check_y2k.c,v 1.1.1.2 2003/12/04 16:05:30 drochner Exp $ */ +/* $NetBSD: check_y2k.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* check_y2k.c -- test ntp code constructs for Y2K correctness Y2KFixes [*/ diff --git a/dist/ntp/ntpd/cmd_args.c b/dist/ntp/ntpd/cmd_args.c index 3cbb42f56763..d8c2490b7d41 100644 --- a/dist/ntp/ntpd/cmd_args.c +++ b/dist/ntp/ntpd/cmd_args.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmd_args.c,v 1.1.1.1 2003/12/04 16:05:30 drochner Exp $ */ +/* $NetBSD: cmd_args.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * cmd_args.c = command-line argument processing diff --git a/dist/ntp/ntpd/jupiter.h b/dist/ntp/ntpd/jupiter.h index ee4c30045570..99f2c013114d 100644 --- a/dist/ntp/ntpd/jupiter.h +++ b/dist/ntp/ntpd/jupiter.h @@ -1,6 +1,6 @@ -/* $NetBSD: jupiter.h,v 1.1.1.2 2003/12/04 16:05:25 drochner Exp $ */ +/* $NetBSD: jupiter.h,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ -/* @(#) $Header: /cvsroot/src/dist/ntp/ntpd/Attic/jupiter.h,v 1.1.1.2 2003/12/04 16:05:25 drochner Exp $ (LBL) */ +/* @(#) $Header: /cvsroot/src/dist/ntp/ntpd/Attic/jupiter.h,v 1.2 2003/12/04 16:23:37 drochner Exp $ (LBL) */ /* * Rockwell Jupiter GPS receiver definitions diff --git a/dist/ntp/ntpd/map_vme.c b/dist/ntp/ntpd/map_vme.c index 51c603a6ab90..ac299b3a1042 100644 --- a/dist/ntp/ntpd/map_vme.c +++ b/dist/ntp/ntpd/map_vme.c @@ -1,4 +1,4 @@ -/* $NetBSD: map_vme.c,v 1.1.1.1 2000/03/29 12:38:52 simonb Exp $ */ +/* $NetBSD: map_vme.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /********************************************************/ /* map_vme.c */ diff --git a/dist/ntp/ntpd/ntp_config.c b/dist/ntp/ntpd/ntp_config.c index 0870a1d29998..18e62201ed38 100644 --- a/dist/ntp/ntpd/ntp_config.c +++ b/dist/ntp/ntpd/ntp_config.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_config.c,v 1.5 2003/07/16 12:22:58 cb Exp $ */ +/* $NetBSD: ntp_config.c,v 1.6 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_config.c - read and apply configuration information @@ -7,23 +7,8 @@ # include #endif -#include -#include -#include -#include -#include -#ifndef SIGCHLD -#define SIGCHLD SIGCLD -#endif -#if !defined(VMS) -#ifdef HAVE_SYS_WAIT_H -#include -#endif -#endif /* VMS */ -#include - #ifdef HAVE_NETINFO -#include +# include #endif #include "ntpd.h" @@ -32,16 +17,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 +#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#include +#ifndef SIGCHLD +# define SIGCHLD SIGCLD +#endif +#if !defined(VMS) +# ifdef HAVE_SYS_WAIT_H +# include +# endif +#endif /* VMS */ #ifdef SYS_WINNT -#include +# include extern HANDLE ResolverThreadHandle; #endif /* SYS_WINNT */ +#include + +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. @@ -49,178 +51,6 @@ extern HANDLE ResolverThreadHandle; * Lines are considered terminated when a '#' is encountered. Blank * lines are ignored. */ - -/* - * 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 ] - * server [ addr ] [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] - * broadcast [ addr ] [ version 3 ] [ key 0 ] [ ttl 1 ] - * broadcastclient - * multicastclient [ 224.0.1.1 ] - * manycastclient [ addr ] [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] - * manycastserver [ 224.0.1.1 ] - * broadcastdelay 0.0102 - * 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 ] - * clientperiod [ 3600 ] - * trustedkey [ key ] - * requestkey [ key] - * controlkey [ key ] - * trap [ addr ] - * fudge [ addr ] [ stratum ] [ refid ] ... - * pidfile [ ] - * setvar [ ] - * logfile logfile - * logconfig [+|-|=][{sync|sys|peer|clock}{{,all}{info|statistics|events|status}}]... - * enable auth|bclient|pll|kernel|monitor|stats - * disable auth|bclient|pll|kernel|monitor|stats - * phone ... - * pps device [assert|clear] [hardpps] - */ - -/* - * 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 -#ifdef PUBKEY -#define CONFIG_KEYSDIR 18 -#endif /* PUBKEY */ -#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 -#endif /* PUBKEY */ - -/* - * "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_SKEY 7 -#define CONF_MOD_TTL 8 -#define CONF_MOD_MODE 9 -#define CONF_MOD_NOSELECT 10 -#ifdef PUBKEY -#define CONF_MOD_PUBLICKEY 11 -#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 - -/* - * "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 - -#ifdef PUBKEY -/* - * "crypto" modifier keywords - */ -#define CONF_CRYPTO_DH 1 -#define CONF_CRYPTO_PRIVATEKEY 2 -#define CONF_CRYPTO_PUBLICKEY 3 -#define CONF_CRYPTO_FLAGS 4 -#endif /* PUBKEY */ - /* * Translation table - keywords to function index */ @@ -233,26 +63,23 @@ struct keyword { * Command keywords */ static struct keyword keywords[] = { - { "authenticate", CONFIG_AUTHENTICATE }, { "automax", CONFIG_AUTOMAX }, { "broadcast", CONFIG_BROADCAST }, { "broadcastclient", CONFIG_BROADCASTCLIENT }, { "broadcastdelay", CONFIG_BDELAY }, - { "clientlimit", CONFIG_CLIENTLIMIT }, - { "clientperiod", CONFIG_CLIENTPERIOD }, -#ifdef PUBKEY + { "calldelay", CONFIG_CDELAY}, +#ifdef OPENSSL { "crypto", CONFIG_CRYPTO }, -#endif /* PUBKEY */ +#endif /* OPENSSL */ { "controlkey", CONFIG_CONTROLKEY }, { "disable", CONFIG_DISABLE }, { "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 }, @@ -261,7 +88,7 @@ static struct keyword keywords[] = { { "peer", CONFIG_PEER }, { "phone", CONFIG_PHONE }, { "pidfile", CONFIG_PIDFILE }, - { "pps", CONFIG_PPS }, + { "discard", CONFIG_DISCARD }, { "requestkey", CONFIG_REQUESTKEY }, { "restrict", CONFIG_RESTRICT }, { "revoke", CONFIG_REVOKE }, @@ -269,8 +96,12 @@ static struct keyword keywords[] = { { "setvar", CONFIG_SETVAR }, { "statistics", CONFIG_STATISTICS }, { "statsdir", CONFIG_STATSDIR }, + { "tick", CONFIG_ADJ }, + { "tinker", CONFIG_TINKER }, + { "tos", CONFIG_TOS }, { "trap", CONFIG_TRAP }, { "trustedkey", CONFIG_TRUSTEDKEY }, + { "ttl", CONFIG_TTL }, { "", CONFIG_UNKNOWN } }; @@ -280,15 +111,13 @@ static struct keyword keywords[] = { static struct keyword mod_keywords[] = { { "autokey", CONF_MOD_SKEY }, { "burst", CONF_MOD_BURST }, + { "iburst", CONF_MOD_IBURST }, { "key", CONF_MOD_KEY }, { "maxpoll", CONF_MOD_MAXPOLL }, { "minpoll", CONF_MOD_MINPOLL }, { "mode", CONF_MOD_MODE }, /* refclocks */ { "noselect", CONF_MOD_NOSELECT }, { "prefer", CONF_MOD_PREFER }, -#ifdef PUBKEY - { "publickey", CONF_MOD_PUBLICKEY }, -#endif /* PUBKEY */ { "ttl", CONF_MOD_TTL }, /* NTP peers */ { "version", CONF_MOD_VERSION }, { "", CONFIG_UNKNOWN } @@ -300,6 +129,7 @@ static struct keyword mod_keywords[] = { static struct keyword res_keywords[] = { { "ignore", CONF_RES_IGNORE }, { "limited", CONF_RES_LIMITED }, + { "kod", CONF_RES_DEMOBILIZE }, { "lowpriotrap", CONF_RES_LPTRAP }, { "mask", CONF_RES_MASK }, { "nomodify", CONF_RES_NOMODIFY }, @@ -309,6 +139,7 @@ static struct keyword res_keywords[] = { { "notrap", CONF_RES_NOTRAP }, { "notrust", CONF_RES_NOTRUST }, { "ntpport", CONF_RES_NTPPORT }, + { "version", CONF_RES_VERSION }, { "", CONFIG_UNKNOWN } }; @@ -336,7 +167,6 @@ static struct keyword fudge_keywords[] = { { "", CONFIG_UNKNOWN } }; - /* * "filegen" modifier keywords */ @@ -370,35 +200,78 @@ static struct keyword fgen_types[] = { static struct keyword flags_keywords[] = { { "auth", PROTO_AUTHENTICATE }, { "bclient", PROTO_BROADCLIENT }, + { "calibrate", PROTO_CAL }, { "kernel", PROTO_KERNEL }, { "monitor", PROTO_MONITOR }, { "ntp", PROTO_NTP }, + { "pps", PROTO_PPS }, { "stats", PROTO_FILEGEN }, { "", CONFIG_UNKNOWN } }; /* - * "pps" modifier keywords + * "discard" modifier keywords */ -static struct keyword pps_keywords[] = { - { "assert", CONF_PPS_ASSERT }, - { "clear", CONF_PPS_CLEAR }, - { "hardpps", CONF_PPS_HARDPPS }, +static struct keyword discard_keywords[] = { + { "average", CONF_DISCARD_AVERAGE }, + { "minimum", CONF_DISCARD_MINIMUM }, + { "monitor", CONF_DISCARD_MONITOR }, { "", CONFIG_UNKNOWN } }; -#ifdef PUBKEY +/* + * "tinker" modifier keywords + */ +static struct keyword tinker_keywords[] = { + { "step", CONF_CLOCK_MAX }, + { "panic", CONF_CLOCK_PANIC }, + { "dispersion", CONF_CLOCK_PHI }, + { "stepout", CONF_CLOCK_MINSTEP }, + { "allan", CONF_CLOCK_ALLAN }, + { "huffpuff", CONF_CLOCK_HUFFPUFF }, + { "freq", CONF_CLOCK_FREQ }, + { "", CONFIG_UNKNOWN } +}; + +/* + * "tos" modifier keywords + */ +static struct keyword tos_keywords[] = { + { "minclock", CONF_TOS_MINCLOCK }, + { "minsane", CONF_TOS_MINSANE }, + { "floor", CONF_TOS_FLOOR }, + { "ceiling", CONF_TOS_CEILING }, + { "cohort", CONF_TOS_COHORT }, + { "", CONFIG_UNKNOWN } +}; + +#ifdef OPENSSL /* * "crypto" modifier keywords */ static struct keyword crypto_keywords[] = { - { "dh", CONF_CRYPTO_DH }, - { "flags", CONF_CRYPTO_FLAGS }, - { "privatekey", CONF_CRYPTO_PRIVATEKEY }, - { "publickey", CONF_CRYPTO_PUBLICKEY }, + { "cert", CONF_CRYPTO_CERT }, + { "gqpar", CONF_CRYPTO_GQPAR }, + { "host", CONF_CRYPTO_RSA }, + { "iffpar", CONF_CRYPTO_IFFPAR }, + { "leap", CONF_CRYPTO_LEAP }, + { "mvpar", CONF_CRYPTO_MVPAR }, + { "pw", CONF_CRYPTO_PW }, + { "randfile", CONF_CRYPTO_RAND }, + { "sign", CONF_CRYPTO_SIGN }, + { "", CONFIG_UNKNOWN } +}; +#endif /* OPENSSL */ + +/* + * Address type selection, IPv4 or IPv4. + * Used on various lines. + */ +static struct keyword addr_type[] = { + { "-4", CONF_ADDR_IPV4 }, + { "-6", CONF_ADDR_IPV6 }, { "", CONFIG_UNKNOWN } }; -#endif /* PUBKEY */ /* * "logconfig" building blocks @@ -440,6 +313,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 MAXINCLUDELEVEL 5 /* maximum include file levels */ /* * Miscellaneous macros @@ -455,6 +329,7 @@ static struct masks logcfg_item[] = { * File descriptor used by the resolver save routines, and temporary file * name. */ +int call_resolver = 1; /* ntp-genkeys sets this to 0, for example */ static FILE *res_fp; #ifndef SYS_WINNT static char res_file[20]; /* enough for /tmp/ntpXXXXXX\0 */ @@ -468,20 +343,24 @@ static char res_file[MAX_PATH]; */ char const *progname; char sys_phone[MAXPHONE][MAXDIAL]; /* ACTS phone numbers */ +char *keysdir = NTP_KEYSDIR; /* crypto keys directory */ char pps_device[MAXPPS + 1]; /* PPS device name */ -int pps_assert = 1; -int pps_hardpps; -int listen_to_virtual_ips = 0; #if defined(HAVE_SCHED_SETSCHEDULER) int config_priority_override = 0; int config_priority; #endif -#ifndef HAVE_CLOCKCTL -static const char *ntp_options = "aAbc:dD:f:gk:l:Lmnp:P:r:s:t:v:V:x"; -#else -static const char *ntp_options = "aAbc:dD:f:gi:k:l:Lmnp:P:r:s:t:u:v:V:x"; -#endif +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 /* @@ -508,13 +387,13 @@ static void free_netinfo_config P((struct netinfo_config_state *)); static int gettokens_netinfo P((struct netinfo_config_state *, char **, int *)); #endif 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, +static int matchkey P((char *, struct keyword *, int)); +static int getnetnum P((const char *, struct sockaddr_storage *, int)); +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) +#if !defined(VMS) && !defined(SYS_WINNT) static RETSIGTYPE catchchild P((int)); #endif /* VMS */ @@ -582,122 +461,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 -#ifdef HAVE_CLOCKCTL - (void) fprintf(stderr, "\t\t[ -u user[:group] ] [ -i chrootdir ]\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 @@ -711,34 +474,28 @@ getconfig( register int i; int c; int errflg; + int istart; int peerversion; int minpoll; int maxpoll; int ttl; + long stratum; + unsigned long ul; keyid_t peerkey; - char *peerkeystr; - u_long lpeerkey; - int peerflags; + u_char *peerkeystr; + u_long fudgeflag; + u_int peerflags; int hmode; - struct sockaddr_in peeraddr; - struct sockaddr_in maskaddr; - FILE *fp; + struct sockaddr_storage peeraddr; + struct sockaddr_storage maskaddr; + FILE *fp[MAXINCLUDELEVEL+1]; + FILE *includefile; + int includelevel = 0; char line[MAXLINE]; char *(tokens[MAXTOKENS]); - int ntokens; + int ntokens = 0; 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; @@ -746,9 +503,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 @@ -789,163 +544,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; -#ifdef HAVE_CLOCKCTL - case 'i': - if (!ntp_optarg) - errflg++; - else - chrootdir = ntp_optarg; - break; -#endif - 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; -#ifdef HAVE_CLOCKCTL - case 'u': - user = malloc(strlen(ntp_optarg) + 1); - if ((user == NULL) || (ntp_optarg == NULL)) - errflg++; - (void)strncpy(user, ntp_optarg, strlen(ntp_optarg) + 1); - group = rindex(user, ':'); - if (group) - *group++ = '\0'; /* get rid of the ':' */ - break; -#endif - 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()) @@ -956,7 +558,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 @@ -973,14 +575,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: @@ -1003,7 +612,20 @@ getconfig( break; } - if (!getnetnum(tokens[1], &peeraddr, 0)) { + istart = 1; + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + switch (matchkey(tokens[istart], addr_type, 0)) { + case CONF_ADDR_IPV4: + peeraddr.ss_family = AF_INET; + istart++; + break; + case CONF_ADDR_IPV6: + peeraddr.ss_family = AF_INET6; + istart++; + break; + } + + if (!getnetnum(tokens[istart], &peeraddr, 0)) { errflg = -1; } else { errflg = 0; @@ -1015,7 +637,7 @@ getconfig( ISBADADR(&peeraddr)) { msyslog(LOG_ERR, "attempt to configure invalid address %s", - ntoa(&peeraddr)); + stoa(&peeraddr)); break; } /* @@ -1023,23 +645,45 @@ getconfig( * address for server/peer! * and unicast address for manycastclient! */ - if (((tok == CONFIG_SERVER) || - (tok == CONFIG_PEER)) && + if (peeraddr.ss_family == AF_INET) { + if (((tok == CONFIG_SERVER) || + (tok == CONFIG_PEER)) && #ifdef REFCLOCK - !ISREFCLOCKADR(&peeraddr) && + !ISREFCLOCKADR(&peeraddr) && #endif - IN_CLASSD(ntohl(peeraddr.sin_addr.s_addr))) { - msyslog(LOG_ERR, - "attempt to configure invalid address %s", - ntoa(&peeraddr)); - break; + IN_CLASSD(ntohl(((struct sockaddr_in*)&peeraddr)->sin_addr.s_addr))) { + msyslog(LOG_ERR, + "attempt to configure invalid address %s", + stoa(&peeraddr)); + break; + } + if ((tok == CONFIG_MANYCASTCLIENT) && + !IN_CLASSD(ntohl(((struct sockaddr_in*)&peeraddr)->sin_addr.s_addr))) { + msyslog(LOG_ERR, + "attempt to configure invalid address %s", + stoa(&peeraddr)); + break; + } } - if ((tok == CONFIG_MANYCASTCLIENT) && - !IN_CLASSD(ntohl(peeraddr.sin_addr.s_addr))) { - msyslog(LOG_ERR, - "attempt to configure invalid address %s", - ntoa(&peeraddr)); - break; + else if(peeraddr.ss_family == AF_INET6) { + if (((tok == CONFIG_SERVER) || + (tok == CONFIG_PEER)) && +#ifdef REFCLOCK + !ISREFCLOCKADR(&peeraddr) && +#endif + IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)&peeraddr)->sin6_addr)) { + msyslog(LOG_ERR, + "attempt to configure in valid address %s", + stoa(&peeraddr)); + break; + } + if ((tok == CONFIG_MANYCASTCLIENT) && + !IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)&peeraddr)->sin6_addr)) { + msyslog(LOG_ERR, + "attempt to configure in valid address %s", + stoa(&peeraddr)); + break; + } } } @@ -1047,11 +691,12 @@ getconfig( minpoll = NTP_MINDPOLL; maxpoll = NTP_MAXDPOLL; peerkey = 0; - peerkeystr = "*"; + peerkeystr = (u_char *)"*"; peerflags = 0; ttl = 0; - for (i = 2; i < ntokens; i++) - switch (matchkey(tokens[i], mod_keywords)) { + istart++; + for (i = istart; i < ntokens; i++) + switch (matchkey(tokens[i], mod_keywords, 1)) { case CONF_MOD_VERSION: if (i >= ntokens-1) { msyslog(LOG_ERR, @@ -1088,8 +733,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: @@ -1101,8 +750,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: @@ -1116,43 +769,38 @@ getconfig( case CONF_MOD_BURST: peerflags |= FLAG_BURST; break; -#ifdef AUTOKEY + + case CONF_MOD_IBURST: + peerflags |= FLAG_IBURST; + break; +#ifdef OPENSSL case CONF_MOD_SKEY: 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 */ +#endif /* OPENSSL */ case CONF_MOD_TTL: if (i >= ntokens-1) { - msyslog(LOG_ERR, - "ttl: argument required"); - errflg = 1; - break; + msyslog(LOG_ERR, + "ttl: argument required"); + errflg = 1; + break; } ttl = atoi(tokens[++i]); + if (ttl >= MAX_TTL) { + msyslog(LOG_ERR, + "ttl: invalid argument"); + errflg = 1; + } break; case CONF_MOD_MODE: if (i >= ntokens-1) { - msyslog(LOG_ERR, - "mode: argument required"); - errflg = 1; - break; + msyslog(LOG_ERR, + "mode: argument required"); + errflg = 1; + break; } ttl = atoi(tokens[++i]); break; @@ -1162,24 +810,27 @@ getconfig( break; } if (minpoll > maxpoll) { - msyslog(LOG_ERR, "config error: minpoll > maxpoll"); + msyslog(LOG_ERR, + "config error: minpoll > maxpoll"); errflg = 1; } if (errflg == 0) { if (peer_config(&peeraddr, - (struct interface *)0, hmode, - peerversion, minpoll, maxpoll, peerflags, - ttl, peerkey, peerkeystr) == 0) { + ANY_INTERFACE_CHOOSE(&peeraddr), hmode, + peerversion, minpoll, maxpoll, peerflags, + ttl, peerkey, peerkeystr) == 0) { msyslog(LOG_ERR, "configuration of %s failed", - ntoa(&peeraddr)); + stoa(&peeraddr)); } + if (tok == CONFIG_MANYCASTCLIENT) + proto_config(PROTO_MULTICAST_ADD, + 0, 0., &peeraddr); } else if (errflg == -1) { - save_resolve(tokens[1], hmode, - peerversion, minpoll, maxpoll, - peerflags, ttl, peerkey, - peerkeystr); + save_resolve(tokens[1], hmode, peerversion, + minpoll, maxpoll, peerflags, ttl, + peerkey, peerkeystr); } break; @@ -1197,6 +848,25 @@ 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; @@ -1257,52 +927,47 @@ getconfig( break; case CONFIG_BROADCASTCLIENT: - proto_config(PROTO_BROADCLIENT, 1, 0.); + proto_config(PROTO_BROADCLIENT, 1, 0., NULL); break; - + case CONFIG_MULTICASTCLIENT: case CONFIG_MANYCASTSERVER: if (ntokens > 1) { - for (i = 1; i < ntokens; i++) { + istart = 1; + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + switch (matchkey(tokens[istart], + addr_type, 0)) { + case CONF_ADDR_IPV4: + peeraddr.ss_family = AF_INET; + istart++; + break; + case CONF_ADDR_IPV6: + peeraddr.ss_family = AF_INET6; + istart++; + break; + } + /* + * Abuse maskaddr to store the prefered ip + * version. + */ + memset((char *)&maskaddr, 0, sizeof(maskaddr)); + maskaddr.ss_family = peeraddr.ss_family; + + for (i = istart; i < ntokens; i++) { + memset((char *)&peeraddr, 0, + sizeof(peeraddr)); + peeraddr.ss_family = maskaddr.ss_family; if (getnetnum(tokens[i], &peeraddr, 1)) proto_config(PROTO_MULTICAST_ADD, - peeraddr.sin_addr.s_addr, 0.); + 0, 0., &peeraddr); } } else proto_config(PROTO_MULTICAST_ADD, - htonl(INADDR_NTP), 0.); - if (tok == CONFIG_MULTICASTCLIENT) { + 0, 0., NULL); + 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: - errflg = 0; - if (ntokens >= 2) { - if (STREQ(tokens[1], "yes")) - proto_config(PROTO_AUTHENTICATE, 1, 0.); - else if (STREQ(tokens[1], "no")) - proto_config(PROTO_AUTHENTICATE, 0, 0.); - else - errflg++; - } else { - errflg++; - } - - if (errflg) - msyslog(LOG_ERR, - "should be `authenticate yes|no'"); break; case CONFIG_KEYS: @@ -1311,10 +976,144 @@ getconfig( } break; -#ifdef AUTOKEY + case CONFIG_KEYSDIR: + if (ntokens < 2) { + msyslog(LOG_ERR, + "Keys directory name required"); + break; + } + keysdir = emalloc(strlen(tokens[1]) + 1); + strcpy(keysdir, tokens[1]); + break; + + case CONFIG_TINKER: + for (i = 1; i < ntokens; i++) { + int temp; + double ftemp; + + temp = matchkey(tokens[i++], tinker_keywords, 1); + 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_ALLAN: + loop_config(LOOP_ALLAN, ftemp); + break; + + case CONF_CLOCK_HUFFPUFF: + loop_config(LOOP_HUFFPUFF, ftemp); + break; + + case CONF_CLOCK_FREQ: + loop_config(LOOP_FREQ, ftemp); + break; + } + } + break; + + case CONFIG_TOS: + for (i = 1; i < ntokens; i++) { + int temp; + double ftemp; + + temp = matchkey(tokens[i++], tos_keywords, 1); + if (i > ntokens - 1) { + msyslog(LOG_ERR, + "tinker: missing argument"); + errflg++; + break; + } + sscanf(tokens[i], "%lf", &ftemp); + switch(temp) { + + case CONF_TOS_MINCLOCK: + proto_config(PROTO_MINCLOCK, 0, ftemp, NULL); + break; + + case CONF_TOS_MINSANE: + proto_config(PROTO_MINSANE, 0, ftemp, NULL); + break; + + case CONF_TOS_FLOOR: + proto_config(PROTO_FLOOR, 0, ftemp, NULL); + break; + + case CONF_TOS_CEILING: + proto_config(PROTO_CEILING, 0, ftemp, NULL); + break; + + case CONF_TOS_COHORT: + proto_config(PROTO_COHORT, 0, ftemp, NULL); + break; + } + } + break; + + case CONFIG_TTL: + for (i = 1; i < ntokens && i < MAX_TTL; i++) { + sys_ttl[i - 1] = (u_char) atoi(tokens[i]); + sys_ttlmax = i - 1; + } + break; + + case CONFIG_DISCARD: + for (i = 1; i < ntokens; i++) { + int temp; + + temp = matchkey(tokens[i++], + discard_keywords, 1); + if (i > ntokens - 1) { + msyslog(LOG_ERR, + "discard: missing argument"); + errflg++; + break; + } + switch(temp) { + case CONF_DISCARD_AVERAGE: + res_avg_interval = atoi(tokens[i++]); + break; + + case CONF_DISCARD_MINIMUM: + res_min_interval = atoi(tokens[i++]); + break; + + case CONF_DISCARD_MONITOR: + mon_age = atoi(tokens[i++]); + break; + + default: + msyslog(LOG_ERR, + "discard: unknown keyword"); + break; + } + } + break; + +#ifdef OPENSSL case CONFIG_REVOKE: if (ntokens >= 2) - sys_revoke = 1 << max(atoi(tokens[1]), 10); + sys_revoke = (u_char) max(atoi(tokens[1]), KEY_REVOKE); break; case CONFIG_AUTOMAX: @@ -1322,67 +1121,105 @@ getconfig( 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: - crypto_enable = 1; + if (ntokens == 1) { + crypto_config(CRYPTO_CONF_NONE, NULL); + break; + } for (i = 1; i < ntokens; i++) { int temp; - temp = matchkey(tokens[i++], crypto_keywords); + temp = matchkey(tokens[i++], + crypto_keywords, 1); if (i > ntokens - 1) { msyslog(LOG_ERR, - "crypto: missing file name"); + "crypto: missing argument"); errflg++; break; } switch(temp) { - case CONF_CRYPTO_FLAGS: - crypto_config(CRYPTO_CONF_FLAGS, - tokens[i]); - break; - case CONF_CRYPTO_DH: - crypto_config(CRYPTO_CONF_DH, - tokens[i]); - break; + case CONF_CRYPTO_CERT: + crypto_config(CRYPTO_CONF_CERT, + tokens[i]); + break; - case CONF_CRYPTO_PRIVATEKEY: - crypto_config(CRYPTO_CONF_PRIV, - tokens[i]); - break; + case CONF_CRYPTO_RSA: + crypto_config(CRYPTO_CONF_PRIV, + tokens[i]); + break; + + case CONF_CRYPTO_IFFPAR: + crypto_config(CRYPTO_CONF_IFFPAR, + tokens[i]); + break; + + case CONF_CRYPTO_GQPAR: + crypto_config(CRYPTO_CONF_GQPAR, + tokens[i]); + break; + + case CONF_CRYPTO_MVPAR: + crypto_config(CRYPTO_CONF_MVPAR, + tokens[i]); + break; + + case CONF_CRYPTO_LEAP: + crypto_config(CRYPTO_CONF_LEAP, + tokens[i]); + break; + + case CONF_CRYPTO_PW: + crypto_config(CRYPTO_CONF_PW, + tokens[i]); + break; + + case CONF_CRYPTO_RAND: + crypto_config(CRYPTO_CONF_RAND, + tokens[i]); + break; + + case CONF_CRYPTO_SIGN: + crypto_config(CRYPTO_CONF_SIGN, + tokens[i]); + break; - case CONF_CRYPTO_PUBLICKEY: - crypto_config(CRYPTO_CONF_PUBL, - tokens[i]); - break; default: - msyslog(LOG_ERR, - "crypto: unknown keyword"); - break; + msyslog(LOG_ERR, + "crypto: unknown keyword"); + break; } } break; -#endif /* PUBKEY */ -#endif /* AUTOKEY */ +#endif /* OPENSSL */ case CONFIG_RESTRICT: if (ntokens < 2) { msyslog(LOG_ERR, "restrict requires an address"); break; } - if (STREQ(tokens[1], "default")) - peeraddr.sin_addr.s_addr = htonl(INADDR_ANY); - else if (!getnetnum(tokens[1], &peeraddr, 1)) - break; + istart = 1; + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + switch (matchkey(tokens[istart], addr_type, 0)) { + case CONF_ADDR_IPV4: + peeraddr.ss_family = AF_INET; + istart++; + break; + case CONF_ADDR_IPV6: + peeraddr.ss_family = AF_INET6; + istart++; + break; + } + + /* + * Assume default means an IPv4 address, except + * if forced by a -4 or -6. + */ + if (STREQ(tokens[istart], "default")) { + if (peeraddr.ss_family == 0) + peeraddr.ss_family = AF_INET; + } else if (!getnetnum(tokens[istart], &peeraddr, 1)) + break; /* * Use peerversion as flags, peerkey as mflags. Ick. @@ -1390,9 +1227,10 @@ getconfig( peerversion = 0; peerkey = 0; errflg = 0; - maskaddr.sin_addr.s_addr = ~(u_int32)0; - for (i = 2; i < ntokens; i++) { - switch (matchkey(tokens[i], res_keywords)) { + SET_HOSTMASK(&maskaddr, peeraddr.ss_family); + istart++; + for (i = istart; i < ntokens; i++) { + switch (matchkey(tokens[i], res_keywords, 1)) { case CONF_RES_MASK: if (i >= ntokens-1) { msyslog(LOG_ERR, @@ -1441,6 +1279,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; @@ -1450,8 +1296,8 @@ getconfig( break; } } - if (SRCADR(&peeraddr) == htonl(INADDR_ANY)) - maskaddr.sin_addr.s_addr = 0; + if (SOCKNUL(&peeraddr)) + ANYSOCK(&maskaddr); if (!errflg) hack_restrict(RESTRICT_FLAGS, &peeraddr, &maskaddr, (int)peerkey, peerversion); @@ -1466,11 +1312,23 @@ getconfig( "broadcastdelay value %s undecodable", tokens[1]); } else { - proto_config(PROTO_BROADDELAY, 0, tmp); + proto_config(PROTO_BROADDELAY, 0, tmp, NULL); } } break; + case CONFIG_CDELAY: + if (ntokens >= 2) { + u_long ui; + + if (sscanf(tokens[1], "%ld", &ui) != 1) + msyslog(LOG_ERR, + "illegal value - line ignored"); + else + proto_config(PROTO_CALLDELAY, ui, 0, NULL); + } + break; + case CONFIG_TRUSTEDKEY: for (i = 1; i < ntokens; i++) { keyid_t tkey; @@ -1488,13 +1346,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]); @@ -1502,9 +1358,9 @@ getconfig( #ifdef DEBUG if (debug > 3) printf( - "set info_auth_key to %08lx\n", rkey); + "set info_auth_key to %08lx\n", ul); #endif - info_auth_keyid = rkey; + info_auth_keyid = (keyid_t)ul; } } break; @@ -1530,7 +1386,20 @@ getconfig( "no address for trap command, line ignored"); break; } - if (!getnetnum(tokens[1], &peeraddr, 1)) + istart = 1; + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + switch (matchkey(tokens[istart], addr_type, 0)) { + case CONF_ADDR_IPV4: + peeraddr.ss_family = AF_INET; + istart++; + break; + case CONF_ADDR_IPV6: + peeraddr.ss_family = AF_INET6; + istart++; + break; + } + + if (!getnetnum(tokens[istart], &peeraddr, 1)) break; /* @@ -1539,8 +1408,9 @@ getconfig( errflg = 0; peerversion = 0; localaddr = 0; - for (i = 2; i < ntokens-1; i++) - switch (matchkey(tokens[i], trap_keywords)) { + istart++; + for (i = istart; i < ntokens-1; i++) + switch (matchkey(tokens[i], trap_keywords, 1)) { case CONF_TRAP_PORT: if (i >= ntokens-1) { msyslog(LOG_ERR, @@ -1566,6 +1436,9 @@ getconfig( break; } + memset((char *)&maskaddr, 0, + sizeof(maskaddr)); + maskaddr.ss_family = peeraddr.ss_family; if (!getnetnum(tokens[++i], &maskaddr, 1)) { errflg = 1; @@ -1576,7 +1449,7 @@ getconfig( if (localaddr == NULL) { msyslog(LOG_ERR, "can't find interface with address %s", - ntoa(&maskaddr)); + stoa(&maskaddr)); errflg = 1; } break; @@ -1588,16 +1461,16 @@ getconfig( if (!errflg) { if (peerversion != 0) - peeraddr.sin_port = htons( (u_short) peerversion); + ((struct sockaddr_in6*)&peeraddr)->sin6_port = htons( (u_short) peerversion); else - peeraddr.sin_port = htons(TRAPPORT); + ((struct sockaddr_in6*)&peeraddr)->sin6_port = htons(TRAPPORT); if (localaddr == NULL) - localaddr = any_interface; + localaddr = ANY_INTERFACE_CHOOSE(&peeraddr); if (!ctlsettrap(&peeraddr, localaddr, 0, NTP_VERSION)) msyslog(LOG_ERR, "can't set trap for %s, no resources", - ntoa(&peeraddr)); + stoa(&peeraddr)); } break; @@ -1607,27 +1480,29 @@ getconfig( "no address for fudge command, line ignored"); break; } + memset((char *)&peeraddr, 0, sizeof(peeraddr)); if (!getnetnum(tokens[1], &peeraddr, 1)) break; if (!ISREFCLOCKADR(&peeraddr)) { msyslog(LOG_ERR, "%s is inappropriate address for the fudge command, line ignored", - ntoa(&peeraddr)); + stoa(&peeraddr)); break; } memset((void *)&clock_stat, 0, sizeof clock_stat); + fudgeflag = 0; errflg = 0; for (i = 2; i < ntokens-1; i++) { switch (c = matchkey(tokens[i], - fudge_keywords)) { + fudge_keywords, 1)) { case CONF_FDG_TIME1: if (sscanf(tokens[++i], "%lf", &clock_stat.fudgetime1) != 1) { msyslog(LOG_ERR, "fudge %s time1 value in error", - ntoa(&peeraddr)); + stoa(&peeraddr)); errflg = i; break; } @@ -1639,7 +1514,7 @@ getconfig( &clock_stat.fudgetime2) != 1) { msyslog(LOG_ERR, "fudge %s time2 value in error", - ntoa(&peeraddr)); + stoa(&peeraddr)); errflg = i; break; } @@ -1648,16 +1523,15 @@ 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", - ntoa(&peeraddr)); + stoa(&peeraddr)); errflg = i; break; } + clock_stat.fudgeval1 = stratum; clock_stat.haveflags |= CLK_HAVEVAL1; break; @@ -1673,16 +1547,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; + stoa(&peeraddr)); errflg = i; break; } - peerkey = lpeerkey; switch(c) { case CONF_FDG_FLAG1: c = CLK_FLAG1; @@ -1701,7 +1573,7 @@ getconfig( clock_stat.haveflags|=CLK_HAVEFLAG4; break; } - if (peerkey == 0) + if (fudgeflag == 0) clock_stat.flags &= ~c; else clock_stat.flags |= c; @@ -1775,7 +1647,8 @@ getconfig( errflg = 0; for (i = 2; i < ntokens; i++) { - switch (matchkey(tokens[i], filegen_keywords)) { + switch (matchkey(tokens[i], + filegen_keywords, 1)) { case CONF_FGEN_FILE: if (i >= ntokens - 1) { msyslog(LOG_ERR, @@ -1794,7 +1667,8 @@ getconfig( errflg = i; break; } - peerkey = matchkey(tokens[++i], fgen_types); + peerkey = matchkey(tokens[++i], + fgen_types, 1); if (peerkey == CONFIG_UNKNOWN) { msyslog(LOG_ERR, "filegen %s unknown type \"%s\"", @@ -1821,10 +1695,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: @@ -1833,55 +1706,12 @@ getconfig( "no value for setvar command - line ignored"); } else { set_sys_var(tokens[1], strlen(tokens[1])+1, - RW | + (u_short) (RW | ((((ntokens > 2) && !strcmp(tokens[2], "default"))) ? DEF - : 0)); - } - break; - - case CONFIG_CLIENTLIMIT: - if (ntokens < 2) { - msyslog(LOG_ERR, - "no value for clientlimit command - line ignored"); - } else { - u_long ui; - - if (!atouint(tokens[1], &ui) || !ui) { - msyslog(LOG_ERR, - "illegal value for clientlimit command - line ignored"); - } else { - char bp[80]; - -#ifdef DEBUG - if (debug) - sprintf(bp, "client_limit=%lu", ui); -#endif - set_sys_var(bp, strlen(bp)+1, RO); - client_limit = ui; - } - } - break; - - case CONFIG_CLIENTPERIOD: - if (ntokens < 2) { - msyslog(LOG_ERR, - "no value for clientperiod command - line ignored"); - } else { - u_long ui; - - if (!atouint(tokens[1], &ui) || ui < 64) { - msyslog(LOG_ERR, - "illegal value for clientperiod command - line ignored"); - } else { - char bp[80]; - - sprintf(bp, "client_limit_period=%ld", ui); - set_sys_var(bp, strlen(bp)+1, RO); - client_limit_period = ui; - } + : 0))); } break; @@ -1889,7 +1719,7 @@ getconfig( for (i = 1; i < ntokens; i++) { int flag; - flag = matchkey(tokens[i], flags_keywords); + flag = matchkey(tokens[i], flags_keywords, 1); if (flag == CONFIG_UNKNOWN) { msyslog(LOG_ERR, "enable unknown flag %s", @@ -1897,7 +1727,7 @@ getconfig( errflg = 1; break; } - proto_config(flag, 1, 0.); + proto_config(flag, 1, 0., NULL); } break; @@ -1905,7 +1735,7 @@ getconfig( for (i = 1; i < ntokens; i++) { int flag; - flag = matchkey(tokens[i], flags_keywords); + flag = matchkey(tokens[i], flags_keywords, 1); if (flag == CONFIG_UNKNOWN) { msyslog(LOG_ERR, "disable unknown flag %s", @@ -1913,7 +1743,7 @@ getconfig( errflg = 1; break; } - proto_config(flag, 0, 0.); + proto_config(flag, 0, 0., NULL); } break; @@ -1925,42 +1755,18 @@ getconfig( sys_phone[i - 1][0] = '\0'; break; - case CONFIG_PPS: - if (ntokens < 2) { - msyslog(LOG_ERR, - "pps missing device name"); - break; - } - (void)strncpy(pps_device, tokens[1], MAXPPS); - for (i = 2; i < ntokens; i++) { - int flag; + case CONFIG_ADJ: { + double ftemp; - flag = matchkey(tokens[i], pps_keywords); - switch(flag) { - case CONF_PPS_ASSERT: - pps_assert = 1; - break; - case CONF_PPS_CLEAR: - pps_assert = 0; - break; - case CONF_PPS_HARDPPS: - pps_hardpps = 1; - break; - default: - msyslog(LOG_ERR, - "pps unknown flag %s", - tokens[i]); - errflg = 1; - break; - } - if(errflg) - break; + sscanf(tokens[1], "%lf", &ftemp); + proto_config(PROTO_ADJ, 0, ftemp, NULL); } break; + } } - if (fp) - (void)fclose(fp); + if (fp[0]) + (void)fclose(fp[0]); #ifdef HAVE_NETINFO if (config_netinfo) @@ -1981,7 +1787,7 @@ getconfig( for (i = 0; i < 8; i++) for (j = 1; j < 100; ++j) { - rankey[i] = RANDOM & 0xff; + rankey[i] = (char) (RANDOM & 0xff); if (rankey[i] != 0) break; } rankey[8] = 0; @@ -1998,12 +1804,13 @@ getconfig( #endif /* !defined(VMS) && !defined(SYS_VXWORKS) */ if (res_fp != NULL) { - /* - * Need name resolution - */ - do_resolve_internal(); + if (call_resolver) { + /* + * Need name resolution + */ + do_resolve_internal(); + } } - } @@ -2103,7 +1910,7 @@ gettokens_netinfo ( for (index = 0; index < namelist.ni_namelist_len; index++) { char *value = namelist.ni_namelist_val[index]; - if (! (val_list[index] = (char*)malloc(strlen(value+1)))) + if (! (val_list[index] = (char*)malloc(strlen(value)+1))) { msyslog(LOG_ERR, "out of memory while configuring"); break; } strcpy(val_list[index], value); @@ -2223,7 +2030,7 @@ gettokens ( * Return the match */ *ntokens = ntok + 1; - ntok = matchkey(tokenlist[0], keywords); + ntok = matchkey(tokenlist[0], keywords, 1); if (ntok == CONFIG_UNKNOWN) goto again; return ntok; @@ -2237,14 +2044,16 @@ gettokens ( static int matchkey( register char *word, - register struct keyword *keys + register struct keyword *keys, + int complain ) { for (;;) { if (keys->keytype == CONFIG_UNKNOWN) { - msyslog(LOG_ERR, - "configure: keyword \"%s\" unknown, line ignored", - word); + if (complain) + msyslog(LOG_ERR, + "configure: keyword \"%s\" unknown, line ignored", + word); return CONFIG_UNKNOWN; } if (STRSAME(word, keys->text)) @@ -2260,77 +2069,53 @@ matchkey( static int getnetnum( const char *num, - struct sockaddr_in *addr, + struct sockaddr_storage *addr, int complain ) { - register const char *cp; - register char *bp; - register int i; - register int temp; - char buf[80]; /* will core dump on really stupid stuff */ - u_int32 netnum; + struct addrinfo hints; + struct addrinfo *ptr; - /* XXX ELIMINATE replace with decodenetnum */ - cp = num; - netnum = 0; - for (i = 0; i < 4; i++) { - bp = buf; - while (isdigit((int)*cp)) - *bp++ = *cp++; - if (bp == buf) - break; + /* Get host address. Looking for UDP datagram connection */ + memset(&hints, 0, sizeof (hints)); + if (addr->ss_family == AF_INET || addr->ss_family == AF_INET6) + hints.ai_family = addr->ss_family; + else + hints.ai_family = AF_UNSPEC; - if (i < 3) { - if (*cp++ != '.') - break; - } else if (*cp != '\0') - break; - - *bp = '\0'; - temp = atoi(buf); - if (temp > 255) - break; - netnum <<= 8; - netnum += temp; + hints.ai_socktype = SOCK_DGRAM; #ifdef DEBUG if (debug > 3) - printf("getnetnum %s step %d buf %s temp %d netnum %lu\n", - num, i, buf, temp, (u_long)netnum); + printf("getaddrinfo %s\n", num); #endif - } - - if (i < 4) { + if (getaddrinfo(num, "ntp", &hints, &ptr)!=0) { if (complain) msyslog(LOG_ERR, - "getnetnum: \"%s\" invalid host number, line ignored", + "getaddrinfo: \"%s\" invalid host address, line ignored", num); #ifdef DEBUG if (debug > 3) printf( - "getnetnum: \"%s\" invalid host number, line ignored\n", - num); + "getaddrinfo: \"%s\" invalid host address%s.\n", + num, (complain) + ? ", line ignored" + : ""); #endif return 0; } - /* - * make up socket address. Clear it out for neatness. - */ - memset((void *)addr, 0, sizeof(struct sockaddr_in)); - addr->sin_family = AF_INET; - addr->sin_port = htons(NTP_PORT); - addr->sin_addr.s_addr = htonl(netnum); + memcpy(addr, ptr->ai_addr, ptr->ai_addrlen); #ifdef DEBUG if (debug > 1) - printf("getnetnum given %s, got %s (%lx)\n", - num, ntoa(addr), (u_long)netnum); + printf("getnetnum given %s, got %s \n", + num, stoa(addr)); #endif + freeaddrinfo(ptr); return 1; } -#if !defined(VMS) +#if !defined(VMS) && !defined(SYS_WINNT) /* * catchchild - receive the resolver's exit status */ @@ -2361,7 +2146,7 @@ save_resolve( int version, int minpoll, int maxpoll, - int flags, + u_int flags, int ttl, keyid_t keyid, u_char *keystr @@ -2374,8 +2159,7 @@ save_resolve( #else /* no /tmp directory under NT */ { - DWORD len; - if(!(len = GetTempPath((DWORD)MAX_PATH, (LPTSTR)res_file))) { + if(!(GetTempPath((DWORD)MAX_PATH, (LPTSTR)res_file))) { msyslog(LOG_ERR, "cannot get pathname for temporary directory: %m"); return; } @@ -2388,7 +2172,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); @@ -2409,7 +2193,7 @@ save_resolve( mode, version, minpoll, maxpoll, flags, ttl, keyid, keystr); #ifdef DEBUG if (debug > 1) - printf("config: %s %d %d %d %d %d %d %u %s\n", name, mode, + printf("config: %s %d %d %d %d %x %d %u %s\n", name, mode, version, minpoll, maxpoll, flags, ttl, keyid, keystr); #endif @@ -2513,7 +2297,7 @@ do_resolve_internal(void) */ closelog(); - kill_asyncio(); + kill_asyncio(0); (void) signal_no_reset(SIGCHLD, SIG_DFL); @@ -2568,13 +2352,14 @@ do_resolve_internal(void) */ DWORD dwThreadId; fflush(stdout); - if (!(ResolverThreadHandle = CreateThread( - NULL, /* no security attributes */ - 0, /* use default stack size */ + ResolverThreadHandle = CreateThread( + NULL, /* no security attributes */ + 0, /* use default stack size */ (LPTHREAD_START_ROUTINE) ntp_intres, /* thread function */ - NULL, /* argument to thread function */ - 0, /* use default creation flags */ - &dwThreadId))) { /* returns the thread identifier */ + NULL, /* argument to thread function */ + 0, /* use default creation flags */ + &dwThreadId); /* returns the thread identifier */ + if (ResolverThreadHandle == NULL) { msyslog(LOG_ERR, "CreateThread() failed, can't start ntp_intres"); abort_resolve(); } diff --git a/dist/ntp/ntpd/ntp_control.c b/dist/ntp/ntpd/ntp_control.c index 106a67dcefd9..35027fe532ec 100644 --- a/dist/ntp/ntpd/ntp_control.c +++ b/dist/ntp/ntpd/ntp_control.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_control.c,v 1.5 2002/04/19 20:45:54 drochner Exp $ */ +/* $NetBSD: ntp_control.c,v 1.6 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_control.c - respond to control messages and send async traps @@ -7,21 +7,18 @@ #include #endif -#include -#include -#include -#include -#include - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_control.h" #include "ntp_stdlib.h" -#ifdef PUBKEY -#include "ntp_crypto.h" -#endif /* PUBKEY */ +#include +#include +#include + +#include +#include /* * Structure to hold request procedure information @@ -59,7 +56,7 @@ 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 *)); -static void ctl_putadr P((const char *, u_int32)); +static void ctl_putadr P((const char *, u_int32, struct sockaddr_storage*)); static void ctl_putid P((const char *, char *)); static void ctl_putarray P((const char *, double *, int)); static void ctl_putsys P((int)); @@ -77,7 +74,7 @@ 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 *, +static struct ctl_trap *ctlfindtrap P((struct sockaddr_storage *, struct interface *)); static struct ctl_proc control_codes[] = { @@ -108,22 +105,26 @@ 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 */ -#ifdef PUBKEY - { CS_PRIVATE, RO, "privatekey" }, /* 19 */ - { CS_PUBLIC, RO, "publickey" }, /* 20 */ - { CS_DHPARAMS, RO, "dhparams" }, /* 21 */ - { CS_HOSTNAM, RO, "hostname" }, /* 22 */ - { CS_REVTIME, RO, "revoketime"}, /* 23 */ -#endif /* PUBKEY */ - { 0, EOV, "" } + { CS_VERSION, RO, "version" }, /* 17 */ + { CS_STABIL, RO, "stability" }, /* 18 */ + { CS_VARLIST, RO, "sys_var_list" }, /* 19 */ +#ifdef OPENSSL + { CS_FLAGS, RO, "flags" }, /* 20 */ + { CS_HOST, RO, "hostname" }, /* 21 */ + { CS_PUBLIC, RO, "hostkey" }, /* 22 */ + { CS_CERTIF, RO, "cert" }, /* 23 */ + { CS_REVTIME, RO, "refresh" }, /* 24 */ + { CS_LEAPTAB, RO, "leapseconds" }, /* 25 */ + { CS_TAI, RO, "tai" }, /* 26 */ + { CS_DIGEST, RO, "signature" }, /* 27 */ +#endif /* OPENSSL */ + { 0, EOV, "" } /* 28 */ }; static struct ctl_var *ext_sys_var = (struct ctl_var *)0; @@ -133,6 +134,7 @@ static struct ctl_var *ext_sys_var = (struct ctl_var *)0; * more-or-less) */ static u_char def_sys_var[] = { + CS_VERSION, CS_PROCESSOR, CS_SYSTEM, CS_LEAP, @@ -148,15 +150,17 @@ static u_char def_sys_var[] = { CS_STATE, CS_OFFSET, CS_DRIFT, - CS_COMPLIANCE, + CS_JITTER, CS_STABIL, -#ifdef PUBKEY - CS_PRIVATE, +#ifdef OPENSSL + CS_HOST, + CS_DIGEST, + CS_FLAGS, CS_PUBLIC, - CS_DHPARAMS, - CS_HOSTNAM, CS_REVTIME, -#endif /* PUBKEY */ + CS_LEAPTAB, + CS_CERTIF, +#endif /* OPENSSL */ 0 }; @@ -165,53 +169,55 @@ 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 */ + { 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 */ -#ifdef PUBKEY - { CP_PUBLIC, RO, "publickey" }, /* 38 */ - { CP_SESKEY, RO, "pcookie" }, /* 39 */ - { CP_SASKEY, RO, "hcookie" }, /* 40 */ + { 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_RANK, RO, "rank" }, /* 37 */ + { CP_VARLIST, RO, "peer_var_list" }, /* 38 */ +#ifdef OPENSSL + { CP_FLAGS, RO, "flags" }, /* 39 */ + { CP_HOST, RO, "hostname" }, /* 40 */ { CP_INITSEQ, RO, "initsequence" }, /* 41 */ { CP_INITKEY, RO, "initkey" }, /* 42 */ { CP_INITTSP, RO, "timestamp" }, /* 43 */ -#endif /* PUBKEY */ - { 0, EOV, "" } + { CP_DIGEST, RO, "signature" }, /* 44 */ + { CP_IDENT, RO, "identity" }, /* 45 */ +#endif /* OPENSSL */ + { 0, EOV, "" } /* 39/46 */ }; @@ -223,36 +229,39 @@ static u_char def_peer_var[] = { 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_OFFSET, + CP_DELAY, + CP_DISPERSION, + CP_JITTER, + CP_REFTIME, CP_ORG, CP_REC, CP_XMT, CP_FILTDELAY, CP_FILTOFFSET, CP_FILTERROR, -#ifdef PUBKEY - CP_PUBLIC, - CP_SESKEY, +#ifdef OPENSSL + CP_HOST, + CP_DIGEST, + CP_FLAGS, + CP_IDENT, CP_INITSEQ, -#endif /* PUBKEY */ +#endif /* OPENSSL */ 0 }; @@ -262,21 +271,21 @@ 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, "" } + { 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 */ }; @@ -382,6 +391,13 @@ static u_char clocktypes[] = { CTL_SST_TS_LF, /* REFCLK_PCF (35) */ 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) */ + CTL_SST_TS_LF, /* REFCLK_JJY (40) */ + CTL_SST_TS_UHF, /* REFCLK_TT560 (41) */ + CTL_SST_TS_UHF, /* REFCLK_ZYFER (42) */ + CTL_SST_TS_UHF, /* REFCLK_RIPENCC (43) */ + CTL_SST_TS_UHF, /* REFCLK_NEOCLOCK4X (44) */ }; @@ -426,13 +442,13 @@ 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; static int datalinelen; static int datanotbinflag; -static struct sockaddr_in *rmt_addr; +static struct sockaddr_storage *rmt_addr; static struct interface *lcl_inter; static u_char res_authenticate; @@ -713,20 +729,22 @@ ctlpeerstatus( peer->last_event); } -#ifdef REFCLOCK + /* * ctlclkstatus - return a status word for this clock */ +#ifdef REFCLOCK static u_short ctlclkstatus( struct refclockstat *this_clock ) { - return ((u_short)(this_clock->currentstatus) << 8) | - (u_short)(this_clock->lastevent); + return ((u_short)(((this_clock->currentstatus) << 8) | + (this_clock->lastevent))); } #endif + /* * ctlsysstatus - return the system status word */ @@ -1056,12 +1074,13 @@ ctl_putts( /* - * ctl_putadr - write a dotted quad IP address into the response + * ctl_putadr - write an IP address into the response */ static void ctl_putadr( const char *tag, - u_int32 addr + u_int32 addr32, + struct sockaddr_storage* addr ) { register char *cp; @@ -1074,7 +1093,10 @@ ctl_putadr( *cp++ = *cq++; *cp++ = '='; - cq = numtoa(addr); + if (addr == NULL) + cq = numtoa(addr32); + else + cq = stoa(addr); while (*cq != '\0') *cp++ = *cq++; ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); @@ -1121,7 +1143,6 @@ ctl_putarray( register const char *cq; char buffer[200]; int i; - cp = buffer; cq = tag; while (*cq != '\0') @@ -1148,9 +1169,12 @@ ctl_putsys( ) { l_fp tmp; -#ifdef HAVE_UNAME - char str[50]; -#endif + char str[256]; +#ifdef OPENSSL + struct cert_info *cp; + char cbuf[256]; +#endif /* OPENSSL */ + switch (varid) { case CS_LEAP: @@ -1176,8 +1200,8 @@ ctl_putsys( break; case CS_REFID: - if (sys_stratum > 1) - ctl_putadr(sys_var[CS_REFID].text, sys_refid); + if (sys_stratum > 1 && sys_stratum < STRATUM_UNSPEC) + ctl_putadr(sys_var[CS_REFID].text, sys_refid, NULL); else ctl_putid(sys_var[CS_REFID].text, (char *)&sys_refid); @@ -1211,9 +1235,8 @@ ctl_putsys( 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: @@ -1236,12 +1259,16 @@ ctl_putsys( ctl_putstr(sys_var[CS_SYSTEM].text, str_system, sizeof(str_system) - 1); #else - (void)strcpy(str, utsnamebuf.sysname); - (void)strcat(str, utsnamebuf.release); + sprintf(str, "%s/%s", utsnamebuf.sysname, utsnamebuf.release); ctl_putstr(sys_var[CS_SYSTEM].text, str, strlen(str)); #endif /* HAVE_UNAME */ break; + 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); @@ -1310,35 +1337,60 @@ ctl_putsys( } break; -#ifdef PUBKEY - case CS_PRIVATE: - if (private_key_file != NULL) - ctl_putstr(sys_var[CS_PRIVATE].text, - private_key_file, strlen(private_key_file)); +#ifdef OPENSSL + case CS_FLAGS: + if (crypto_flags) { + ctl_puthex(sys_var[CS_FLAGS].text, crypto_flags); + } + break; + + case CS_DIGEST: + if (crypto_flags) { + const EVP_MD *dp; + + dp = EVP_get_digestbynid(crypto_flags >> 16); + strcpy(str, OBJ_nid2ln(EVP_MD_pkey_type(dp))); + ctl_putstr(sys_var[CS_DIGEST].text, str, + strlen(str)); + } + break; + + case CS_HOST: + if (sys_hostname != NULL) + ctl_putstr(sys_var[CS_HOST].text, sys_hostname, + strlen(sys_hostname)); + break; + + case CS_CERTIF: + for (cp = cinfo; cp != NULL; cp = cp->link) { + sprintf(cbuf, "%s %s 0x%x %u", cp->subject, + cp->issuer, cp->flags, + ntohl(cp->cert.fstamp)); + ctl_putstr(sys_var[CS_CERTIF].text, cbuf, + strlen(cbuf)); + } break; case CS_PUBLIC: - if (public_key_file != NULL) - ctl_putstr(sys_var[CS_PUBLIC].text, - public_key_file, strlen(public_key_file)); - break; - - case CS_DHPARAMS: - if (dh_params_file != NULL) - ctl_putstr(sys_var[CS_DHPARAMS].text, - dh_params_file, strlen(dh_params_file)); - break; - - case CS_HOSTNAM: - if (sys_hostname != NULL) - ctl_putstr(sys_var[CS_HOSTNAM].text, - sys_hostname, sys_hostnamelen); + if (hostval.fstamp != 0) + ctl_putuint(sys_var[CS_PUBLIC].text, + ntohl(hostval.fstamp)); break; case CS_REVTIME: - ctl_putts(sys_var[CS_REVTIME].text, &sys_revoketime); + if (hostval.tstamp != 0) + ctl_putuint(sys_var[CS_REVTIME].text, + ntohl(hostval.tstamp)); break; -#endif /* PUBKEY */ + + 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 /* OPENSSL */ } } @@ -1352,9 +1404,10 @@ ctl_putpeer( struct peer *peer ) { -#ifdef PUBKEY - u_int len; -#endif /* PUBKEY */ +#ifdef OPENSSL + char str[256]; + struct autokey *ap; +#endif /* OPENSSL */ switch (varid) { @@ -1374,29 +1427,24 @@ ctl_putpeer( break; case CP_SRCADR: - ctl_putadr(peer_var[CP_SRCADR].text, - peer->srcadr.sin_addr.s_addr); + ctl_putadr(peer_var[CP_SRCADR].text, 0, + &peer->srcadr); break; case CP_SRCPORT: ctl_putuint(peer_var[CP_SRCPORT].text, - ntohs(peer->srcadr.sin_port)); + ntohs(((struct sockaddr_in*)&peer->srcadr)->sin_port)); break; 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); + ctl_putadr(peer_var[CP_DSTADR].text, 0, + &(peer->dstadr->sin)); break; case CP_DSTPORT: ctl_putuint(peer_var[CP_DSTPORT].text, (u_long)(peer->dstadr ? - ntohs(peer->dstadr->sin.sin_port) : 0)); + ntohs(((struct sockaddr_in*)&peer->dstadr->sin)->sin_port) : 0)); break; case CP_LEAP: @@ -1435,16 +1483,22 @@ ctl_putpeer( break; 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); + if (peer->flags & FLAG_REFCLOCK) { + if (peer->stratum > 0 && peer->stratum < + STRATUM_UNSPEC) + ctl_putadr(peer_var[CP_REFID].text, + peer->refid, NULL); else - ctl_putadr(peer_var[CP_REFID].text, - peer->refid); + ctl_putid(peer_var[CP_REFID].text, + (char *)&peer->refid); } else { - ctl_putid(peer_var[CP_REFID].text, - (char *)&peer->refid); + if (peer->stratum > 1 && peer->stratum < + STRATUM_UNSPEC) + ctl_putadr(peer_var[CP_REFID].text, + peer->refid, NULL); + else + ctl_putid(peer_var[CP_REFID].text, + (char *)&peer->refid); } break; @@ -1472,9 +1526,18 @@ ctl_putpeer( 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: + ctl_putint(peer_var[CP_TTL].text, sys_ttl[peer->ttl]); break; + + case CP_VALID: + ctl_putuint(peer_var[CP_VALID].text, peer->unreach); + break; + + case CP_RANK: + ctl_putuint(peer_var[CP_RANK].text, peer->rank); + break; + case CP_TIMER: ctl_putuint(peer_var[CP_TIMER].text, peer->nextdate - current_time); @@ -1491,7 +1554,7 @@ ctl_putpeer( case CP_JITTER: ctl_putdbl(peer_var[CP_JITTER].text, - SQRT(peer->variance) * 1e3); + SQRT(peer->jitter) * 1e3); break; case CP_DISPERSION: @@ -1568,30 +1631,44 @@ ctl_putpeer( ctl_putdata(buf, (unsigned)(s - buf), 0); } break; -#ifdef PUBKEY - case CP_PUBLIC: - if (peer->keystr == NULL) - break; - len = strlen(peer->keystr); - ctl_putstr(peer_var[CP_PUBLIC].text, peer->keystr, len); +#ifdef OPENSSL + case CP_FLAGS: + if (peer->crypto) + ctl_puthex(peer_var[CP_FLAGS].text, peer->crypto); break; - case CP_SESKEY: - if (peer->pcookie.key != NULL) - ctl_puthex(peer_var[CP_SESKEY].text, - peer->pcookie.key); - if (peer->hcookie != NULL) - ctl_puthex(peer_var[CP_SASKEY].text, peer->hcookie); + case CP_DIGEST: + if (peer->crypto) { + const EVP_MD *dp; + + dp = EVP_get_digestbynid(peer->crypto >> 16); + strcpy(str, OBJ_nid2ln(EVP_MD_pkey_type(dp))); + ctl_putstr(peer_var[CP_DIGEST].text, str, + strlen(str)); + } + break; + + case CP_HOST: + if (peer->subject != NULL) + ctl_putstr(peer_var[CP_HOST].text, peer->subject, + strlen(peer->subject)); + break; + + case CP_IDENT: + if (peer->issuer != NULL) + ctl_putstr(peer_var[CP_IDENT].text, peer->issuer, + strlen(peer->issuer)); break; case CP_INITSEQ: - if (peer->keylist == NULL) + if ((ap = (struct autokey *)peer->recval.ptr) == NULL) 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); + ctl_putint(peer_var[CP_INITSEQ].text, ap->seq); + ctl_puthex(peer_var[CP_INITKEY].text, ap->key); + ctl_putuint(peer_var[CP_INITTSP].text, + ntohl(peer->recval.tstamp)); break; -#endif /* PUBKEY */ +#endif /* OPENSSL */ } } @@ -1661,7 +1738,7 @@ ctl_putclock( if (mustput || (clock_stat->haveflags & CLK_HAVEVAL2)) { if (clock_stat->fudgeval1 > 1) ctl_putadr(clock_var[CC_FUDGEVAL2].text, - (u_int32)clock_stat->fudgeval2); + (u_int32)clock_stat->fudgeval2, NULL); else ctl_putid(clock_var[CC_FUDGEVAL2].text, (char *)&clock_stat->fudgeval2); @@ -1811,29 +1888,28 @@ ctl_getitem( if (*cp == '=') { cp++; tp = buf; - while (cp < reqend && - isspace((int)*cp)) + while (cp < reqend && isspace((int)*cp)) cp++; while (cp < reqend && *cp != ',') { *tp++ = *cp++; if (tp >= buf + sizeof(buf)) { -#if 0 /* don't syslog for now - DoS potential on filling syslog */ + ctl_error(CERR_BADFMT); + numctlbadpkts++; msyslog(LOG_WARNING, - "Attempted \"ntpdx\" exploit from IP %d.%d.%d.%d:%d (possibly spoofed)\n", - (ntohl(rmt_addr->sin_addr.s_addr) >> 24) & 0xff, - (ntohl(rmt_addr->sin_addr.s_addr) >> 16) & 0xff, - (ntohl(rmt_addr->sin_addr.s_addr) >> 8) & 0xff, - (ntohl(rmt_addr->sin_addr.s_addr) >> 0) & 0xff, - ntohs(rmt_addr->sin_port)); -#endif + "Possible 'ntpdx' exploit from %s:%d (possibly spoofed)\n", + stoa(rmt_addr), SRCPORT(rmt_addr) + ); return (0); } } if (cp < reqend) cp++; - *tp = '\0'; - while (tp > buf && isspace((int)(*(tp-1)))) - *(--tp) = '\0'; + *tp-- = '\0'; + while (tp >= buf) { + if (!isspace((int)(*tp))) + break; + *tp-- = '\0'; + } reqpt = cp; *data = buf; return (v); @@ -1865,7 +1941,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; } @@ -1926,7 +2002,7 @@ read_status( 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 { @@ -2025,7 +2101,7 @@ read_variables( * 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; @@ -2075,7 +2151,7 @@ write_variables( register struct ctl_var *v; register int ext_var; char *valuep; - long val; + long val = 0; /* * If he's trying to write into a peer tell him no way @@ -2214,7 +2290,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; @@ -2379,7 +2455,7 @@ unset_trap( */ int ctlsettrap( - struct sockaddr_in *raddr, + struct sockaddr_storage *raddr, struct interface *linter, int traptype, int version @@ -2484,7 +2560,7 @@ ctlsettrap( tptouse->tr_sequence = 1; tptouse->tr_addr = *raddr; tptouse->tr_localaddr = linter; - tptouse->tr_version = version; + tptouse->tr_version = (u_char) version; tptouse->tr_flags = TRAP_INUSE; if (traptype == TRAP_TYPE_CONFIG) tptouse->tr_flags |= TRAP_CONFIGURED; @@ -2500,7 +2576,7 @@ ctlsettrap( */ int ctlclrtrap( - struct sockaddr_in *raddr, + struct sockaddr_storage *raddr, struct interface *linter, int traptype ) @@ -2525,18 +2601,18 @@ ctlclrtrap( */ static struct ctl_trap * ctlfindtrap( - struct sockaddr_in *raddr, + struct sockaddr_storage *raddr, struct interface *linter ) { 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) + && (NSRCPORT(raddr) == NSRCPORT(&tp->tr_addr)) + && SOCKCMP(raddr, &tp->tr_addr) + && (linter == tp->tr_localaddr) ) + return (tp); } return (struct ctl_trap *)NULL; } @@ -2557,7 +2633,7 @@ report_event( * Record error code in proper spots, but have mercy on the * log file. */ - if (!(err & PEER_EVENT)) { + if (!(err & (PEER_EVENT | CRPT_EVENT))) { if (ctl_sys_num_events < CTL_SYS_MAXEVENTS) ctl_sys_num_events++; if (ctl_sys_last_event != (u_char)err) { @@ -2579,10 +2655,10 @@ report_event( #ifdef REFCLOCK if (ISREFCLOCKADR(&peer->srcadr)) - src = refnumtoa(peer->srcadr.sin_addr.s_addr); + src = refnumtoa(&peer->srcadr); else #endif - src = ntoa(&peer->srcadr); + src = stoa(&peer->srcadr); peer->last_event = (u_char)(err & ~PEER_EVENT); if (peer->num_events < CTL_PEER_MAXEVENTS) @@ -2635,10 +2711,10 @@ report_event( * variables. Don't send crypto strings. */ for (i = 1; i <= CS_MAXCODE; i++) { -#ifdef PUBKEY +#ifdef OPENSSL if (i > CS_VARLIST) continue; -#endif /* PUBKEY */ +#endif /* OPENSSL */ ctl_putsys(i); } #ifdef REFCLOCK @@ -2664,7 +2740,7 @@ report_event( strlen(kv->text), 0); free_varlist(clock_stat.kv_list); } -#endif /*REFCLOCK*/ +#endif /* REFCLOCK */ } else { rpkt.associd = htons(peer->associd); rpkt.status = htons(ctlpeerstatus(peer)); @@ -2672,12 +2748,13 @@ report_event( /* * Dump it all. Later, maybe less. */ - for (i = 1; i <= CP_MAXCODE; i++) -#ifdef PUBKEY + for (i = 1; i <= CP_MAXCODE; i++) { +#ifdef OPENSSL if (i > CP_VARLIST) continue; -#endif /* PUBKEY */ +#endif /* OPENSSL */ ctl_putpeer(i, peer); + } #ifdef REFCLOCK /* * for clock exception events: add clock variables to @@ -2703,7 +2780,7 @@ report_event( strlen(kv->text), 0); free_varlist(clock_stat.kv_list); } -#endif /*REFCLOCK*/ +#endif /* REFCLOCK */ } /* @@ -2757,7 +2834,7 @@ char * add_var( struct ctl_var **kv, u_long size, - int def + u_short def ) { register u_long c; @@ -2786,7 +2863,7 @@ set_var( struct ctl_var **kv, const char *data, u_long size, - int def + u_short def ) { register struct ctl_var *k; @@ -2797,7 +2874,8 @@ set_var( if (!data || !size) return; - if ((k = *kv)) { + k = *kv; + if (k != NULL) { while (!(k->flags & EOV)) { s = data; t = k->text; @@ -2832,7 +2910,7 @@ void set_sys_var( char *data, u_long size, - int def + u_short def ) { set_var(&ext_sys_var, data, size, def); diff --git a/dist/ntp/ntpd/ntp_crypto.c b/dist/ntp/ntpd/ntp_crypto.c index a04faebe4221..66a838876e6c 100644 --- a/dist/ntp/ntpd/ntp_crypto.c +++ b/dist/ntp/ntpd/ntp_crypto.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_crypto.c,v 1.2 2003/05/17 01:14:33 itojun Exp $ */ +/* $NetBSD: ntp_crypto.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_crypto.c - NTP version 4 public key routines @@ -7,84 +7,167 @@ #include #endif -#ifdef AUTOKEY +#ifdef OPENSSL #include #include +#include #include +#include #include "ntpd.h" #include "ntp_stdlib.h" +#include "ntp_unixtime.h" #include "ntp_string.h" -#include "ntp_crypto.h" + +#include "openssl/asn1_mac.h" +#include "openssl/bn.h" +#include "openssl/err.h" +#include "openssl/evp.h" +#include "openssl/pem.h" +#include "openssl/rand.h" +#include "openssl/x509v3.h" + +#ifdef KERNEL_PLL +#include "ntp_syscall.h" +#endif /* KERNEL_PLL */ /* - * Extension field message formats + * Extension field message format * - * +-------+-------+ +-------+-------+ +-------+-------+ - * 0 | 3 | len | | 4 | len | | 5 | len | - * +-------+-------+ +-------+-------+ +-------+-------+ - * 1 | assoc ID | | assoc ID | | assoc ID | - * +---------------+ +---------------+ +---------------+ - * 2 | timestamp | | timestamp | | timestamp | - * +---------------+ +---------------+ +---------------+ - * 3 | final seq | | cookie | | value len | - * +---------------+ +---------------+ +---------------+ - * 4 | final key | | signature len | | | - * +---------------+ +---------------+ = value = - * 5 | signature len | | | | | - * +---------------+ = signature = +---------------+ - * 6 | | | | | signature len | - * = signature = +---------------+ +---------------+ - * 7 | | CRYPTO_PRIV rsp | | - * +---------------+ = signature = - * CRYPTO_AUTO rsp | | - * +---------------+ - * CRYPTO_DH rsp - * CRYPTO_NAME rsp - * - * CRYPTO_PUBL 1 request/respond for public key - * CRYPTO_ASSOC 2 request/respond association ID - * CRYPTO_AUTO 3 request/respond autokey values - * CRYPTO_PRIV 4 request/respond cookie - * CRYPTO_DH 5 request public value/respond signature - * CRYPTO_NAME 6 request/respond host name + * These are always signed and saved before sending in network byte + * order. They must be converted to and from host byte order for + * processing. * - * Note: requests carry the association ID of the receiver; responses - * carry the association ID of the sender. + * +-------+-------+ + * | op | len | <- extension pointer + * +-------+-------+ + * | assocID | + * +---------------+ + * | timestamp | <- value pointer + * +---------------+ + * | filestamp | + * +---------------+ + * | value len | + * +---------------+ + * | | + * = value = + * | | + * +---------------+ + * | signature len | + * +---------------+ + * | | + * = signature = + * | | + * +---------------+ + * + * The CRYPTO_RESP bit is set to 0 for requests, 1 for responses. + * Requests carry the association ID of the receiver; responses carry + * the association ID of the sender. Some messages include only the + * operation/length and association ID words and so have length 8 + * octets. Ohers include the value structure and associated value and + * signature fields. These messages include the timestamp, filestamp, + * value and signature words and so have length at least 24 octets. The + * signature and/or value fields can be empty, in which case the + * respective length words are zero. An empty value with nonempty + * signature is syntactically valid, but semantically questionable. + * + * The filestamp represents the time when a cryptographic data file such + * as a public/private key pair is created. It follows every reference + * depending on that file and serves as a means to obsolete earlier data + * of the same type. The timestamp represents the time when the + * cryptographic data of the message were last signed. Creation of a + * cryptographic data file or signing a message can occur only when the + * creator or signor is synchronized to an authoritative source and + * proventicated to a trusted authority. + * + * Note there are four conditions required for server trust. First, the + * public key on the certificate must be verified, which involves a + * number of format, content and consistency checks. Next, the server + * identity must be confirmed by one of four schemes: private + * certificate, IFF scheme, GQ scheme or certificate trail hike to a + * self signed trusted certificate. Finally, the server signature must + * be verified. */ - -#ifdef PUBKEY /* * Cryptodefines */ -#define MAX_KEYLEN 1024 /* maximum key length */ +#define TAI_1972 10 /* initial TAI offset (s) */ +#define MAX_LEAP 100 /* max UTC leapseconds (s) */ +#define VALUE_LEN (6 * 4) /* min response field length */ +#define YEAR (60 * 60 * 24 * 365) /* seconds in year */ /* - * Cryptodata + * Global cryptodata in host byte order */ -static R_DH_PARAMS dh_params; /* Diffie-Hellman parameters */ -static u_int dh_keyLen; /* Diffie-Hellman key length */ -static u_char *dh_public; /* Diffie-Hellman public value */ -static u_char *dh_private; /* Diffie-Hellman private value */ -static R_RSA_PRIVATE_KEY private_key; /* RSA private key */ -static R_RSA_PUBLIC_KEY public_key; /* RSA public key */ -static u_char *dh_sign = NULL; /* Diffie-Hellman public signature */ -static struct value host; /* host name, timestamp and signature */ +u_int32 crypto_flags = 0x0; /* status word */ +u_int sys_tai; /* current UTC offset from TAI */ -int crypto_enable; /* master switch */ -int crypto_flags; /* flags that wave cryptically */ -char *private_key_file = NULL; /* private key file */ -char *public_key_file = NULL; /* public key file */ -char *dh_params_file = NULL; /* D-H parameters file */ -char *keysdir = "/usr/local/etc/"; /* crypto keys directory */ +/* + * Global cryptodata in network byte order + */ +struct cert_info *cinfo = NULL; /* certificate info/value */ +struct value hostval; /* host value */ +struct value pubkey; /* public key */ +struct value tai_leap; /* leapseconds table */ + +/* + * Private cryptodata in host byte order + */ +static char *passwd = NULL; /* private key password */ +static EVP_PKEY *host_pkey = NULL; /* host key */ +static EVP_PKEY *sign_pkey = NULL; /* sign key */ +static EVP_PKEY *iffpar_pkey = NULL; /* IFF parameters */ +static EVP_PKEY *gqpar_pkey = NULL; /* GQ parameters */ +static EVP_PKEY *mvpar_pkey = NULL; /* MV parameters */ +static const EVP_MD *sign_digest = NULL; /* sign digest */ +static u_int sign_siglen; /* sign key length */ +static char *rand_file = NULL; /* random seed file */ +static char *host_file = NULL; /* host key file */ +static char *sign_file = NULL; /* sign key file */ +static char *iffpar_file = NULL; /* IFF parameters file */ +static char *gqpar_file = NULL; /* GQ parameters file */ +static char *mvpar_file = NULL; /* MV parameters file */ +static char *cert_file = NULL; /* certificate file */ +static char *leap_file = NULL; /* leapseconds file */ +static tstamp_t if_fstamp = 0; /* IFF file stamp */ +static tstamp_t gq_fstamp = 0; /* GQ file stamp */ +static tstamp_t mv_fstamp = 0; /* MV file stamp */ /* * Cryptotypes */ -static int crypto_read P((u_char *, u_char *, u_int)); -static void crypto_line P((FILE *, u_char **, u_int *)); -#endif /* PUBKEY */ +static int crypto_verify P((struct exten *, struct value *, + struct peer *)); +static int crypto_encrypt P((struct exten *, struct value *, + keyid_t *)); +static int crypto_alice P((struct peer *, struct value *)); +static int crypto_alice2 P((struct peer *, struct value *)); +static int crypto_alice3 P((struct peer *, struct value *)); +static int crypto_bob P((struct exten *, struct value *)); +static int crypto_bob2 P((struct exten *, struct value *)); +static int crypto_bob3 P((struct exten *, struct value *)); +static int crypto_iff P((struct exten *, struct peer *)); +static int crypto_gq P((struct exten *, struct peer *)); +static int crypto_mv P((struct exten *, struct peer *)); +static u_int crypto_send P((struct exten *, struct value *)); +static tstamp_t crypto_time P((void)); +static u_long asn2ntp P((ASN1_TIME *)); +static struct cert_info *cert_parse P((u_char *, u_int, tstamp_t)); +static int cert_sign P((struct exten *, struct value *)); +static int cert_valid P((struct cert_info *, EVP_PKEY *)); +static int cert_install P((struct exten *, struct peer *)); +static void cert_free P((struct cert_info *)); +static EVP_PKEY *crypto_key P((char *, tstamp_t *)); +static int bighash P((BIGNUM *, BIGNUM *)); +static struct cert_info *crypto_cert P((char *)); +static void crypto_tai P((char *)); +#ifdef SYS_WINNT +int +readlink(char * link, char * file, int len) { + return (-1); +} +#endif /* * session_key - generate session key @@ -93,43 +176,61 @@ static void crypto_line P((FILE *, u_char **, u_int *)); * 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. + * + * Returns the next key ID */ -keyid_t /* returns next key ID */ +keyid_t 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 */ + struct sockaddr_storage *srcadr, /* source address */ + struct sockaddr_storage *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 */ + EVP_MD_CTX ctx; /* message digest context */ + u_char dgst[EVP_MAX_MD_SIZE]; /* message digest */ + keyid_t keyid; /* key identifer */ + u_int32 header[10]; /* data in network byte order */ + u_int hdlen, len; /* * 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); + hdlen = 0; + switch(srcadr->ss_family) { + case AF_INET: + header[0] = ((struct sockaddr_in *)srcadr)->sin_addr.s_addr; + header[1] = ((struct sockaddr_in *)dstadr)->sin_addr.s_addr; + header[2] = htonl(keyno); + header[3] = htonl(private); + hdlen = 4 * sizeof(u_int32); + break; + case AF_INET6: + memcpy(&header[0], &GET_INADDR6(*srcadr), + sizeof(struct in6_addr)); + memcpy(&header[4], &GET_INADDR6(*dstadr), + sizeof(struct in6_addr)); + header[8] = htonl(keyno); + header[9] = htonl(private); + hdlen = 10 * sizeof(u_int32); + break; + } + EVP_DigestInit(&ctx, EVP_md5()); + EVP_DigestUpdate(&ctx, (u_char *)header, hdlen); + EVP_DigestFinal(&ctx, dgst, &len); + memcpy(&keyid, dgst, 4); keyid = ntohl(keyid); if (lifetime != 0) { - MD5auth_setkey(keyno, digest, 16); + MD5auth_setkey(keyno, dgst, len); 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, + stoa(srcadr), stoa(dstadr), keyno, private, keyid, lifetime); #endif return (keyid); @@ -147,29 +248,26 @@ session_key( */ void make_keylist( - struct peer *peer /* peer structure pointer */ + struct peer *peer, /* peer structure pointer */ + struct interface *dstadr /* interface */ ) { + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; /* NTP timestamp */ 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 */ + struct value *vp; /* value pointer */ + keyid_t keyid = 0; /* next key ID */ + keyid_t cookie; /* private value */ + u_long lifetime; + u_int len; + int i; /* * Allocate the key list if necessary. */ - L_CLR(&tstamp); - if (sys_leap != LEAP_NOTINSYNC) - get_systime(&tstamp); + tstamp = crypto_time(); if (peer->keylist == NULL) - peer->keylist = (keyid_t *)emalloc(sizeof(keyid_t) * + peer->keylist = emalloc(sizeof(keyid_t) * NTP_MAXSESSION); /* @@ -192,66 +290,57 @@ make_keylist( * included in the hash is zero if broadcast mode, the peer * cookie if client mode or the host cookie if symmetric modes. */ - ltemp = sys_automax; - peer->hcookie = session_key(&peer->dstadr->sin, &peer->srcadr, - 0, sys_private, 0); - if (peer->hmode == MODE_BROADCAST) { + lifetime = min(sys_automax, (unsigned long) NTP_MAXSESSION * (1 <<(peer->kpoll))); + if (peer->hmode == MODE_BROADCAST) cookie = 0; - } else { -#ifdef PUBKEY - cookie = peer->pcookie.key; -#else - if (peer->hmode == MODE_CLIENT) - cookie = peer->pcookie.key; - else - cookie = peer->hcookie ^ peer->pcookie.key; -#endif /* PUBKEY */ - } + else + cookie = peer->pcookie; for (i = 0; i < NTP_MAXSESSION; i++) { peer->keylist[i] = keyid; peer->keynumber = i; - keyid = session_key(&peer->dstadr->sin, (peer->hmode == - MODE_BROADCAST) ? &peer->dstadr->bcast : - &peer->srcadr, keyid, cookie, ltemp); - ltemp -= 1 << peer->hpoll; + keyid = session_key(&dstadr->sin, &peer->srcadr, keyid, + cookie, lifetime); + lifetime -= 1 << peer->kpoll; if (auth_havekey(keyid) || keyid <= NTP_MAXKEY || - ltemp <= (1 << (peer->hpoll + 1))) + lifetime <= (unsigned long)(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. + * careful not to use invalid key media. Use the public values + * timestamp as filestamp. */ - ap = &peer->sndauto; - ap->tstamp = htonl(tstamp.l_ui); + vp = &peer->sndval; + if (vp->ptr == NULL) + vp->ptr = emalloc(sizeof(struct autokey)); + ap = (struct autokey *)vp->ptr; ap->seq = htonl(peer->keynumber); ap->key = htonl(keyid); - ap->siglen = 0; -#if DEBUG - if (debug) - printf("make_keys: %d %08x %08x ts %u\n", ntohl(ap->seq), - ntohl(ap->key), cookie, ntohl(ap->tstamp)); -#endif -#ifdef PUBKEY - if(!crypto_enable) - return; - if (private_key.bits < MIN_RSA_MODULUS_BITS || - private_key.bits > MAX_RSA_MODULUS_BITS) { - rval = -1; - } else { - if (ap->sig == NULL) - ap->sig = emalloc(MAX_SIGNATURE_LEN); - R_SignInit(&ctx, DA_MD5); - R_SignUpdate(&ctx, (u_char *)ap, 12); - rval = R_SignFinal(&ctx, ap->sig, &len, &private_key); - ap->siglen = htonl(len); + vp->tstamp = htonl(tstamp); + vp->fstamp = hostval.tstamp; + vp->vallen = htonl(sizeof(struct autokey)); + vp->siglen = 0; + if (vp->tstamp != 0) { + if (vp->sig == NULL) + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)vp, 12); + EVP_SignUpdate(&ctx, vp->ptr, sizeof(struct autokey)); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + else + msyslog(LOG_ERR, "make_keys %s\n", + ERR_error_string(ERR_get_error(), NULL)); + peer->flags |= FLAG_ASSOC; } - if (rval != 0) - msyslog(LOG_ERR, "make_keylist: signature fails %x", - rval); -#endif /* PUBKEY */ +#ifdef DEBUG + if (debug) + printf("make_keys: %d %08x %08x ts %u fs %u poll %d\n", + ntohl(ap->seq), ntohl(ap->key), cookie, + ntohl(vp->tstamp), ntohl(vp->fstamp), peer->kpoll); +#endif } @@ -259,303 +348,782 @@ make_keylist( * crypto_recv - parse extension fields * * This routine is called when the packet has been matched to an - * association and passed sanity, format and authentication checks. We - * believe the extension field values only if the public key is valid - * and the signature has valid length and is verified. + * 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 proventic + * bit is not set. */ -void +int 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 */ - u_int tstamp; /* extension field timestamp */ - int i; - u_int temp; -#ifdef PUBKEY - R_SIGNATURE_CTX ctx; /* signature context */ - u_char dh_key[MAX_DH_LEN]; /* Diffie-Hellman agreed key */ - u_int modulus; - int rval; - int j; -#endif /* PUBKEY */ + const EVP_MD *dp; /* message digest algorithm */ + u_int32 *pkt; /* receive packet pointer */ + struct autokey *ap, *bp; /* autokey pointer */ + struct exten *ep, *fp; /* extension pointers */ + int has_mac; /* length of MAC field */ + int authlen; /* offset of MAC field */ + associd_t associd; /* association ID */ + tstamp_t tstamp = 0; /* timestamp */ + tstamp_t fstamp = 0; /* filestamp */ + u_int len; /* extension field length */ + u_int code; /* extension field opcode */ + u_int vallen = 0; /* value length */ + X509 *cert; /* X509 certificate */ + char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */ + keyid_t cookie; /* crumbles */ + int rval = XEVNT_OK; + u_char *ptr; + u_int32 temp32; +#ifdef KERNEL_PLL +#if NTP_API > 3 + struct timex ntv; /* kernel interface structure */ +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ /* * Initialize. Note that the packet has already been checked for - * valid format and extension field lengths. + * valid format and extension field lengths. First extract the + * field length, command code and association ID in host byte + * order. These are used with all commands and modes. Then check + * the version number, which must be 2, and length, which must + * be at least 8 for requests and VALUE_LEN (24) for responses. + * Packets that fail either test sink without a trace. The + * association ID is saved only if nonzero. */ - 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; - tstamp = ntohl(pkt[i + 2]); - if (code & CRYPTO_RESP) - peer->assoc = ntohl(pkt[i + 1]); + pkt = (u_int32 *)&rbufp->recv_pkt + authlen / 4; + ep = (struct exten *)pkt; + code = ntohl(ep->opcode) & 0xffff0000; + len = ntohl(ep->opcode) & 0x0000ffff; + associd = (associd_t) ntohl(pkt[1]); + rval = XEVNT_OK; #ifdef DEBUG if (debug) printf( - "crypto_recv: ext offset %d len %d code %x assoc ID %d\n", - authlen, len, code, (u_int32)ntohl(pkt[i + - 1])); + "crypto_recv: flags 0x%x ext offset %d len %u code %x assocID %d\n", + peer->crypto, authlen, len, code >> 16, + associd); #endif + + /* + * Check version number and field length. If bad, + * quietly ignore the packet. + */ + if (((code >> 24) & 0x3f) != CRYPTO_VN || len < 8 || + (len < VALUE_LEN && (code & CRYPTO_RESP))) { + sys_unknownversion++; + code |= CRYPTO_ERROR; + } + + /* + * Little vulnerability bandage here. If a perp tosses a + * fake association ID over the fence, we better toss it + * out. Only the first one counts. + */ + if (code & CRYPTO_RESP) { + if (peer->assoc == 0) + peer->assoc = associd; + else if (peer->assoc != associd) + code |= CRYPTO_ERROR; + } + if (len >= VALUE_LEN) { + tstamp = ntohl(ep->tstamp); + fstamp = ntohl(ep->fstamp); + vallen = ntohl(ep->vallen); + } switch (code) { /* - * Exchange association IDs. This is used in multicast - * server mode and is a NOP here. + * Install status word, host name, signature scheme and + * association ID. In OpenSSL the signature algorithm is + * bound to the digest algorithm, so the NID completely + * defines the signature scheme. Note the request and + * response are identical, but neither is validated by + * signature. The request is processed here only in + * symmetric modes. The server name field would be + * useful to implement access controls in future. */ + case CRYPTO_ASSOC: + + /* + * Pass the extension field to the transmit + * side. + */ + fp = emalloc(len); + memcpy(fp, ep, len); + temp32 = CRYPTO_RESP; + fp->opcode |= htonl(temp32); + peer->cmmd = fp; + /* fall through */ + case CRYPTO_ASSOC | CRYPTO_RESP: + + /* + * Discard the message if it has already been + * stored or the server is not synchronized. + */ + if (peer->crypto || !fstamp) + break; + + if (len < VALUE_LEN + vallen) { + rval = XEVNT_LEN; + break; + } + + /* + * Check the identity schemes are compatible. If + * the client has PC, the server must have PC, + * in which case the server public key and + * identity are presumed valid, so we skip the + * certificate and identity exchanges and move + * immediately to the cookie exchange which + * confirms the server signature. If the client + * has IFF or GC or both, the server must have + * the same one or both. Otherwise, the default + * TC scheme is used. + */ + if (crypto_flags & CRYPTO_FLAG_PRIV) { + if (!(fstamp & CRYPTO_FLAG_PRIV)) + rval = XEVNT_KEY; + else + fstamp |= CRYPTO_FLAG_VALID | + CRYPTO_FLAG_VRFY; + } else if (crypto_flags & CRYPTO_FLAG_MASK && + !(crypto_flags & fstamp & + CRYPTO_FLAG_MASK)) { + rval = XEVNT_KEY; + } + + /* + * Discard the message if identity error. + */ + if (rval != XEVNT_OK) + break; + + /* + * Discard the message if the host name length + * is unreasonable or the signature digest NID + * is not supported. + */ + temp32 = (fstamp >> 16) & 0xffff; + dp = + (const EVP_MD *)EVP_get_digestbynid(temp32); + if (vallen == 0 || vallen > MAXHOSTNAME) + rval = XEVNT_LEN; + else if (dp == NULL) + rval = XEVNT_MD; + if (rval != XEVNT_OK) + break; + + /* + * Save status word, host name and message + * digest/signature type. If PC identity, be + * sure not to sign the certificate. + */ + if (crypto_flags & CRYPTO_FLAG_PRIV) + fstamp |= CRYPTO_FLAG_SIGN; + peer->crypto = fstamp; + peer->digest = dp; + peer->subject = emalloc(vallen + 1); + memcpy(peer->subject, ep->pkt, vallen); + peer->subject[vallen] = '\0'; + peer->issuer = emalloc(vallen + 1); + strcpy(peer->issuer, peer->subject); + temp32 = (fstamp >> 16) & 0xffff; + sprintf(statstr, + "flags 0x%x host %s signature %s", fstamp, + peer->subject, OBJ_nid2ln(temp32)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * Decode X509 certificate in ASN.1 format and extract + * the data containing, among other things, subject + * name and public key. In the default identification + * scheme, the certificate trail is followed to a self + * signed trusted certificate. + */ + case CRYPTO_CERT | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * already confirmed. + */ + if (peer->crypto & CRYPTO_FLAG_VRFY) + break; + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) + break; + + /* + * Scan the certificate list to delete old + * versions and link the newest version first on + * the list. + */ + if ((rval = cert_install(ep, peer)) != XEVNT_OK) + break; + + /* + * If we snatch the certificate before the + * server certificate has been signed by its + * server, it will be self signed. When it is, + * we chase the certificate issuer, which the + * server has, and keep going until a self + * signed trusted certificate is found. Be sure + * to update the issuer field, since it may + * change. + */ + if (peer->issuer != NULL) + free(peer->issuer); + peer->issuer = emalloc(strlen(cinfo->issuer) + + 1); + strcpy(peer->issuer, cinfo->issuer); + + /* + * We plug in the public key and group key in + * the first certificate received. However, note + * that this certificate might not be signed by + * the server, so we can't check the + * signature/digest NID. + */ + if (peer->pkey == NULL) { + ptr = (u_char *)cinfo->cert.ptr; + cert = d2i_X509(NULL, &ptr, + ntohl(cinfo->cert.vallen)); + peer->pkey = X509_get_pubkey(cert); + X509_free(cert); + } + peer->flash &= ~TEST10; + temp32 = cinfo->nid; + sprintf(statstr, "cert %s 0x%x %s (%u) fs %u", + cinfo->subject, cinfo->flags, + OBJ_nid2ln(temp32), temp32, + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * Schnorr (IFF)identity scheme. This scheme is designed + * for use with shared secret group keys and where the + * certificate may be generated by a third party. The + * client sends a challenge to the server, which + * performs a calculation and returns the result. A + * positive result is possible only if both client and + * server contain the same secret group key. + */ + case CRYPTO_IFF | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * already confirmed. + */ + if (peer->crypto & CRYPTO_FLAG_VRFY) + break; + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) + break; + + /* + * If the the challenge matches the response, + * the certificate public key, as well as the + * server public key, signatyre and identity are + * all verified at the same time. The server is + * declared trusted, so we skip further + * certificate stages and move immediately to + * the cookie stage. + */ + if ((rval = crypto_iff(ep, peer)) != XEVNT_OK) + break; + + peer->crypto |= CRYPTO_FLAG_VRFY | + CRYPTO_FLAG_PROV; + peer->flash &= ~TEST10; + sprintf(statstr, "iff fs %u", + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * Guillou-Quisquater (GQ) identity scheme. This scheme + * is designed for use with public certificates carrying + * the GQ public key in an extension field. The client + * sends a challenge to the server, which performs a + * calculation and returns the result. A positive result + * is possible only if both client and server contain + * the same group key and the server has the matching GQ + * private key. + */ + case CRYPTO_GQ | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * already confirmed. + */ + if (peer->crypto & CRYPTO_FLAG_VRFY) + break; + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) + break; + + /* + * If the the challenge matches the response, + * the certificate public key, as well as the + * server public key, signatyre and identity are + * all verified at the same time. The server is + * declared trusted, so we skip further + * certificate stages and move immediately to + * the cookie stage. + */ + if ((rval = crypto_gq(ep, peer)) != XEVNT_OK) + break; + + peer->crypto |= CRYPTO_FLAG_VRFY | + CRYPTO_FLAG_PROV; + peer->flash &= ~TEST10; + sprintf(statstr, "gq fs %u", + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * MV + */ + case CRYPTO_MV | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * already confirmed. + */ + if (peer->crypto & CRYPTO_FLAG_VRFY) + break; + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) + break; + + /* + * If the the challenge matches the response, + * the certificate public key, as well as the + * server public key, signatyre and identity are + * all verified at the same time. The server is + * declared trusted, so we skip further + * certificate stages and move immediately to + * the cookie stage. + */ + if ((rval = crypto_mv(ep, peer)) != XEVNT_OK) + break; + + peer->crypto |= CRYPTO_FLAG_VRFY | + CRYPTO_FLAG_PROV; + peer->flash &= ~TEST10; + sprintf(statstr, "mv fs %u", + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * X509 certificate sign response. Validate the + * certificate signed by the server and install. Later + * this can be provided to clients of this server in + * lieu of the self signed certificate in order to + * validate the public key. + */ + case CRYPTO_SIGN | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * not confirmed. + */ + if (!(peer->crypto & CRYPTO_FLAG_VRFY)) + break; + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) + break; + + /* + * Scan the certificate list to delete old + * versions and link the newest version first on + * the list. + */ + if ((rval = cert_install(ep, peer)) != XEVNT_OK) break; + + peer->crypto |= CRYPTO_FLAG_SIGN; + peer->flash &= ~TEST10; + temp32 = cinfo->nid; + sprintf(statstr, "sign %s 0x%x %s (%u) fs %u", + cinfo->issuer, cinfo->flags, + OBJ_nid2ln(temp32), temp32, + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * Cookie request in symmetric modes. Roll a random + * cookie and install in symmetric mode. Encrypt for the + * response, which is transmitted later. + */ + case CRYPTO_COOK: + + /* + * Discard the message if invalid or identity + * not confirmed. + */ + if (!(peer->crypto & CRYPTO_FLAG_VRFY)) + break; + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) + break; + + /* + * Pass the extension field to the transmit + * side. If already agreed, walk away. + */ + fp = emalloc(len); + memcpy(fp, ep, len); + temp32 = CRYPTO_RESP; + fp->opcode |= htonl(temp32); + peer->cmmd = fp; + if (peer->crypto & CRYPTO_FLAG_AGREE) { + peer->flash &= ~TEST10; + break; + } + + /* + * Install cookie values and light the cookie + * bit. The transmit side will pick up and + * encrypt it for the response. + */ + key_expire(peer); + peer->cookval.tstamp = ep->tstamp; + peer->cookval.fstamp = ep->fstamp; + RAND_bytes((u_char *)&peer->pcookie, 4); + peer->crypto &= ~CRYPTO_FLAG_AUTO; + peer->crypto |= CRYPTO_FLAG_AGREE; + peer->flash &= ~TEST10; + sprintf(statstr, "cook %x ts %u fs %u", + peer->pcookie, ntohl(ep->tstamp), + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; + + /* + * Cookie response in client and symmetric modes. If the + * cookie bit is set, the working cookie is the EXOR of + * the current and new values. + */ + case CRYPTO_COOK | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * not confirmed or signature not verified with + * respect to the cookie values. + */ + if (!(peer->crypto & CRYPTO_FLAG_VRFY)) + break; + + if ((rval = crypto_verify(ep, &peer->cookval, + peer)) != XEVNT_OK) + break; + + /* + * Decrypt the cookie, hunting all the time for + * errors. + */ + if (vallen == (u_int) EVP_PKEY_size(host_pkey)) { + RSA_private_decrypt(vallen, + (u_char *)ep->pkt, + (u_char *)&temp32, + host_pkey->pkey.rsa, + RSA_PKCS1_OAEP_PADDING); + cookie = ntohl(temp32); + } else { + rval = XEVNT_CKY; + break; + } + + /* + * Install cookie values and light the cookie + * bit. If this is not broadcast client mode, we + * are done here. + */ + key_expire(peer); + peer->cookval.tstamp = ep->tstamp; + peer->cookval.fstamp = ep->fstamp; + if (peer->crypto & CRYPTO_FLAG_AGREE) + peer->pcookie ^= cookie; + else + peer->pcookie = cookie; + if (peer->hmode == MODE_CLIENT && + !(peer->cast_flags & MDF_BCLNT)) + peer->crypto |= CRYPTO_FLAG_AUTO; + else + peer->crypto &= ~CRYPTO_FLAG_AUTO; + peer->crypto |= CRYPTO_FLAG_AGREE; + peer->flash &= ~TEST10; + sprintf(statstr, "cook %x ts %u fs %u", + peer->pcookie, ntohl(ep->tstamp), + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif break; /* * Install autokey values in broadcast client and - * symmetric modes. We believe the values only if the - * public key is valid and the signature has valid - * length and is verified. However, we mark as authentic - * only if the timestamp is nonzero. + * symmetric modes. We have to do this every time the + * sever/peer cookie changes or a new keylist is + * rolled. Ordinarily, this is automatic as this message + * is piggybacked on the first NTP packet sent upon + * either of these events. Note that a broadcast client + * or symmetric peer can receive this response without a + * matching request. */ case CRYPTO_AUTO | CRYPTO_RESP: - ap = (struct autokey *)&pkt[i + 2]; -#ifdef PUBKEY - temp = public_key.bits / 8; - if (!crypto_enable) { - rval = 0; - } else if (tstamp < peer->recauto.tstamp) { - break; - } else if (peer->pubkey == NULL || temp != - ntohl(ap->siglen)) { - rval = -1; - } else { - R_VerifyInit(&ctx, DA_MD5); - R_VerifyUpdate(&ctx, (u_char *)ap, 12); - rval = R_VerifyFinal(&ctx, - (u_char *)&ap->sig, temp, - (R_RSA_PUBLIC_KEY *)peer->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 != 0) { - peer->flags &= ~FLAG_AUTOKEY; - break; - } - if (tstamp != 0) - peer->flags |= FLAG_AUTOKEY; -#endif /* PUBKEY */ - peer->flash &= ~TEST10; - peer->recauto.tstamp = ntohl(ap->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. We believe the - * value only if the public key is valid and the - * signature has valid length and is verified. However, - * we mark as authentic only if the value is nonzero. - */ - case CRYPTO_PRIV | CRYPTO_RESP: - cp = (struct cookie *)&pkt[i + 2]; -#ifdef PUBKEY - temp = public_key.bits / 8; - if (!crypto_enable) { - rval = 0; - } else if (tstamp < peer->pcookie.tstamp) { - break; - } else if (peer->pubkey == NULL || temp != - ntohl(cp->siglen)) { - rval = -1; - } else { - R_VerifyInit(&ctx, DA_MD5); - R_VerifyUpdate(&ctx, (u_char *)cp, 8); - rval = R_VerifyFinal(&ctx, - (u_char *)&cp->sig, temp, - (R_RSA_PUBLIC_KEY *)peer->pubkey); - } - temp = cp->key; -#ifdef DEBUG - if (debug) - printf( - "crypto_recv: verify %x cookie %08x ts %u\n", - rval, temp, tstamp); -#endif - if (rval != 0) { - peer->flags &= ~FLAG_AUTOKEY; - break; - } - if (tstamp != 0) - peer->flags |= FLAG_AUTOKEY; -#else - temp = cp->key; -#endif /* PUBKEY */ - peer->flash &= ~TEST10; - if (temp != peer->pcookie.key) { - key_expire(peer); - peer->pcookie.tstamp = tstamp; - peer->pcookie.key = temp; - } - break; - -#ifdef PUBKEY - /* - * Verify Diffie-Hellman public value and compute key - * agreement in symmetric modes. We believe the - * value only if the public key is valid and the - * signature has valid length and is verified. - */ - case CRYPTO_DH: - peer->cmmd = ntohl(pkt[i]); - /* fall through */ - - case CRYPTO_DH | CRYPTO_RESP: - temp = ntohl(pkt[i + 3]); - j = i + 4 + temp / 4; - if (tstamp < peer->pcookie.tstamp) { - break; - } else if (peer->pubkey == NULL || - ntohl(pkt[j]) != public_key.bits / 8) { - rval = -1; - } else if (temp != dh_params.primeLen || - dh_public == NULL) { - rval = -2; - } else { - R_VerifyInit(&ctx, DA_MD5); - R_VerifyUpdate(&ctx, (u_char *)&pkt[i + - 2], temp + 8); - rval = R_VerifyFinal(&ctx, - (u_char *)&pkt[j + 1], - public_key.bits / 8, - (R_RSA_PUBLIC_KEY *)peer->pubkey); - } /* - * Run the agreement algorithm and stash the key - * value. We use only the first u_int32 for the - * host cookie. Wasteful. + * Discard the message if invalid or identity + * not confirmed or signature not verified with + * respect to the receive autokey values. */ - if (rval != 0) { - temp = 0; - } else { - rval = R_ComputeDHAgreedKey(dh_key, - (u_char *)&pkt[i + 4], dh_private, - dh_keyLen, &dh_params); - temp = ntohl(*(u_int32 *)dh_key); - } -#ifdef DEBUG - if (debug) - printf( - "crypto_recv: verify %x d-h %08x ts %u\n", - rval, temp, tstamp); -#endif - if (rval != 0) { - peer->flags &= ~FLAG_AUTOKEY; - peer->cmmd = 0; + if (!(peer->crypto & CRYPTO_FLAG_VRFY)) break; - } + + if ((rval = crypto_verify(ep, &peer->recval, + peer)) != XEVNT_OK) + break; + + /* + * Install autokey values and light the + * autokey bit. This is not hard. + */ + if (peer->recval.ptr == NULL) + peer->recval.ptr = + emalloc(sizeof(struct autokey)); + bp = (struct autokey *)peer->recval.ptr; + peer->recval.tstamp = ep->tstamp; + peer->recval.fstamp = ep->fstamp; + ap = (struct autokey *)ep->pkt; + bp->seq = ntohl(ap->seq); + bp->key = ntohl(ap->key); + peer->pkeyid = bp->key; + peer->crypto |= CRYPTO_FLAG_AUTO; peer->flash &= ~TEST10; - if (temp != peer->pcookie.key) { - key_expire(peer); - peer->pcookie.tstamp = tstamp; - peer->pcookie.key = temp; - } - break; - - /* - * Receive remote host name and install public key from - * file. - */ - case CRYPTO_NAME | CRYPTO_RESP: - temp = ntohl(pkt[i + 3]); - j = i + 4 + temp / 4; - if (tstamp < peer->pcookie.tstamp) { - break; - } else if (ntohl(pkt[j]) != public_key.bits / 8) - { - rval = -1; - } else if (crypto_public(peer, (char *)&pkt[i + - 4])) { - R_VerifyInit(&ctx, DA_MD5); - - R_VerifyUpdate(&ctx, (char *)&pkt[i + - 2], 8 + temp); - - rval = R_VerifyFinal(&ctx, - (u_char *)&pkt[j + 1], - public_key.bits / 8, - (R_RSA_PUBLIC_KEY *)peer->pubkey); - if (rval != 0) { - free(peer->pubkey); - peer->pubkey = NULL; - } - } else { - rval = -2; - } + sprintf(statstr, + "auto seq %d key %x ts %u fs %u", bp->seq, + bp->key, ntohl(ep->tstamp), + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); #ifdef DEBUG if (debug) - - printf( - "crypto_recv: verify %x host %s ts %u\n", - rval, (char *)&pkt[i + 4], tstamp); + printf("crypto_recv: %s\n", statstr); #endif break; /* - * Install peer public key. This is rather raucus, since - * the extension field is in network order and the first - * word is a u_int32; however, the corresponding word of - * the key is a u_int, which can be 32 or 64 bits - * depending on architecture. We don't do anything - * unless the length and modulus are valid. Picky, - * picky. + * Install leapseconds table in symmetric modes. This + * table is proventicated to the NIST primary servers, + * either by copying the file containing the table from + * a NIST server to a trusted server or directly using + * this protocol. While the entire table is installed at + * the server, presently only the current TAI offset is + * provided via the kernel to other applications. */ - case CRYPTO_PUBL | CRYPTO_RESP: - temp = sizeof(R_RSA_PUBLIC_KEY) - sizeof(u_int); - if (ntohl(pkt[i + 2]) != temp + 4) + case CRYPTO_TAI: + + /* + * Discard the message if invalid or identity + * not confirmed. + */ + if (!(peer->crypto & CRYPTO_FLAG_VRFY)) break; - modulus = ntohl(pkt[i + 3]); - if ( modulus < MIN_RSA_MODULUS_BITS || - modulus > MAX_RSA_MODULUS_BITS) + + if ((rval = crypto_verify(ep, NULL, peer)) != + XEVNT_OK) break; - if (peer->pubkey == NULL) - peer->pubkey = - emalloc(sizeof(R_RSA_PUBLIC_KEY)); - ((R_RSA_PUBLIC_KEY *)peer->pubkey)->bits = - modulus; - memcpy( - ((R_RSA_PUBLIC_KEY *)peer->pubkey)->modulus, - (u_char *)&(pkt[i + 4]), temp); + + /* + * Pass the extension field to the transmit + * side. Continue below if a leapseconds table + * accompanies the message. + */ + fp = emalloc(len); + memcpy(fp, ep, len); + temp32 = CRYPTO_RESP; + fp->opcode |= htonl(temp32); + peer->cmmd = fp; + if (len <= VALUE_LEN) { + peer->flash &= ~TEST10; + break; + } + /* fall through */ + + case CRYPTO_TAI | CRYPTO_RESP: + + /* + * Discard the message if invalid or identity + * not confirmed or signature not verified with + * respect to the leapsecond table values. + */ + if (!(peer->crypto & CRYPTO_FLAG_VRFY)) + break; + + if ((rval = crypto_verify(ep, &peer->tai_leap, + peer)) != XEVNT_OK) + break; + + /* + * Initialize peer variables, leapseconds + * structure and extension field in network byte + * order. Since a filestamp may have changed, + * recompute the signatures. + */ + peer->tai_leap.tstamp = ep->tstamp; + peer->tai_leap.fstamp = ep->fstamp; + peer->tai_leap.vallen = ep->vallen; + + /* + * Install the new table if there is no stored + * table or the new table is more recent than + * the stored table. Since a filestamp may have + * changed, recompute the signatures. + */ + if (ntohl(peer->tai_leap.fstamp) > + ntohl(tai_leap.fstamp)) { + tai_leap.fstamp = ep->fstamp; + tai_leap.vallen = ep->vallen; + if (tai_leap.ptr != NULL) + free(tai_leap.ptr); + tai_leap.ptr = emalloc(vallen); + memcpy(tai_leap.ptr, ep->pkt, vallen); + crypto_update(); + sys_tai = vallen / 4 + TAI_1972 - 1; + } + crypto_flags |= CRYPTO_FLAG_TAI; + peer->crypto |= CRYPTO_FLAG_LEAP; + peer->flash &= ~TEST10; +#ifdef KERNEL_PLL +#if NTP_API > 3 + /* + * If the kernel cooperates, initialize the + * current TAI offset. + */ + ntv.modes = MOD_TAI; + ntv.constant = sys_tai; + (void)ntp_adjtime(&ntv); +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ + sprintf(statstr, "leap %u ts %u fs %u", + vallen, ntohl(ep->tstamp), + ntohl(ep->fstamp)); + record_crypto_stats(&peer->srcadr, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif break; -#endif /* PUBKEY */ /* - * For other requests, save the request code for later; - * for unknown responses or errors, just ignore for now. + * We come here in symmetric modes for miscellaneous + * commands that have value fields but are processed on + * the transmit side. All we need do here is check for + * valid field length. Remaining checks are below and on + * the transmit side. + */ + case CRYPTO_IFF: + case CRYPTO_GQ: + case CRYPTO_MV: + case CRYPTO_SIGN: + if (len < VALUE_LEN) { + rval = XEVNT_LEN; + break; + } + + /* fall through */ + + /* + * We come here for miscellaneous requests and unknown + * requests and responses. If an unknown response or + * error, forget it. If a request, save the extension + * field for later. Unknown requests will be caught on + * the transmit side. */ default: - if (code & (CRYPTO_RESP | CRYPTO_ERROR)) - break; - peer->cmmd = ntohl(pkt[i]); - break; + if (code & (CRYPTO_RESP | CRYPTO_ERROR)) { + rval = XEVNT_LEN; + } else if ((rval = crypto_verify(ep, NULL, + peer)) == XEVNT_OK) { + fp = emalloc(len); + memcpy(fp, ep, len); + temp32 = CRYPTO_RESP; + fp->opcode |= htonl(temp32); + peer->cmmd = fp; + } + } + /* + * We log everything except length/format errors and + * duplicates, which are log clogging vulnerabilities. + * The first error found terminates the extension field + * scan and we return the laundry to the caller. + */ + if (rval != XEVNT_OK) { + sprintf(statstr, + "error %x opcode %x ts %u fs %u", rval, + code, tstamp, fstamp); + if (rval > XEVNT_TSP) + record_crypto_stats(&peer->srcadr, + statstr); + report_event(rval, peer); +#ifdef DEBUG + if (debug) + printf("crypto_recv: %s\n", statstr); +#endif + break; } authlen += len; } - return; + return (rval); } @@ -563,172 +1131,249 @@ crypto_recv( * 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 + * when one is not. The only case where this matters is to retrieve the + * autokey information, in which case the caller has to provide the * association ID to match the association. + * + * Returns length of extension field. */ -int /* return length of extension field */ +int crypto_xmit( - u_int32 *xpkt, /* packet pointer */ - int start, /* offset to extension field */ - u_int code, /* extension field code */ - keyid_t cookie, /* session cookie */ - int associd /* association ID */ + struct pkt *xpkt, /* transmit packet pointer */ + struct sockaddr_storage *srcadr_sin, /* active runway */ + int start, /* offset to extension field */ + struct exten *ep, /* extension pointer */ + keyid_t cookie /* session cookie */ ) { + u_int32 *pkt; /* packet pointer */ 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 */ + u_int opcode; /* extension field opcode */ + struct exten *fp; /* extension pointers */ + struct cert_info *cp; /* certificate info/value pointer */ + char certname[MAXHOSTNAME + 1]; /* subject name buffer */ + char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */ + u_int vallen; + u_int len; + struct value vtemp; + associd_t associd; + int rval; + keyid_t tcookie; /* * Generate the requested extension field request code, length - * and association ID. + * and association ID. If this is a response and the host is not + * synchronized, light the error bit and go home. */ - i = start / 4; - opcode = code; - xpkt[i + 1] = htonl(associd); + pkt = (u_int32 *)xpkt + start / 4; + fp = (struct exten *)pkt; + opcode = ntohl(ep->opcode); + associd = (associd_t) ntohl(ep->associd); + fp->associd = htonl(associd); len = 8; - switch (opcode) { + rval = XEVNT_OK; + switch (opcode & 0xffff0000) { /* - * Exchange association IDs. This is used in multicast server - * mode and is a NOP here. + * Send association request and response with status word and + * host name. Note, this message is not signed and the filestamp + * contains only the status word. We check at this point whether + * the identity schemes are compatible to save tears later on. */ case CRYPTO_ASSOC | CRYPTO_RESP: + case CRYPTO_ASSOC: + len += crypto_send(fp, &hostval); + if (crypto_time() == 0) + fp->fstamp = 0; + else + fp->fstamp = htonl(crypto_flags); + break; + + /* + * Send certificate request. Use the values from the extension + * field. + */ + case CRYPTO_CERT: + memset(&vtemp, 0, sizeof(vtemp)); + vtemp.tstamp = ep->tstamp; + vtemp.fstamp = ep->fstamp; + vtemp.vallen = ep->vallen; + vtemp.ptr = (unsigned char *)ep->pkt; + len += crypto_send(fp, &vtemp); + break; + + /* + * Send certificate response or sign request. Use the values + * from the certificate. If the request contains no subject + * name, assume the name of this host. This is for backwards + * compatibility. Light the error bit if no certificate with + * the given subject name is found. Of course, private + * certificates are never sent. + */ + case CRYPTO_SIGN: + case CRYPTO_CERT | CRYPTO_RESP: + vallen = ntohl(ep->vallen); + if (vallen == 8) { + strcpy(certname, sys_hostname); + } else if (vallen == 0 || vallen > MAXHOSTNAME) { + opcode |= CRYPTO_ERROR; + break; + + } else { + memcpy(certname, ep->pkt, vallen); + certname[vallen] = '\0'; + } + for (cp = cinfo; cp != NULL; cp = cp->link) { + if (cp->flags & CERT_PRIV) + continue; + if (strcmp(certname, cp->subject) == 0) { + len += crypto_send(fp, &cp->cert); + break; + } + } + if (cp == NULL) + opcode |= CRYPTO_ERROR; + break; + + /* + * Send challenge in Schnorr (IFF) identity scheme. + */ + case CRYPTO_IFF: + if ((peer = findpeerbyassoc(ep->pkt[0])) == NULL) { + opcode |= CRYPTO_ERROR; + break; + } + if ((rval = crypto_alice(peer, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send response in Schnorr (IFF) identity scheme. + */ + case CRYPTO_IFF | CRYPTO_RESP: + if ((rval = crypto_bob(ep, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send challenge in Guillou-Quisquater (GQ) identity scheme. + */ + case CRYPTO_GQ: + if ((peer = findpeerbyassoc(ep->pkt[0])) == NULL) { + opcode |= CRYPTO_ERROR; + break; + } + if ((rval = crypto_alice2(peer, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send response in Guillou-Quisquater (GQ) identity scheme. + */ + case CRYPTO_GQ | CRYPTO_RESP: + if ((rval = crypto_bob2(ep, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send challenge in MV identity scheme. + */ + case CRYPTO_MV: + if ((peer = findpeerbyassoc(ep->pkt[0])) == NULL) { + opcode |= CRYPTO_ERROR; + break; + } + if ((rval = crypto_alice3(peer, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send response in MV identity scheme. + */ + case CRYPTO_MV | CRYPTO_RESP: + if ((rval = crypto_bob3(ep, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send certificate sign response. The integrity of the request + * certificate has already been verified on the receive side. + * Sign the response using the local server key. Use the + * filestamp from the request and use the timestamp as the + * current time. Light the error bit if the certificate is + * invalid or contains an unverified signature. + */ + case CRYPTO_SIGN | CRYPTO_RESP: + if ((rval = cert_sign(ep, &vtemp)) == XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); + break; + + /* + * Send public key and signature. Use the values from the public + * key. + */ + case CRYPTO_COOK: + len += crypto_send(fp, &pubkey); + break; + + /* + * Encrypt and send cookie and signature. Light the error bit if + * anything goes wrong. + */ + case CRYPTO_COOK | CRYPTO_RESP: + if ((opcode & 0xffff) < VALUE_LEN) { + opcode |= CRYPTO_ERROR; + break; + } + if (PKT_MODE(xpkt->li_vn_mode) == MODE_SERVER) { + tcookie = cookie; + } else { + if ((peer = findpeerbyassoc(associd)) == NULL) { + opcode |= CRYPTO_ERROR; + break; + } + tcookie = peer->pcookie; + } + if ((rval = crypto_encrypt(ep, &vtemp, &tcookie)) == + XEVNT_OK) + len += crypto_send(fp, &vtemp); + value_free(&vtemp); break; /* * Find peer and send autokey data and signature in broadcast - * server and symmetric modes. + * server and symmetric modes. Use the values in the autokey + * structure. If no association is found, either the server has + * restarted with new associations or some perp has replayed an + * old message, in which case light the error bit. */ case CRYPTO_AUTO | CRYPTO_RESP: - peer = findpeerbyassoc(associd); - if (peer == NULL) { + if ((peer = findpeerbyassoc(associd)) == NULL) { opcode |= CRYPTO_ERROR; break; } - ap = (struct autokey *)&xpkt[i + 2]; - ap->tstamp = peer->sndauto.tstamp; - ap->seq = peer->sndauto.seq; - ap->key = peer->sndauto.key; - ap->siglen = 0; - len += 16; -#ifdef PUBKEY - if (!crypto_enable) - break; - ap->siglen = peer->sndauto.siglen; - temp = ntohl(peer->sndauto.siglen); - if (temp > 0) - memcpy(&ap->sig, peer->sndauto.sig, temp); - len += temp; -#endif /* PUBKEY */ + peer->flags &= ~FLAG_ASSOC; + len += crypto_send(fp, &peer->sndval); break; /* - * Send peer cookie and signature in server mode. + * Send leapseconds table and signature. Use the values from the + * tai structure. If no table has been loaded, just send a + * request. */ - case CRYPTO_PRIV | CRYPTO_RESP: - cp = (struct cookie *)&xpkt[i + 2]; - cp->tstamp = htonl(sys_revoketime.l_ui); - cp->key = htonl(cookie); - cp->siglen = 0; - len += 12; -#ifdef PUBKEY - if (!crypto_enable) - break; - cp->siglen = htonl(public_key.bits / 8); - if (private_key.bits < MIN_RSA_MODULUS_BITS || - private_key.bits > MAX_RSA_MODULUS_BITS) { - rval = -1; - } else { - R_SignInit(&ctx, DA_MD5); - R_SignUpdate(&ctx, (u_char *)cp, 8); - rval = R_SignFinal(&ctx, (u_char *)&cp->sig, - &temp, &private_key); - } - if (rval != 0) { - cp->siglen = 0; - msyslog(LOG_ERR, - "crypto_xmit: cookie signature fails %x", - rval); - break; - } - len += temp; -#endif /* PUBKEY */ + case CRYPTO_TAI: + case CRYPTO_TAI | CRYPTO_RESP: + if (crypto_flags & CRYPTO_FLAG_TAI) + len += crypto_send(fp, &tai_leap); break; -#ifdef PUBKEY - /* - * Send Diffie-Hellman public value, timestamp and signature. - */ - case CRYPTO_DH: - case CRYPTO_DH | CRYPTO_RESP: - vp = (struct value *)&xpkt[i + 2]; - vp->tstamp = htonl(sys_revoketime.l_ui); - vp->vallen = 0; - len += 8; - temp = dh_params.primeLen; - if (dh_sign == NULL) - break; - vp->vallen = htonl(temp); - memcpy((u_char *)&vp->val, dh_public, temp); - len += temp; - j = i + 4 + temp / 4; - temp = public_key.bits / 8; - xpkt[j++] = htonl(temp); - memcpy((u_char *)&xpkt[j], dh_sign, temp); - len += temp + 4; - break; - - /* - * Send host name, timestamp and signature. - */ - case CRYPTO_NAME | CRYPTO_RESP: - vp = (struct value *)&xpkt[i + 2]; - vp->tstamp = htonl(sys_revoketime.l_ui); - vp->vallen = host.vallen; - len += 8; - temp = ntohl(host.vallen); - if (temp == 0) - break; - memcpy((u_char *)&vp->val, host.val, temp); - len += temp; - j = i + 4 + temp / 4; - temp = public_key.bits / 8; - xpkt[j++] = htonl(temp); - memcpy((u_char *)&xpkt[j], host.sig, temp); - len += temp + 4; - break; - - /* - * Send public key. We send the public key only if it exists and - * is valid. This is used primarily for testing. - */ - case CRYPTO_PUBL | CRYPTO_RESP: - xpkt[i + 2] = 0; - len += 4; - if (public_key.bits < MIN_RSA_MODULUS_BITS || - public_key.bits > MAX_RSA_MODULUS_BITS) - break; - temp = sizeof(R_RSA_PUBLIC_KEY) - sizeof(u_int); - xpkt[i + 2] = htonl(temp + 4); - xpkt[i + 3] = htonl(public_key.bits); - memcpy((u_char *)&xpkt[i + 4], - (u_char *)&public_key.modulus, temp); - len += temp + 4; - break; -#endif /* PUBKEY */ - /* * Default - Fall through for requests; for unknown responses, * flag as error. @@ -736,7 +1381,21 @@ crypto_xmit( default: if (opcode & CRYPTO_RESP) opcode |= CRYPTO_ERROR; - break; + } + + /* + * We ignore length/format errors and duplicates. Other errors + * are reported to the log and deny further service. To really + * persistent rascals we toss back a kiss-of-death grenade. + */ + if (rval > XEVNT_TSP) { + opcode |= CRYPTO_ERROR; + sprintf(statstr, "error %x opcode %x", rval, opcode); + record_crypto_stats(srcadr_sin, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_xmit: %s\n", statstr); +#endif } /* @@ -744,418 +1403,2631 @@ crypto_xmit( * the request code and length. */ len = ((len + 7) / 8) * 8; - if (len >= 4) { - xpkt[i] = htonl((u_int32)((opcode << 16) | len)); + fp->opcode = htonl((opcode & 0xffff0000) | len); #ifdef DEBUG - if (debug) - printf( - "crypto_xmit: ext offset %d len %d code %x assoc ID %d\n", - start, len, code, associd); + if (debug) + printf( + "crypto_xmit: ext offset %d len %u code %x assocID %d\n", + start, len, opcode>> 16, associd); #endif - } return (len); } -#ifdef PUBKEY /* - * crypto_agree - compute public and private Diffie-Hellman values from - * given prime and generator, then sign with private key. - */ -void -crypto_agree(void) -{ - u_int len, temp; - R_RANDOM_STRUCT randomstr; - R_SIGNATURE_CTX ctx; /* signature context */ - int rval; - int i; - - /* - * Sign host name and timestamp. - */ - host.tstamp = htonl(sys_revoketime.l_ui); - host.vallen = htonl(sys_hostnamelen); - host.val = sys_hostname; - host.siglen = dh_params.primeLen; - if (host.sig == NULL) - host.sig = emalloc(dh_params.primeLen); - R_SignInit(&ctx, DA_MD5); - R_SignUpdate(&ctx, (u_char *)&host, 8); - R_SignUpdate(&ctx, host.val, sys_hostnamelen); - rval = R_SignFinal(&ctx, host.sig, &temp, &private_key); - if (rval != 0) { - msyslog(LOG_ERR, - "crypto_agree: host signature fails %x", rval); - return; - } - - /* - * Compute Diffie-Hellman public value. Note that the length of - * the private value is set arbitrarily to half the prime - * length. - */ - if (dh_params.primeLen == 0) { - msyslog(LOG_ERR, - "unavailable d-h parameters"); - return; - } - R_RandomInit(&randomstr); - R_GetRandomBytesNeeded(&len, &randomstr); - for (i = 0; i < len; i++) { - temp = random(); - R_RandomUpdate(&randomstr, (u_char *)&temp, 1); - } - if (dh_private == NULL) - dh_private = (u_char *)emalloc(dh_keyLen); - if (dh_public == NULL) - dh_public = (u_char *)emalloc(dh_params.primeLen); - rval = R_SetupDHAgreement(dh_public, dh_private, dh_keyLen, - &dh_params, &randomstr); - if (rval != 0) { - msyslog(LOG_ERR, "invalid d-h parameters"); - return; - } - - /* - * Sigfie-Hellman public value and save for later. - */ - if (dh_sign == NULL) - dh_sign = emalloc(dh_params.primeLen); - R_SignInit(&ctx, DA_MD5); - R_SignUpdate(&ctx, (char *)&host.tstamp, 4); - temp = htonl(dh_params.primeLen); - R_SignUpdate(&ctx, (char *)&temp, 4); - R_SignUpdate(&ctx, dh_public, dh_params.primeLen); - rval = R_SignFinal(&ctx, dh_sign, &temp, &private_key); - if (rval != 0) { - msyslog(LOG_ERR, - "crypto_agree: d-h signature fails %x", rval); - return; - } -#ifdef DEBUG - if (debug) - printf( - "cypto_agree: host %s d-h prime %d gen %d\n", - host.val, dh_params.primeLen, - dh_params.generatorLen); -#endif -} - - -/* - * crypto_read - read RSA key, decode and check for errors + * crypto_verify - parse and verify the extension field and value + * + * Returns + * XEVNT_OK success + * XEVNT_LEN bad field format or length + * XEVNT_TSP bad timestamp + * XEVNT_FSP bad filestamp + * XEVNT_PUB bad or missing public key + * XEVNT_SGL bad signature length + * XEVNT_SIG signature not verified */ static int -crypto_read( - u_char *cp, /* file name */ - u_char *key, /* key pointer */ - u_int keylen /* key length */ +crypto_verify( + struct exten *ep, /* extension pointer */ + struct value *vp, /* value pointer */ + struct peer *peer /* peer structure pointer */ ) { - FILE *str; - u_char buf[MAX_KEYLEN]; - u_char encoded_key[MAX_KEYLEN]; - char filename[MAXFILENAME]; - u_int modulus; - u_int buflen; - char *rptr; - int rval; + EVP_PKEY *pkey; /* server public key */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; /* timestamp */ + tstamp_t fstamp; /* filestamp */ + u_int vallen; /* value length */ + u_int siglen; /* signature length */ + u_int opcode, len; + int rval; + int i; /* - * Open the key file and discard comment lines. + * We require valid opcode and field length, timestamp, + * filestamp, public key, digest, signature length and + * signature, where relevant. Note that preliminary length + * checks are done in the main loop. */ - if (strlen(cp) == 0 || strlen(cp) >= MAXFILENAME - 1) { - msyslog(LOG_ERR, "invalid key file name length %d", - strlen(filename)); - return (0); - } else if (*cp == '/') { - strcpy(filename, cp); + len = ntohl(ep->opcode) & 0x0000ffff; + opcode = ntohl(ep->opcode) & 0xffff0000; + + /* + * Check for valid operation code and protocol. The opcode must + * not have the error bit set. If a response, it must have a + * value header. If a request and does not contain a value + * header, no need for further checking. + */ + if (opcode & CRYPTO_ERROR) + return (XEVNT_LEN); + if (opcode & CRYPTO_RESP) { + if (len < VALUE_LEN) + return (XEVNT_LEN); } else { - snprintf(filename, MAXFILENAME - 1, "%s%s", keysdir, - cp); + if (len < VALUE_LEN) + return (XEVNT_OK); } - str = fopen(filename, "r"); - if (str == NULL) { - msyslog(LOG_ERR, "key file %s not found", filename); - return (0); - } - while ((rptr = fgets(buf, MAX_KEYLEN - 1, str)) != NULL) { - buflen = strlen(buf); - if (buflen < 1) - continue; - if (*buf == '#' || *buf == '\r' || *buf == '\0') - continue; - break; + /* + * We have a value header. Check for valid field lengths. The + * field length must be long enough to contain the value header, + * value and signature. If a request and a previous request of + * the same type is pending, discard the previous request. If a + * request but no signature, there is no need for further + * checking. + */ + vallen = ntohl(ep->vallen); + if (len < ((VALUE_LEN + vallen + 3) / 4) * 4) + return (XEVNT_LEN); + + i = (vallen + 3) / 4; + siglen = ntohl(ep->pkt[i++]); + if (len < VALUE_LEN + vallen + siglen) + return (XEVNT_LEN); + + if (!(opcode & CRYPTO_RESP)) { + if (peer->cmmd != NULL) { + if ((opcode | CRYPTO_RESP) == + (ntohl(peer->cmmd->opcode) & 0xffff0000)) { + free(peer->cmmd); + peer->cmmd = NULL; + } else { + return (XEVNT_LEN); + } + } + if (siglen == 0) + return (XEVNT_OK); } /* - * We are rather paranoid here, since an intruder can cause a - * coredump by infiltrating a naughty key. The line must contain - * a single integer followed by a PEM encoded, null-terminated - * string. + * We have a signature. Check for valid timestamp and filestamp. + * The timestamp must not precede the filestamp. The timestamp + * and filestamp must not precede the corresponding values in + * the value structure. Once the autokey values have been + * installed, the timestamp must always be later than the + * corresponding value in the value structure. Duplicate + * timestamps are illegal once the cookie has been validated. */ - if (rptr == NULL) { - msyslog(LOG_ERR, "invalid key file %s", filename); - return (0); + rval = XEVNT_OK; + if (crypto_flags & peer->crypto & CRYPTO_FLAG_PRIV) + pkey = sign_pkey; + else + pkey = peer->pkey; + tstamp = ntohl(ep->tstamp); + fstamp = ntohl(ep->fstamp); + if (tstamp == 0 || tstamp < fstamp) { + rval = XEVNT_TSP; + } else if (vp != NULL && (tstamp < ntohl(vp->tstamp) || + (tstamp == ntohl(vp->tstamp) && (peer->crypto & + CRYPTO_FLAG_AUTO)))) { + rval = XEVNT_TSP; + } else if (vp != NULL && (tstamp < ntohl(vp->fstamp) || fstamp < + ntohl(vp->fstamp))) { + rval = XEVNT_FSP; + + /* + * If a public key and digest is present, and if valid key + * length, check for valid signature. Note that the first valid + * signature lights the proventic bit. + */ + } else if (pkey == NULL || peer->digest == NULL) { + /* fall through */ + } else if (siglen != (u_int) EVP_PKEY_size(pkey)) { + rval = XEVNT_SGL; + } else { + EVP_VerifyInit(&ctx, peer->digest); + EVP_VerifyUpdate(&ctx, (u_char *)&ep->tstamp, vallen + + 12); + if (EVP_VerifyFinal(&ctx, (u_char *)&ep->pkt[i], siglen, + pkey)) { + if (peer->crypto & CRYPTO_FLAG_VRFY) + peer->crypto |= CRYPTO_FLAG_PROV; + } else { + rval = XEVNT_SIG; + } } - /* XXX sizeof(encoded_key) == 1024 */ - if (sscanf(buf, "%d %1023s", &modulus, encoded_key) != 2) { - msyslog(LOG_ERR, "invalid key format %s", filename); - return (0); +#ifdef DEBUG + if (debug > 1) + printf( + "crypto_recv: verify %x vallen %u siglen %u ts %u fs %u\n", + rval, vallen, siglen, tstamp, fstamp); +#endif + return (rval); +} + + +/* + * crypto_encrypt - construct encrypted cookie and signature from + * extension field and cookie + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_CKY bad or missing cookie + */ +static int +crypto_encrypt( + struct exten *ep, /* extension pointer */ + struct value *vp, /* value pointer */ + keyid_t *cookie /* server cookie */ + ) +{ + EVP_PKEY *pkey; /* public key */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; /* NTP timestamp */ + u_int32 temp32; + u_int len; + u_char *ptr; + + /* + * Extract the public key from the request. + */ + len = ntohl(ep->vallen); + ptr = (u_char *)ep->pkt; + pkey = d2i_PublicKey(EVP_PKEY_RSA, NULL, &ptr, len); + if (pkey == NULL) { + msyslog(LOG_ERR, "crypto_encrypt %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); } /* - * Initialize the key with the decoded PEM string, but leave - * room for the modulus length in the key structure. + * Encrypt the cookie, encode in ASN.1 and sign. */ - rval = R_DecodePEMBlock(&key[sizeof(u_int)], &buflen, - encoded_key, strlen(encoded_key)); - if (rval != 0) { - msyslog(LOG_ERR, "invalid key %s %x", filename, rval); + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = hostval.tstamp; + len = EVP_PKEY_size(pkey); + vp->vallen = htonl(len); + vp->ptr = emalloc(len); + temp32 = htonl(*cookie); + if (!RSA_public_encrypt(4, (u_char *)&temp32, vp->ptr, + pkey->pkey.rsa, RSA_PKCS1_OAEP_PADDING)) { + msyslog(LOG_ERR, "crypto_encrypt %s\n", + ERR_error_string(ERR_get_error(), NULL)); + EVP_PKEY_free(pkey); + return (XEVNT_CKY); + } + EVP_PKEY_free(pkey); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_ident - construct extension field for identity scheme + * + * This routine determines which identity scheme is in use and + * constructs an extension field for that scheme. + */ +u_int +crypto_ident( + struct peer *peer /* peer structure pointer */ + ) +{ + char filename[MAXFILENAME + 1]; + + /* + * If the server identity has already been verified, no further + * action is necessary. Otherwise, try to load the identity file + * of the certificate issuer. If the issuer file is not found, + * try the host file. If nothing found, declare a cryptobust. + * Note we can't get here unless the trusted certificate has + * been found and the CRYPTO_FLAG_VALID bit is set, so the + * certificate issuer is valid. + */ + if (peer->crypto & CRYPTO_FLAG_VRFY) return (0); + + if (peer->ident_pkey != NULL) + EVP_PKEY_free(peer->ident_pkey); + if (peer->crypto & CRYPTO_FLAG_GQ) { + snprintf(filename, MAXFILENAME, "ntpkey_gq_%s", + peer->issuer); + peer->ident_pkey = crypto_key(filename, &peer->fstamp); + if (peer->ident_pkey != NULL) + return (CRYPTO_GQ); + + snprintf(filename, MAXFILENAME, "ntpkey_gq_%s", + sys_hostname); + peer->ident_pkey = crypto_key(filename, &peer->fstamp); + if (peer->ident_pkey != NULL) + return (CRYPTO_GQ); + } + if (peer->crypto & CRYPTO_FLAG_IFF) { + snprintf(filename, MAXFILENAME, "ntpkey_iff_%s", + peer->issuer); + peer->ident_pkey = crypto_key(filename, &peer->fstamp); + if (peer->ident_pkey != NULL) + return (CRYPTO_IFF); + + snprintf(filename, MAXFILENAME, "ntpkey_iff_%s", + sys_hostname); + peer->ident_pkey = crypto_key(filename, &peer->fstamp); + if (peer->ident_pkey != NULL) + return (CRYPTO_IFF); + } + if (peer->crypto & CRYPTO_FLAG_MV) { + snprintf(filename, MAXFILENAME, "ntpkey_mv_%s", + peer->issuer); + peer->ident_pkey = crypto_key(filename, &peer->fstamp); + if (peer->ident_pkey != NULL) + return (CRYPTO_MV); + + snprintf(filename, MAXFILENAME, "ntpkey_mv_%s", + sys_hostname); + peer->ident_pkey = crypto_key(filename, &peer->fstamp); + if (peer->ident_pkey != NULL) + return (CRYPTO_MV); } /* - * Make sure the structure has the required length. + * No compatible identity scheme is available. Use the default + * TC scheme. */ - buflen += sizeof(u_int); - if (buflen != keylen) { - msyslog(LOG_ERR, "invalid key length %s %d", filename, - buflen); - return (0); + msyslog(LOG_INFO, + "crypto_ident: no compatible identity scheme found"); + return (0); +} + + +/* + * crypto_args - construct extension field from arguments + * + * This routine creates an extension field with current timestamps and + * specified opcode, association ID and optional string. Note that the + * extension field is created here, but freed after the crypto_xmit() + * call in the protocol module. + * + * Returns extension field pointer (no errors). + */ +struct exten * +crypto_args( + struct peer *peer, /* peer structure pointer */ + u_int opcode, /* operation code */ + char *str /* argument string */ + ) +{ + tstamp_t tstamp; /* NTP timestamp */ + struct exten *ep; /* extension field pointer */ + u_int len; /* extension field length */ + + tstamp = crypto_time(); + len = sizeof(struct exten); + if (str != NULL) + len += strlen(str); + ep = emalloc(len); + memset(ep, 0, len); + ep->opcode = htonl(opcode + len); + + /* + * If a response, send our ID; if a request, send the + * responder's ID. + */ + if (opcode & CRYPTO_RESP) + ep->associd = htonl(peer->associd); + else + ep->associd = htonl(peer->assoc); + ep->tstamp = htonl(tstamp); + ep->fstamp = hostval.tstamp; + ep->vallen = 0; + if (str != NULL) { + ep->vallen = htonl(strlen(str)); + memcpy((char *)ep->pkt, str, strlen(str)); + } else { + ep->pkt[0] = peer->associd; + } + return (ep); +} + + +/* + * crypto_send - construct extension field from value components + * + * Returns extension field length. Note: it is not polite to send a + * nonempty signature with zero timestamp or a nonzero timestamp with + * empty signature, but these rules are not enforced here. + */ +u_int +crypto_send( + struct exten *ep, /* extension field pointer */ + struct value *vp /* value pointer */ + ) +{ + u_int len, temp32; + int i; + + /* + * Copy data. If the data field is empty or zero length, encode + * an empty value with length zero. + */ + ep->tstamp = vp->tstamp; + ep->fstamp = vp->fstamp; + ep->vallen = vp->vallen; + len = 12; + temp32 = ntohl(vp->vallen); + if (temp32 > 0 && vp->ptr != NULL) + memcpy(ep->pkt, vp->ptr, temp32); + + /* + * Copy signature. If the signature field is empty or zero + * length, encode an empty signature with length zero. + */ + i = (temp32 + 3) / 4; + len += i * 4 + 4; + ep->pkt[i++] = vp->siglen; + temp32 = ntohl(vp->siglen); + if (temp32 > 0 && vp->sig != NULL) + memcpy(&ep->pkt[i], vp->sig, temp32); + len += temp32; + return (len); +} + + +/* + * crypto_update - compute new public value and sign extension fields + * + * This routine runs periodically, like once a day, and when something + * changes. It updates the timestamps on three value structures and one + * value structure list, then signs all the structures: + * + * hostval host name (not signed) + * pubkey public key + * cinfo certificate info/value list + * tai_leap leapseconds file + * + * Filestamps are proventicated data, so this routine is run only when + * the host has been synchronized to a proventicated source. Thus, the + * timestamp is proventicated, too, and can be used to deflect + * clogging attacks and even cook breakfast. + * + * Returns void (no errors) + */ +void +crypto_update(void) +{ + EVP_MD_CTX ctx; /* message digest context */ + struct cert_info *cp, *cpn, **zp; /* certificate info/value */ + char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */ + tstamp_t tstamp; /* NTP timestamp */ + u_int len; + + if ((tstamp = crypto_time()) == 0) + return; + hostval.tstamp = htonl(tstamp); + + /* + * Sign public key and timestamps. The filestamp is derived from + * the host key file extension from wherever the file was + * generated. + */ + if (pubkey.vallen != 0) { + pubkey.tstamp = hostval.tstamp; + pubkey.siglen = 0; + if (pubkey.sig == NULL) + pubkey.sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&pubkey, 12); + EVP_SignUpdate(&ctx, pubkey.ptr, ntohl(pubkey.vallen)); + if (EVP_SignFinal(&ctx, pubkey.sig, &len, sign_pkey)) + pubkey.siglen = htonl(len); } /* - * Make sure the modulus length is within limits. + * Sign certificates and timestamps. The filestamp is derived + * from the certificate file extension from wherever the file + * was generated. At the same time expired certificates are + * expunged. */ - if (modulus < MIN_RSA_MODULUS_BITS || modulus > - MAX_RSA_MODULUS_BITS) { - msyslog(LOG_ERR, "invalid key modulus %s %d", filename, - modulus); - return (0); + zp = &cinfo; + for (cp = cinfo; cp != NULL; cp = cpn) { + cpn = cp->link; + if (tstamp > cp->last) { + *zp = cpn; + cert_free(cp); + } else { + cp->cert.tstamp = hostval.tstamp; + cp->cert.siglen = 0; + if (cp->cert.sig == NULL) + cp->cert.sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&cp->cert, 12); + EVP_SignUpdate(&ctx, cp->cert.ptr, + ntohl(cp->cert.vallen)); + if (EVP_SignFinal(&ctx, cp->cert.sig, &len, + sign_pkey)) + cp->cert.siglen = htonl(len); + zp = &cp->link; + } } - ((u_int *)key)[0] = modulus; + + /* + * Sign leapseconds table and timestamps. The filestamp is + * derived from the leapsecond file extension from wherever the + * file was generated. + */ + if (tai_leap.vallen != 0) { + tai_leap.tstamp = hostval.tstamp; + tai_leap.siglen = 0; + if (tai_leap.sig == NULL) + tai_leap.sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&tai_leap, 12); + EVP_SignUpdate(&ctx, tai_leap.ptr, + ntohl(tai_leap.vallen)); + if (EVP_SignFinal(&ctx, tai_leap.sig, &len, sign_pkey)) + tai_leap.siglen = htonl(len); + } + sprintf(statstr, "update ts %u", ntohl(hostval.tstamp)); + record_crypto_stats(NULL, statstr); #ifdef DEBUG if (debug) - printf( - "crypto_read: RSA key file %s length %d modulus %d\n", - cp, keylen, modulus); + printf("crypto_update: %s\n", statstr); #endif - return (1); } /* - * crypto_public - read and install the public key from the public key - * file. The name of the file is in the form "ntpkey_host", where host - * is the DNS canonical name of the host. If the file is not found or - * has errors, we just keep going and expect the host to fetch the - * public key from the peer via the extension field. + * value_free - free value structure components. + * + * Returns void (no errors) */ -int -crypto_public( - struct peer *peer, /* peer structure pointer */ - u_char *cp /* canonical host name */ +void +value_free( + struct value *vp /* value structure */ ) { - R_RSA_PUBLIC_KEY keybuf; - u_int keylen = sizeof(R_RSA_PUBLIC_KEY); - char filename[MAXFILENAME]; - - snprintf(filename, MAXFILENAME - 1, "ntpkey_%s", cp); - if (!crypto_read(filename, (u_char *)&keybuf, keylen)) - return (0); - if (peer->keystr != NULL) - free(peer->keystr); - peer->keystr = emalloc(strlen(filename) + 1); - strcpy(peer->keystr, filename); - if (peer->pubkey == NULL) - peer->pubkey = emalloc(keylen); - memcpy(peer->pubkey, (char *)&keybuf, keylen); - return (1); + if (vp->ptr != NULL) + free(vp->ptr); + if (vp->sig != NULL) + free(vp->sig); + memset(vp, 0, sizeof(struct value)); } /* - * crypto_line - read, decode and install Diffie-Hellman prime and - * generator. Be very parannoyed here if every little thing is not - * exactly right. + * crypto_time - returns current NTP time in seconds. */ -static void -crypto_line( - FILE *str, /* file handle */ - u_char **key, /* decoded string pointer */ - u_int *len /* length */ +tstamp_t +crypto_time() +{ + l_fp tstamp; /* NTP time */ L_CLR(&tstamp); + + L_CLR(&tstamp); + if (sys_leap != LEAP_NOTINSYNC) + get_systime(&tstamp); + return (tstamp.l_ui); +} + + +/* + * asn2ntp - convert ASN1_TIME time structure to NTP time in seconds. + */ +u_long +asn2ntp ( + ASN1_TIME *asn1time /* pointer to ASN1_TIME structure */ ) { - u_char buf[MAX_KEYLEN]; - u_char encoded_key[MAX_KEYLEN]; - u_int temp, temp1, temp2; - char *rptr; + char *v; /* pointer to ASN1_TIME string */ + struct tm tm; /* used to convert to NTP time */ /* - * Read key and length. Bail out if the length word doesn't - * match the decoded string length and in other cases. + * Extract time string YYMMDDHHMMSSZ from ASN1 time structure. + * Note that the YY, MM, DD fields start with one, the HH, MM, + * SS fiels start with zero and the Z character should be 'Z' + * for UTC. Also note that years less than 50 map to years + * greater than 100. Dontcha love ASN.1? Better than MIL-188. */ - *key = NULL; - *len = 0; - while ((rptr = fgets(buf, MAX_KEYLEN - 1, str)) != NULL) { - if (strlen(buf) < 1) - continue; - if (*buf == '#' || *buf == '\r' || *buf == '\0') - continue; - break; - } - /* XXX sizeof(encoded_key) == 1024 */ - if (sscanf(buf, "%d %1023s", &temp, encoded_key) != 2) - return; - if (temp > MAX_DH_LEN) - return; - temp2 = DECODED_CONTENT_LEN(strlen(encoded_key)); - if (R_DecodePEMBlock(buf, &temp1, encoded_key, - strlen(encoded_key))) - return; - if (temp != temp1 || temp > temp2) - return; - *key = (u_char *)emalloc(temp2); - memcpy(*key, buf, temp2); - *len = temp; - return; + if (asn1time->length > 13) + return ((u_long)(~0)); /* We can't use -1 here. It's invalid */ + v = (char *)asn1time->data; + tm.tm_year = (v[0] - '0') * 10 + v[1] - '0'; + if (tm.tm_year < 50) + tm.tm_year += 100; + tm.tm_mon = (v[2] - '0') * 10 + v[3] - '0' - 1; + tm.tm_mday = (v[4] - '0') * 10 + v[5] - '0'; + tm.tm_hour = (v[6] - '0') * 10 + v[7] - '0'; + tm.tm_min = (v[8] - '0') * 10 + v[9] - '0'; + tm.tm_sec = (v[10] - '0') * 10 + v[11] - '0'; + tm.tm_wday = 0; + tm.tm_yday = 0; + tm.tm_isdst = 0; + return (timegm(&tm) + JAN_1970); } /* - * crypto_setup - read RSA private key, RSA public key and Diffie- - * Hellman parameter files and initialize cryptographic data. + * bigdig() - compute a BIGNUM MD5 hash of a BIGNUM number. + */ +static int +bighash( + BIGNUM *bn, /* BIGNUM * from */ + BIGNUM *bk /* BIGNUM * to */ + ) +{ + EVP_MD_CTX ctx; /* message digest context */ + u_char dgst[EVP_MAX_MD_SIZE]; /* message digest */ + u_char *ptr; /* a BIGNUM as binary string */ + u_int len; + + len = BN_num_bytes(bn); + ptr = emalloc(len); + BN_bn2bin(bn, ptr); + EVP_DigestInit(&ctx, EVP_md5()); + EVP_DigestUpdate(&ctx, ptr, len); + EVP_DigestFinal(&ctx, dgst, &len); + BN_bin2bn(dgst, len, bk); + return (1); +} + + +/* + *********************************************************************** + * * + * The following routines implement the Schnorr (IFF) identity scheme * + * * + *********************************************************************** + * + * The Schnorr (IFF) identity scheme is intended for use when + * the ntp-genkeys program does not generate the certificates used in + * the protocol and the group key cannot be conveyed in the certificate + * itself. For this purpose, new generations of IFF values must be + * securely transmitted to all members of the group before use. The + * scheme is self contained and independent of new generations of host + * keys, sign keys and certificates. + * + * The IFF identity scheme is based on DSA cryptography and algorithms + * described in Stinson p. 285. The IFF values hide in a DSA cuckoo + * structure, but only the primes and generator are used. The p is a + * 512-bit prime, q a 160-bit prime that divides p - 1 and is a qth root + * of 1 mod p; that is, g^q = 1 mod p. The TA rolls primvate random + * group key b disguised as a DSA structure member, then computes public + * key g^(q - b). These values are shared only among group members and + * never revealed in messages. Alice challenges Bob to confirm identity + * using the protocol described below. + * + * How it works + * + * The scheme goes like this. Both Alice and Bob have the public primes + * p, q and generator g. The TA gives private key b to Bob and public + * key v = g^(q - a) mod p to Alice. + * + * Alice rolls new random challenge r and sends to Bob in the IFF + * request message. Bob rolls new random k, then computes y = k + b r + * mod q and x = g^k mod p and sends (y, hash(x)) to Alice in the + * response message. Besides making the response shorter, the hash makes + * it effectivey impossible for an intruder to solve for b by observing + * a number of these messages. + * + * Alice receives the response and computes g^y v^r mod p. After a bit + * of algebra, this simplifies to g^k. If the hash of this result + * matches hash(x), Alice knows that Bob has the group key b. The signed + * response binds this knowledge to Bob's private key and the public key + * previously received in his certificate. + * + * crypto_alice - construct Alice's challenge in IFF scheme + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_ID bad or missing identity parameters + */ +static int +crypto_alice( + struct peer *peer, /* peer pointer */ + struct value *vp /* value pointer */ + ) +{ + DSA *dsa; /* IFF parameters */ + BN_CTX *bctx; /* BIGNUM context */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; + u_int len; + + /* + * The identity parameters must have correct format and content. + */ + if (peer->ident_pkey == NULL) + return (XEVNT_ID); + if ((dsa = peer->ident_pkey->pkey.dsa) == NULL) { + msyslog(LOG_INFO, "crypto_alice: defective key"); + return (XEVNT_PUB); + } + + /* + * Roll new random r (0 < r < q). The OpenSSL library has a bug + * omitting BN_rand_range, so we have to do it the hard way. + */ + bctx = BN_CTX_new(); + len = BN_num_bytes(dsa->q); + if (peer->iffval != NULL) + BN_free(peer->iffval); + peer->iffval = BN_new(); + BN_rand(peer->iffval, len * 8, -1, 1); /* r */ + BN_mod(peer->iffval, peer->iffval, dsa->q, bctx); + BN_CTX_free(bctx); + + /* + * Sign and send to Bob. The filestamp is from the local file. + */ + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = htonl(peer->fstamp); + vp->vallen = htonl(len); + vp->ptr = emalloc(len); + BN_bn2bin(peer->iffval, vp->ptr); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_bob - construct Bob's response to Alice's challenge + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + */ +static int +crypto_bob( + struct exten *ep, /* extension pointer */ + struct value *vp /* value pointer */ + ) +{ + DSA *dsa; /* IFF parameters */ + DSA_SIG *sdsa; /* DSA signature context fake */ + BN_CTX *bctx; /* BIGNUM context */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; /* NTP timestamp */ + BIGNUM *bn, *bk, *r; + u_char *ptr; + u_int len; + + /* + * If the IFF parameters are not valid, something awful + * happened or we are being tormented. + */ + if (!(crypto_flags & CRYPTO_FLAG_IFF)) { + msyslog(LOG_INFO, "crypto_bob: scheme unavailable"); + return (XEVNT_PUB); + } + dsa = iffpar_pkey->pkey.dsa; + + /* + * Extract r from the challenge. + */ + len = ntohl(ep->vallen); + if ((r = BN_bin2bn((u_char *)ep->pkt, len, NULL)) == NULL) { + msyslog(LOG_ERR, "crypto_bob %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); + } + + /* + * Bob rolls random k (0 < k < q), computes y = k + b r mod q + * and x = g^k mod p, then sends (y, hash(x)) to Alice. + */ + bctx = BN_CTX_new(); bk = BN_new(); bn = BN_new(); + sdsa = DSA_SIG_new(); + BN_rand(bk, len * 8, -1, 1); /* k */ + BN_mod_mul(bn, dsa->priv_key, r, dsa->q, bctx); /* b r mod q */ + BN_add(bn, bn, bk); + BN_mod(bn, bn, dsa->q, bctx); /* k + b r mod q */ + sdsa->r = BN_dup(bn); + BN_mod_exp(bk, dsa->g, bk, dsa->p, bctx); /* g^k mod p */ + bighash(bk, bk); + sdsa->s = BN_dup(bk); + BN_CTX_free(bctx); + BN_free(r); BN_free(bn); BN_free(bk); + + /* + * Encode the values in ASN.1 and sign. + */ + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = htonl(if_fstamp); + len = i2d_DSA_SIG(sdsa, NULL); + if (len <= 0) { + msyslog(LOG_ERR, "crypto_bob %s\n", + ERR_error_string(ERR_get_error(), NULL)); + DSA_SIG_free(sdsa); + return (XEVNT_PUB); + } + vp->vallen = htonl(len); + ptr = emalloc(len); + vp->ptr = ptr; + i2d_DSA_SIG(sdsa, &ptr); + DSA_SIG_free(sdsa); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_iff - verify Bob's response to Alice's challenge + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_FSP bad filestamp + * XEVNT_ID bad or missing identity parameters + */ +int +crypto_iff( + struct exten *ep, /* extension pointer */ + struct peer *peer /* peer structure pointer */ + ) +{ + DSA *dsa; /* IFF parameters */ + BN_CTX *bctx; /* BIGNUM context */ + DSA_SIG *sdsa; /* DSA parameters */ + BIGNUM *bn, *bk; + u_int len; + const u_char *ptr; + int temp; + + /* + * If the IFF parameters are not valid or no challenge was sent, + * something awful happened or we are being tormented. + */ + if (peer->ident_pkey == NULL) { + msyslog(LOG_INFO, "crypto_iff: scheme unavailable"); + return (XEVNT_PUB); + } + if (ntohl(ep->fstamp) != peer->fstamp) { + msyslog(LOG_INFO, "crypto_iff: invalid filestamp %u", + ntohl(ep->fstamp)); + return (XEVNT_FSP); + } + if ((dsa = peer->ident_pkey->pkey.dsa) == NULL) { + msyslog(LOG_INFO, "crypto_iff: defective key"); + return (XEVNT_PUB); + } + if (peer->iffval == NULL) { + msyslog(LOG_INFO, "crypto_iff: missing challenge"); + return (XEVNT_PUB); + } + + /* + * Extract the k + b r and g^k values from the response. + */ + bctx = BN_CTX_new(); bk = BN_new(); bn = BN_new(); + len = ntohl(ep->vallen); + ptr = (const u_char *)ep->pkt; + if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) { + msyslog(LOG_ERR, "crypto_iff %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); + } + + /* + * Compute g^(k + b r) g^(q - b)r mod p. + */ + BN_mod_exp(bn, dsa->pub_key, peer->iffval, dsa->p, bctx); + BN_mod_exp(bk, dsa->g, sdsa->r, dsa->p, bctx); + BN_mod_mul(bn, bn, bk, dsa->p, bctx); + + /* + * Verify the hash of the result matches hash(x). + */ + bighash(bn, bn); + temp = BN_cmp(bn, sdsa->s); + BN_free(bn); BN_free(bk); BN_CTX_free(bctx); + BN_free(peer->iffval); + peer->iffval = NULL; + DSA_SIG_free(sdsa); + if (temp == 0) + return (XEVNT_OK); + else + return (XEVNT_ID); +} + + +/* + *********************************************************************** + * * + * The following routines implement the Guillou-Quisquater (GQ) * + * identity scheme * + * * + *********************************************************************** + * + * The Guillou-Quisquater (GQ) identity scheme is intended for use when + * the ntp-genkeys program generates the certificates used in the + * protocol and the group key can be conveyed in a certificate extension + * field. The scheme is self contained and independent of new + * generations of host keys, sign keys and certificates. + * + * The GQ identity scheme is based on RSA cryptography and algorithms + * described in Stinson p. 300 (with errors). The GQ values hide in a + * RSA cuckoo structure, but only the modulus is used. The 512-bit + * public modulus is n = p q, where p and q are secret large primes. The + * TA rolls random group key b disguised as a RSA structure member. + * Except for the public key, these values are shared only among group + * members and never revealed in messages. + * + * When rolling new certificates, Bob recomputes the private and + * public keys. The private key u is a random roll, while the public key + * is the inverse obscured by the group key v = (u^-1)^b. These values + * replace the private and public keys normally generated by the RSA + * scheme. Alice challenges Bob to confirm identity using the protocol + * described below. + * + * How it works + * + * The scheme goes like this. Both Alice and Bob have the same modulus n + * and some random b as the group key. These values are computed and + * distributed in advance via secret means, although only the group key + * b is truly secret. Each has a private random private key u and public + * key (u^-1)^b, although not necessarily the same ones. Bob and Alice + * can regenerate the key pair from time to time without affecting + * operations. The public key is conveyed on the certificate in an + * extension field; the private key is never revealed. + * + * Alice rolls new random challenge r and sends to Bob in the GQ + * request message. Bob rolls new random k, then computes y = k u^r mod + * n and x = k^b mod n and sends (y, hash(x)) to Alice in the response + * message. Besides making the response shorter, the hash makes it + * effectivey impossible for an intruder to solve for b by observing + * a number of these messages. + * + * Alice receives the response and computes y^b v^r mod n. After a bit + * of algebra, this simplifies to k^b. If the hash of this result + * matches hash(x), Alice knows that Bob has the group key b. The signed + * response binds this knowledge to Bob's private key and the public key + * previously received in his certificate. + * + * crypto_alice2 - construct Alice's challenge in GQ scheme + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_ID bad or missing identity parameters + */ +static int +crypto_alice2( + struct peer *peer, /* peer pointer */ + struct value *vp /* value pointer */ + ) +{ + RSA *rsa; /* GQ parameters */ + BN_CTX *bctx; /* BIGNUM context */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; + u_int len; + + /* + * The identity parameters must have correct format and content. + */ + if (peer->ident_pkey == NULL) + return (XEVNT_ID); + if ((rsa = peer->ident_pkey->pkey.rsa) == NULL) { + msyslog(LOG_INFO, "crypto_alice2: defective key"); + return (XEVNT_PUB); + } + + /* + * Roll new random r (0 < r < n). The OpenSSL library has a bug + * omitting BN_rand_range, so we have to do it the hard way. + */ + bctx = BN_CTX_new(); + len = BN_num_bytes(rsa->n); + if (peer->iffval != NULL) + BN_free(peer->iffval); + peer->iffval = BN_new(); + BN_rand(peer->iffval, len * 8, -1, 1); /* r mod n */ + BN_mod(peer->iffval, peer->iffval, rsa->n, bctx); + BN_CTX_free(bctx); + + /* + * Sign and send to Bob. The filestamp is from the local file. + */ + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = htonl(peer->fstamp); + vp->vallen = htonl(len); + vp->ptr = emalloc(len); + BN_bn2bin(peer->iffval, vp->ptr); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_bob2 - construct Bob's response to Alice's challenge + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + */ +static int +crypto_bob2( + struct exten *ep, /* extension pointer */ + struct value *vp /* value pointer */ + ) +{ + RSA *rsa; /* GQ parameters */ + DSA_SIG *sdsa; /* DSA parameters */ + BN_CTX *bctx; /* BIGNUM context */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; /* NTP timestamp */ + BIGNUM *r, *k, *g, *y; + u_char *ptr; + u_int len; + + /* + * If the GQ parameters are not valid, something awful + * happened or we are being tormented. + */ + if (!(crypto_flags & CRYPTO_FLAG_GQ)) { + msyslog(LOG_INFO, "crypto_bob2: scheme unavailable"); + return (XEVNT_PUB); + } + rsa = gqpar_pkey->pkey.rsa; + + /* + * Extract r from the challenge. + */ + len = ntohl(ep->vallen); + if ((r = BN_bin2bn((u_char *)ep->pkt, len, NULL)) == NULL) { + msyslog(LOG_ERR, "crypto_bob2 %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); + } + + /* + * Bob rolls random k (0 < k < n), computes y = k u^r mod n and + * x = k^b mod n, then sends (y, hash(x)) to Alice. + */ + bctx = BN_CTX_new(); k = BN_new(); g = BN_new(); y = BN_new(); + sdsa = DSA_SIG_new(); + BN_rand(k, len * 8, -1, 1); /* k */ + BN_mod(k, k, rsa->n, bctx); + BN_mod_exp(y, rsa->p, r, rsa->n, bctx); /* u^r mod n */ + BN_mod_mul(y, k, y, rsa->n, bctx); /* k u^r mod n */ + sdsa->r = BN_dup(y); + BN_mod_exp(g, k, rsa->e, rsa->n, bctx); /* k^b mod n */ + bighash(g, g); + sdsa->s = BN_dup(g); + BN_CTX_free(bctx); + BN_free(r); BN_free(k); BN_free(g); BN_free(y); + + /* + * Encode the values in ASN.1 and sign. + */ + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = htonl(gq_fstamp); + len = i2d_DSA_SIG(sdsa, NULL); + if (len <= 0) { + msyslog(LOG_ERR, "crypto_bob2 %s\n", + ERR_error_string(ERR_get_error(), NULL)); + DSA_SIG_free(sdsa); + return (XEVNT_PUB); + } + vp->vallen = htonl(len); + ptr = emalloc(len); + vp->ptr = ptr; + i2d_DSA_SIG(sdsa, &ptr); + DSA_SIG_free(sdsa); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_gq - verify Bob's response to Alice's challenge + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_FSP bad filestamp + * XEVNT_ID bad or missing identity parameters + */ +int +crypto_gq( + struct exten *ep, /* extension pointer */ + struct peer *peer /* peer structure pointer */ + ) +{ + RSA *rsa; /* GQ parameters */ + BN_CTX *bctx; /* BIGNUM context */ + DSA_SIG *sdsa; /* RSA signature context fake */ + BIGNUM *y, *v; + const u_char *ptr; + u_int len; + int temp; + + /* + * If the GQ parameters are not valid or no challenge was sent, + * something awful happened or we are being tormented. + */ + if (peer->ident_pkey == NULL) { + msyslog(LOG_INFO, "crypto_gq: scheme unavailable"); + return (XEVNT_PUB); + } + if (ntohl(ep->fstamp) != peer->fstamp) { + msyslog(LOG_INFO, "crypto_gq: invalid filestamp %u", + ntohl(ep->fstamp)); + return (XEVNT_FSP); + } + if ((rsa = peer->ident_pkey->pkey.rsa) == NULL) { + msyslog(LOG_INFO, "crypto_gq: defective key"); + return (XEVNT_PUB); + } + if (peer->iffval == NULL) { + msyslog(LOG_INFO, "crypto_gq: missing challenge"); + return (XEVNT_PUB); + } + + /* + * Extract the y = k u^r and hash(x = k^b) values from the + * response. + */ + bctx = BN_CTX_new(); y = BN_new(); v = BN_new(); + len = ntohl(ep->vallen); + ptr = (const u_char *)ep->pkt; + if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) { + msyslog(LOG_ERR, "crypto_gq %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); + } + + /* + * Compute v^r y^b mod n. + */ + BN_mod_exp(v, peer->grpkey, peer->iffval, rsa->n, bctx); + /* v^r mod n */ + BN_mod_exp(y, sdsa->r, rsa->e, rsa->n, bctx); /* y^b mod n */ + BN_mod_mul(y, v, y, rsa->n, bctx); /* v^r y^b mod n */ + + /* + * Verify the hash of the result matches hash(x). + */ + bighash(y, y); + temp = BN_cmp(y, sdsa->s); + BN_CTX_free(bctx); BN_free(y); BN_free(v); + BN_free(peer->iffval); + peer->iffval = NULL; + DSA_SIG_free(sdsa); + if (temp == 0) + return (XEVNT_OK); + else + return (XEVNT_ID); +} + + +/* + *********************************************************************** + * * + * The following routines implement the Mu-Varadharajan (MV) identity * + * scheme * + * * + *********************************************************************** + */ +/* + * The Mu-Varadharajan (MV) cryptosystem was originally intended when + * servers broadcast messages to clients, but clients never send + * messages to servers. There is one encryption key for the server and a + * separate decryption key for each client. It operated something like a + * pay-per-view satellite broadcasting system where the session key is + * encrypted by the broadcaster and the decryption keys are held in a + * tamperproof set-top box. + * + * The MV parameters and private encryption key hide in a DSA cuckoo + * structure which uses the same parameters, but generated in a + * different way. The values are used in an encryption scheme similar to + * El Gamal cryptography and a polynomial formed from the expansion of + * product terms (x - x[j]), as described in Mu, Y., and V. + * Varadharajan: Robust and Secure Broadcasting, Proc. Indocrypt 2001, + * 223-231. The paper has significant errors and serious omissions. + * + * Let q be the product of n distinct primes s'[j] (j = 1...n), where + * each s'[j] has m significant bits. Let p be a prime p = 2 * q + 1, so + * that q and each s'[j] divide p - 1 and p has M = n * m + 1 + * significant bits. The elements x mod q of Zq with the elements 2 and + * the primes removed form a field Zq* valid for polynomial arithetic. + * Let g be a generator of Zp; that is, gcd(g, p - 1) = 1 and g^q = 1 + * mod p. We expect M to be in the 500-bit range and n relatively small, + * like 25, so the likelihood of a randomly generated element of x mod q + * of Zq colliding with a factor of p - 1 is very small and can be + * avoided. Associated with each s'[j] is an element s[j] such that s[j] + * s'[j] = s'[j] mod q. We find s[j] as the quotient (q + s'[j]) / + * s'[j]. These are the parameters of the scheme and they are expensive + * to compute. + * + * We set up an instance of the scheme as follows. A set of random + * values x[j] mod q (j = 1...n), are generated as the zeros of a + * polynomial of order n. The product terms (x - x[j]) are expanded to + * form coefficients a[i] mod q (i = 0...n) in powers of x. These are + * used as exponents of the generator g mod p to generate the private + * encryption key A. The pair (gbar, ghat) of public server keys and the + * pairs (xbar[j], xhat[j]) (j = 1...n) of private client keys are used + * to construct the decryption keys. The devil is in the details. + * + * The distinguishing characteristic of this scheme is the capability to + * revoke keys. Included in the calculation of E, gbar and ghat is the + * product s = prod(s'[j]) (j = 1...n) above. If the factor s'[j] is + * subsequently removed from the product and E, gbar and ghat + * recomputed, the jth client will no longer be able to compute E^-1 and + * thus unable to decrypt the block. + * + * How it works + * + * The scheme goes like this. Bob has the server values (p, A, q, gbar, + * ghat) and Alice the client values (p, xbar, xhat). + * + * Alice rolls new random challenge r (0 < r < p) and sends to Bob in + * the MV request message. Bob rolls new random k (0 < k < q), encrypts + * y = A^k mod p (a permutation) and sends (hash(y), gbar^k, ghat^k) to + * Alice. + * + * Alice receives the response and computes the decryption key (the + * inverse permutation) from previously obtained (xbar, xhat) and + * (gbar^k, ghat^k) in the message. She computes the inverse, which is + * unique by reasons explained in the ntp-keygen.c program sources. If + * the hash of this result matches hash(y), Alice knows that Bob has the + * group key b. The signed response binds this knowledge to Bob's + * private key and the public key previously received in his + * certificate. + * + * crypto_alice3 - construct Alice's challenge in MV scheme + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_ID bad or missing identity parameters + */ +static int +crypto_alice3( + struct peer *peer, /* peer pointer */ + struct value *vp /* value pointer */ + ) +{ + DSA *dsa; /* MV parameters */ + BN_CTX *bctx; /* BIGNUM context */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; + u_int len; + + /* + * The identity parameters must have correct format and content. + */ + if (peer->ident_pkey == NULL) + return (XEVNT_ID); + if ((dsa = peer->ident_pkey->pkey.dsa) == NULL) { + msyslog(LOG_INFO, "crypto_alice3: defective key"); + return (XEVNT_PUB); + } + + /* + * Roll new random r (0 < r < q). The OpenSSL library has a bug + * omitting BN_rand_range, so we have to do it the hard way. + */ + bctx = BN_CTX_new(); + len = BN_num_bytes(dsa->p); + if (peer->iffval != NULL) + BN_free(peer->iffval); + peer->iffval = BN_new(); + BN_rand(peer->iffval, len * 8, -1, 1); /* r */ + BN_mod(peer->iffval, peer->iffval, dsa->p, bctx); + BN_CTX_free(bctx); + + /* + * Sign and send to Bob. The filestamp is from the local file. + */ + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = htonl(peer->fstamp); + vp->vallen = htonl(len); + vp->ptr = emalloc(len); + BN_bn2bin(peer->iffval, vp->ptr); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_bob3 - construct Bob's response to Alice's challenge + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + */ +static int +crypto_bob3( + struct exten *ep, /* extension pointer */ + struct value *vp /* value pointer */ + ) +{ + DSA *dsa; /* MV parameters */ + DSA *sdsa; /* DSA signature context fake */ + BN_CTX *bctx; /* BIGNUM context */ + EVP_MD_CTX ctx; /* signature context */ + tstamp_t tstamp; /* NTP timestamp */ + BIGNUM *r, *k, *u; + u_char *ptr; + u_int len; + + /* + * If the MV parameters are not valid, something awful + * happened or we are being tormented. + */ + if (!(crypto_flags & CRYPTO_FLAG_MV)) { + msyslog(LOG_INFO, "crypto_bob3: scheme unavailable"); + return (XEVNT_PUB); + } + dsa = mvpar_pkey->pkey.dsa; + + /* + * Extract r from the challenge. + */ + len = ntohl(ep->vallen); + if ((r = BN_bin2bn((u_char *)ep->pkt, len, NULL)) == NULL) { + msyslog(LOG_ERR, "crypto_bob3 %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); + } + + /* + * Bob rolls random k (0 < k < q), making sure it is not a + * factor of q. He then computes y = A^k r and sends (hash(y), + * gbar^k, ghat^k) to Alice. + */ + bctx = BN_CTX_new(); k = BN_new(); u = BN_new(); + sdsa = DSA_new(); + sdsa->p = BN_new(); sdsa->q = BN_new(); sdsa->g = BN_new(); + while (1) { + BN_rand(k, BN_num_bits(dsa->q), 0, 0); + BN_mod(k, k, dsa->q, bctx); + BN_gcd(u, k, dsa->q, bctx); + if (BN_is_one(u)) + break; + } + BN_mod_exp(u, dsa->g, k, dsa->p, bctx); /* A r */ + BN_mod_mul(u, u, r, dsa->p, bctx); + bighash(u, sdsa->p); + BN_mod_exp(sdsa->q, dsa->priv_key, k, dsa->p, bctx); /* gbar */ + BN_mod_exp(sdsa->g, dsa->pub_key, k, dsa->p, bctx); /* ghat */ + BN_CTX_free(bctx); BN_free(k); BN_free(r); BN_free(u); + + /* + * Encode the values in ASN.1 and sign. + */ + tstamp = crypto_time(); + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = htonl(mv_fstamp); + len = i2d_DSAparams(sdsa, NULL); + if (len <= 0) { + msyslog(LOG_ERR, "crypto_bob3 %s\n", + ERR_error_string(ERR_get_error(), NULL)); + DSA_free(sdsa); + return (XEVNT_PUB); + } + vp->vallen = htonl(len); + ptr = emalloc(len); + vp->ptr = ptr; + i2d_DSAparams(sdsa, &ptr); + DSA_free(sdsa); + vp->siglen = 0; + if (tstamp == 0) + return (XEVNT_OK); + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)&vp->tstamp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); + return (XEVNT_OK); +} + + +/* + * crypto_mv - verify Bob's response to Alice's challenge + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_FSP bad filestamp + * XEVNT_ID bad or missing identity parameters + */ +int +crypto_mv( + struct exten *ep, /* extension pointer */ + struct peer *peer /* peer structure pointer */ + ) +{ + DSA *dsa; /* MV parameters */ + DSA *sdsa; /* DSA parameters */ + BN_CTX *bctx; /* BIGNUM context */ + BIGNUM *k, *u, *v; + u_int len; + const u_char *ptr; + int temp; + + /* + * If the MV parameters are not valid or no challenge was sent, + * something awful happened or we are being tormented. + */ + if (peer->ident_pkey == NULL) { + msyslog(LOG_INFO, "crypto_mv: scheme unavailable"); + return (XEVNT_PUB); + } + if (ntohl(ep->fstamp) != peer->fstamp) { + msyslog(LOG_INFO, "crypto_mv: invalid filestamp %u", + ntohl(ep->fstamp)); + return (XEVNT_FSP); + } + if ((dsa = peer->ident_pkey->pkey.dsa) == NULL) { + msyslog(LOG_INFO, "crypto_mv: defective key"); + return (XEVNT_PUB); + } + if (peer->iffval == NULL) { + msyslog(LOG_INFO, "crypto_mv: missing challenge"); + return (XEVNT_PUB); + } + + /* + * Extract the (hash(y), gbar, ghat) values from the response. + */ + bctx = BN_CTX_new(); k = BN_new(); u = BN_new(); v = BN_new(); + len = ntohl(ep->vallen); + ptr = (const u_char *)ep->pkt; + if ((sdsa = d2i_DSAparams(NULL, &ptr, len)) == NULL) { + msyslog(LOG_ERR, "crypto_mv %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_PUB); + } + + /* + * Compute (gbar^xhat ghat^xbar)^-1 mod p. + */ + BN_mod_exp(u, sdsa->q, dsa->pub_key, dsa->p, bctx); + BN_mod_exp(v, sdsa->g, dsa->priv_key, dsa->p, bctx); + BN_mod_mul(u, u, v, dsa->p, bctx); + BN_mod_inverse(u, u, dsa->p, bctx); + BN_mod_mul(v, u, peer->iffval, dsa->p, bctx); + + /* + * The result should match the hash of r mod p. + */ + bighash(v, v); + temp = BN_cmp(v, sdsa->p); + BN_CTX_free(bctx); BN_free(k); BN_free(u); BN_free(v); + BN_free(peer->iffval); + peer->iffval = NULL; + DSA_free(sdsa); + if (temp == 0) + return (XEVNT_OK); + else + return (XEVNT_ID); +} + + +/* + *********************************************************************** + * * + * The following routines are used to manipulate certificates * + * * + *********************************************************************** + */ +/* + * cert_parse - parse x509 certificate and create info/value structures. + * + * The server certificate includes the version number, issuer name, + * subject name, public key and valid date interval. If the issuer name + * is the same as the subject name, the certificate is self signed and + * valid only if the server is configured as trustable. If the names are + * different, another issuer has signed the server certificate and + * vouched for it. In this case the server certificate is valid if + * verified by the issuer public key. + * + * Returns certificate info/value pointer if valid, NULL if not. + */ +struct cert_info * /* certificate information structure */ +cert_parse( + u_char *asn1cert, /* X509 certificate */ + u_int len, /* certificate length */ + tstamp_t fstamp /* filestamp */ + ) +{ + X509 *cert; /* X509 certificate */ + X509_EXTENSION *ext; /* X509v3 extension */ + struct cert_info *ret; /* certificate info/value */ + BIO *bp; + X509V3_EXT_METHOD *method; + char pathbuf[MAXFILENAME]; + u_char *uptr; + char *ptr; + int temp, cnt, i; + + /* + * Decode ASN.1 objects and construct certificate structure. + */ + uptr = asn1cert; + if ((cert = d2i_X509(NULL, &uptr, len)) == NULL) { + msyslog(LOG_ERR, "cert_parse %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (NULL); + } + + /* + * Extract version, subject name and public key. + */ + ret = emalloc(sizeof(struct cert_info)); + memset(ret, 0, sizeof(struct cert_info)); + if ((ret->pkey = X509_get_pubkey(cert)) == NULL) { + msyslog(LOG_ERR, "cert_parse %s\n", + ERR_error_string(ERR_get_error(), NULL)); + cert_free(ret); + X509_free(cert); + return (NULL); + } + ret->version = X509_get_version(cert); + X509_NAME_oneline(X509_get_subject_name(cert), pathbuf, + MAXFILENAME - 1); + ptr = strstr(pathbuf, "CN="); + if (ptr == NULL) { + msyslog(LOG_INFO, "cert_parse: invalid subject %s", + pathbuf); + cert_free(ret); + X509_free(cert); + return (NULL); + } + ret->subject = emalloc(strlen(ptr) + 1); + strcpy(ret->subject, ptr + 3); + + /* + * Extract remaining objects. Note that the NTP serial number is + * the NTP seconds at the time of signing, but this might not be + * the case for other authority. We don't bother to check the + * objects at this time, since the real crunch can happen only + * when the time is valid but not yet certificated. + */ + ret->nid = OBJ_obj2nid(cert->cert_info->signature->algorithm); + ret->digest = (const EVP_MD *)EVP_get_digestbynid(ret->nid); + ret->serial = + (u_long)ASN1_INTEGER_get(X509_get_serialNumber(cert)); + X509_NAME_oneline(X509_get_issuer_name(cert), pathbuf, + MAXFILENAME); + if ((ptr = strstr(pathbuf, "CN=")) == NULL) { + msyslog(LOG_INFO, "cert_parse: invalid issuer %s", + pathbuf); + cert_free(ret); + X509_free(cert); + return (NULL); + } + ret->issuer = emalloc(strlen(ptr) + 1); + strcpy(ret->issuer, ptr + 3); + ret->first = asn2ntp(X509_get_notBefore(cert)); + ret->last = asn2ntp(X509_get_notAfter(cert)); + + /* + * Extract extension fields. These are ad hoc ripoffs of + * currently assigned functions and will certainly be changed + * before prime time. + */ + cnt = X509_get_ext_count(cert); + for (i = 0; i < cnt; i++) { + ext = X509_get_ext(cert, i); + method = X509V3_EXT_get(ext); + temp = OBJ_obj2nid(ext->object); + switch (temp) { + + /* + * If a key_usage field is present, we decode whether + * this is a trusted or private certificate. This is + * dorky; all we want is to compare NIDs, but OpenSSL + * insists on BIO text strings. + */ + case NID_ext_key_usage: + bp = BIO_new(BIO_s_mem()); + X509V3_EXT_print(bp, ext, 0, 0); + BIO_gets(bp, pathbuf, MAXFILENAME); + BIO_free(bp); +#if DEBUG + if (debug) + printf("cert_parse: %s: %s\n", + OBJ_nid2ln(temp), pathbuf); +#endif + if (strcmp(pathbuf, "Trust Root") == 0) + ret->flags |= CERT_TRUST; + else if (strcmp(pathbuf, "Private") == 0) + ret->flags |= CERT_PRIV; + break; + + /* + * If a NID_subject_key_identifier field is present, it + * contains the GQ public key. + */ + case NID_subject_key_identifier: + ret->grplen = ext->value->length - 2; + ret->grpkey = emalloc(ret->grplen); + memcpy(ret->grpkey, &ext->value->data[2], + ret->grplen); + break; + } + } + + /* + * If certificate is self signed, verify signature. + */ + if (strcmp(ret->subject, ret->issuer) == 0) { + if (!X509_verify(cert, ret->pkey)) { + msyslog(LOG_INFO, + "cert_parse: invalid signature not verified %s", + pathbuf); + cert_free(ret); + X509_free(cert); + return (NULL); + } + } + + /* + * Verify certificate valid times. Note that certificates cannot + * be retroactive. + */ + if (ret->first > ret->last || ret->first < fstamp) { + msyslog(LOG_INFO, + "cert_parse: expired %s", + ret->subject); + cert_free(ret); + X509_free(cert); + return (NULL); + } + + /* + * Build the value structure to sign and send later. + */ + ret->cert.fstamp = htonl(fstamp); + ret->cert.vallen = htonl(len); + ret->cert.ptr = emalloc(len); + memcpy(ret->cert.ptr, asn1cert, len); +#ifdef DEBUG + if (debug > 1) + X509_print_fp(stdout, cert); +#endif + X509_free(cert); + return (ret); +} + + +/* + * cert_sign - sign x509 certificate and update value structure. + * + * The certificate request is a copy of the client certificate, which + * includes the version number, subject name and public key of the + * client. The resulting certificate includes these values plus the + * serial number, issuer name and validity interval of the server. The + * validity interval extends from the current time to the same time one + * year hence. For NTP purposes, it is convenient to use the NTP seconds + * of the current time as the serial number. + * + * Returns + * XEVNT_OK success + * XEVNT_PUB bad or missing public key + * XEVNT_CRT bad or missing certificate + * XEVNT_VFY certificate not verified + */ +static int +cert_sign( + struct exten *ep, /* extension field pointer */ + struct value *vp /* value pointer */ + ) +{ + X509 *req; /* X509 certificate request */ + X509 *cert; /* X509 certificate */ + X509_EXTENSION *ext; /* certificate extension */ + ASN1_INTEGER *serial; /* serial number */ + X509_NAME *subj; /* distinguished (common) name */ + EVP_PKEY *pkey; /* public key */ + EVP_MD_CTX ctx; /* message digest context */ + tstamp_t tstamp; /* NTP timestamp */ + u_int len; + u_char *ptr; + int i, temp; + + /* + * Decode ASN.1 objects and construct certificate structure. + */ + tstamp = crypto_time(); + if (tstamp == 0) + return (XEVNT_TSP); + + ptr = (u_char *)ep->pkt; + if ((req = d2i_X509(NULL, &ptr, ntohl(ep->vallen))) == NULL) { + msyslog(LOG_ERR, "cert_sign %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (XEVNT_CRT); + } + /* + * Extract public key and check for errors. + */ + if ((pkey = X509_get_pubkey(req)) == NULL) { + msyslog(LOG_ERR, "cert_sign %s\n", + ERR_error_string(ERR_get_error(), NULL)); + X509_free(req); + return (XEVNT_PUB); + } + + /* + * Generate X509 certificate signed by this server. For this + * prupose the issuer name is the server name. Also copy any + * extensions that might be present. + */ + cert = X509_new(); + X509_set_version(cert, X509_get_version(req)); + serial = ASN1_INTEGER_new(); + ASN1_INTEGER_set(serial, tstamp); + X509_set_serialNumber(cert, serial); + X509_gmtime_adj(X509_get_notBefore(cert), 0L); + X509_gmtime_adj(X509_get_notAfter(cert), YEAR); + subj = X509_get_issuer_name(cert); + X509_NAME_add_entry_by_txt(subj, "commonName", MBSTRING_ASC, + (unsigned char *) sys_hostname, strlen(sys_hostname), -1, 0); + subj = X509_get_subject_name(req); + X509_set_subject_name(cert, subj); + X509_set_pubkey(cert, pkey); + ext = X509_get_ext(req, 0); + temp = X509_get_ext_count(req); + for (i = 0; i < temp; i++) { + ext = X509_get_ext(req, i); + X509_add_ext(cert, ext, -1); + } + X509_free(req); + + /* + * Sign and verify the certificate. + */ + X509_sign(cert, sign_pkey, sign_digest); + if (!X509_verify(cert, sign_pkey)) { + printf("cert_sign\n%s\n", + ERR_error_string(ERR_get_error(), NULL)); + X509_free(cert); + return (XEVNT_VFY); + } + len = i2d_X509(cert, NULL); + + /* + * Build and sign the value structure. We have to sign it here, + * since the response has to be returned right away. This is a + * clogging hazard. + */ + memset(vp, 0, sizeof(struct value)); + vp->tstamp = htonl(tstamp); + vp->fstamp = ep->fstamp; + vp->vallen = htonl(len); + vp->ptr = emalloc(len); + ptr = vp->ptr; + i2d_X509(cert, &ptr); + vp->siglen = 0; + vp->sig = emalloc(sign_siglen); + EVP_SignInit(&ctx, sign_digest); + EVP_SignUpdate(&ctx, (u_char *)vp, 12); + EVP_SignUpdate(&ctx, vp->ptr, len); + if (EVP_SignFinal(&ctx, vp->sig, &len, sign_pkey)) + vp->siglen = htonl(len); +#ifdef DEBUG + if (debug > 1) + X509_print_fp(stdout, cert); +#endif + X509_free(cert); + return (XEVNT_OK); +} + + +/* + * cert_valid - verify certificate with given public key + * + * This is pretty ugly, as the certificate has to be verified in the + * OpenSSL X509 structure, not in the DER format in the info/value + * structure. + * + * Returns + * XEVNT_OK success + * XEVNT_VFY certificate not verified + */ +int +cert_valid( + struct cert_info *cinf, /* certificate information structure */ + EVP_PKEY *pkey /* public key */ + ) +{ + X509 *cert; /* X509 certificate */ + u_char *ptr; + + if (cinf->flags & CERT_SIGN) + return (XEVNT_OK); + ptr = (u_char *)cinf->cert.ptr; + cert = d2i_X509(NULL, &ptr, ntohl(cinf->cert.vallen)); + if (!X509_verify(cert, pkey)) + return (XEVNT_VFY); + cinf->flags |= CERT_SIGN; + X509_free(cert); + return (XEVNT_OK); +} + + +/* + * cert - install certificate in certificate list + * + * This routine encodes an extension field into a certificate info/value + * structure. It searches the certificate list for duplicates and + * expunges whichever is older. It then searches the list for other + * certificates that might be verified by this latest one. Finally, it + * inserts this certificate first on the list. + * + * Returns + * XEVNT_OK success + * XEVNT_PER certificate expired + * XEVNT_CRT bad or missing certificate + */ +int +cert_install( + struct exten *ep, /* cert info/value */ + struct peer *peer /* peer structure */ + ) +{ + struct cert_info *cp, *xp, *yp, **zp; + int rval; + tstamp_t tstamp; + + /* + * Parse and validate the signed certificate. If valid, + * construct the info/value structure; otherwise, scamper home. + * Note this allows a certificate not-before time to be in the + * future, but not a not-after time to be in the past. + */ + if ((cp = cert_parse((u_char *)ep->pkt, ntohl(ep->vallen), + ntohl(ep->fstamp))) == NULL) + return (XEVNT_CRT); + + tstamp = crypto_time(); + if (tstamp > cp->last) { + cert_free(cp); + return (XEVNT_PER); + } + + /* + * Scan certificate list looking for another certificate with + * the same subject and issuer. If another is found with the + * same or older filestamp, unlink it and return the goodies to + * the heap. If another is found with a later filetsamp, discard + * the new one and leave the building. + */ + rval = XEVNT_OK; + yp = cp; + zp = &cinfo; + for (xp = cinfo; xp != NULL; xp = xp->link) { + if (strcmp(cp->subject, xp->subject) == 0 && + strcmp(cp->issuer, xp->issuer) == 0) { + if (ntohl(cp->cert.fstamp) <= + ntohl(xp->cert.fstamp)) { + *zp = xp->link;; + cert_free(xp); + } else { + cert_free(cp); + return (XEVNT_TSP); + } + break; + } + zp = &xp->link; + } + yp->link = cinfo; + cinfo = yp; + + /* + * Scan the certificate list to see if Y is signed by X. + */ + for (yp = cinfo; yp != NULL; yp = yp->link) { + for (xp = cinfo; xp != NULL; xp = xp->link) { + if (yp->flags & CERT_ERROR) + continue; + + /* + * If issuer Y matches subject X and signature Y + * is valid using public key X, then Y is valid. + */ + if (strcmp(yp->issuer, xp->subject) != 0) + continue; + + if (cert_valid(yp, xp->pkey) != XEVNT_OK) { + yp->flags |= CERT_ERROR; + continue; + } + xp->flags |= CERT_SIGN; + + /* + * If X is trusted, then Y is trusted. Note that + * we might stumble over a self signed + * certificate that is not trusted, at least + * temporarily. This can happen when a dude + * first comes up, but has not synchronized the + * clock and had its certificate signed by its + * server. In case of broken certificate trail, + * this might result in a loop that could + * persist until timeout. + */ + if (!(xp->flags & CERT_TRUST)) + continue; + + yp->flags |= CERT_TRUST; + + /* + * If subject Y matches the server subject name, + * then Y has completed the certificate trail. + * Save the group key and light the valid bit. + */ + if (strcmp(yp->subject, peer->subject) != 0) + continue; + + if (yp->grpkey != NULL) { + if (peer->grpkey != NULL) + BN_free(peer->grpkey); + peer->grpkey = BN_bin2bn(yp->grpkey, + yp->grplen, NULL); + } + peer->crypto |= CRYPTO_FLAG_VALID; + + /* + * If the server has an an identity scheme, + * fetch the identity credentials. If not, the + * identity is verified only by the trusted + * certificate. The next signature will set the + * server proventic. + */ + if (peer->crypto & (CRYPTO_FLAG_GQ | + CRYPTO_FLAG_IFF | CRYPTO_FLAG_MV)) + continue; + + peer->crypto |= CRYPTO_FLAG_VRFY; + } + } + + /* + * That was awesome. Now update the timestamps and signatures. + */ + crypto_update(); + return (rval); +} + + +/* + * cert_free - free certificate information structure + */ +void +cert_free( + struct cert_info *cinf /* certificate info/value structure */ + ) +{ + if (cinf->pkey != NULL) + EVP_PKEY_free(cinf->pkey); + if (cinf->subject != NULL) + free(cinf->subject); + if (cinf->issuer != NULL) + free(cinf->issuer); + if (cinf->grpkey != NULL) + free(cinf->grpkey); + value_free(&cinf->cert); + free(cinf); +} + + +/* + *********************************************************************** + * * + * The following routines are used only at initialization time * + * * + *********************************************************************** + */ +/* + * crypto_key - load cryptographic parameters and keys from files + * + * This routine loads a PEM-encoded public/private key pair and extracts + * the filestamp from the file name. + * + * Returns public key pointer if valid, NULL if not. Side effect updates + * the filestamp if valid. + */ +static EVP_PKEY * +crypto_key( + char *cp, /* file name */ + tstamp_t *fstamp /* filestamp */ + ) +{ + FILE *str; /* file handle */ + EVP_PKEY *pkey = NULL; /* public/private key */ + char filename[MAXFILENAME]; /* name of key file */ + char linkname[MAXFILENAME]; /* filestamp buffer) */ + char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */ + char *ptr; + + /* + * Open the key file. If the first character of the file name is + * not '/', prepend the keys directory string. If something goes + * wrong, abandon ship. + */ + if (*cp == '/') + strcpy(filename, cp); + else + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, cp); + str = fopen(filename, "r"); + if (str == NULL) + return (NULL); + + /* + * Read the filestamp, which is contained in the first line. + */ + if ((ptr = fgets(linkname, MAXFILENAME, str)) == NULL) { + msyslog(LOG_ERR, "crypto_key: no data %s\n", + filename); + return (NULL); + } + if ((ptr = strrchr(ptr, '.')) == NULL) { + msyslog(LOG_ERR, "crypto_key: no filestamp %s\n", + filename); + return (NULL); + } + if (sscanf(++ptr, "%u", fstamp) != 1) { + msyslog(LOG_ERR, "crypto_key: invalid timestamp %s\n", + filename); + return (NULL); + } + + /* + * Read and decrypt PEM-encoded private key. + */ + pkey = PEM_read_PrivateKey(str, NULL, NULL, passwd); + fclose(str); + if (pkey == NULL) { + msyslog(LOG_ERR, "crypto_key %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (NULL); + } + + /* + * Leave tracks in the cryptostats. + */ + if ((ptr = strrchr(linkname, '\n')) != NULL) + *ptr = '\0'; + sprintf(statstr, "%s mod %d", &linkname[2], + EVP_PKEY_size(pkey) * 8); + record_crypto_stats(NULL, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_key: %s\n", statstr); + if (debug > 1) { + if (EVP_MD_type(pkey) == EVP_PKEY_DSA) + DSA_print_fp(stdout, pkey->pkey.dsa, 0); + else + RSA_print_fp(stdout, pkey->pkey.rsa, 0); + } +#endif + return (pkey); +} + + +/* + * crypto_cert - load certificate from file + * + * This routine loads a X.509 RSA or DSA certificate from a file and + * constructs a info/cert value structure for this machine. The + * structure includes a filestamp extracted from the file name. Later + * the certificate can be sent to another machine by request. + * + * Returns certificate info/value pointer if valid, NULL if not. + */ +static struct cert_info * /* certificate information */ +crypto_cert( + char *cp /* file name */ + ) +{ + struct cert_info *ret; /* certificate information */ + FILE *str; /* file handle */ + char filename[MAXFILENAME]; /* name of certificate file */ + char linkname[MAXFILENAME]; /* filestamp buffer */ + char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */ + tstamp_t fstamp; /* filestamp */ + long len; + char *ptr; + char *name, *header; + u_char *data; + + /* + * Open the certificate file. If the first character of the file + * name is not '/', prepend the keys directory string. If + * something goes wrong, abandon ship. + */ + if (*cp == '/') + strcpy(filename, cp); + else + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, cp); + str = fopen(filename, "r"); + if (str == NULL) + return (NULL); + + /* + * Read the filestamp, which is contained in the first line. + */ + if ((ptr = fgets(linkname, MAXFILENAME, str)) == NULL) { + msyslog(LOG_ERR, "crypto_cert: no data %s\n", + filename); + return (NULL); + } + if ((ptr = strrchr(ptr, '.')) == NULL) { + msyslog(LOG_ERR, "crypto_cert: no filestamp %s\n", + filename); + return (NULL); + } + if (sscanf(++ptr, "%u", &fstamp) != 1) { + msyslog(LOG_ERR, "crypto_cert: invalid filestamp %s\n", + filename); + return (NULL); + } + + /* + * Read PEM-encoded certificate and install. + */ + if (!PEM_read(str, &name, &header, &data, &len)) { + msyslog(LOG_ERR, "crypto_cert %s\n", + ERR_error_string(ERR_get_error(), NULL)); + return (NULL); + } + free(header); + if (strcmp(name, "CERTIFICATE") !=0) { + msyslog(LOG_INFO, "crypto_cert: wrong PEM type %s", + name); + free(name); + free(data); + return (NULL); + } + free(name); + + /* + * Parse certificate and generate info/value structure. + */ + ret = cert_parse(data, len, fstamp); + free(data); + if (ret == NULL) + return (NULL); + if ((ptr = strrchr(linkname, '\n')) != NULL) + *ptr = '\0'; + sprintf(statstr, "%s 0x%x len %lu", &linkname[2], ret->flags, + len); + record_crypto_stats(NULL, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_cert: %s\n", statstr); +#endif + return (ret); +} + + +/* + * crypto_tai - load leapseconds table from file + * + * This routine loads the ERTS leapsecond file in NIST text format, + * converts to a value structure and extracts a filestamp from the file + * name. The data are used to establish the TAI offset from UTC, which + * is provided to the kernel if supported. Later the data can be sent to + * another machine on request. + */ +static void +crypto_tai( + char *cp /* file name */ + ) +{ + FILE *str; /* file handle */ + char buf[NTP_MAXSTRLEN]; /* 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) */ + char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */ + tstamp_t fstamp; /* filestamp */ + u_int len; + char *ptr; + 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); + if ((str = fopen(filename, "r")) == NULL) + return; + + /* + * Extract filestamp if present. + */ + rval = readlink(filename, linkname, MAXFILENAME - 1); + if (rval > 0) { + linkname[rval] = '\0'; + ptr = strrchr(linkname, '.'); + } else { + ptr = strrchr(filename, '.'); + } + if (ptr != NULL) + sscanf(++ptr, "%u", &fstamp); + else + fstamp = 0; + tai_leap.fstamp = htonl(fstamp); + + /* + * 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; + while (i < MAX_LEAP) { + ptr = fgets(buf, NTP_MAXSTRLEN - 1, str); + if (ptr == NULL) + break; + if (strlen(buf) < 1) + continue; + if (*buf == '#') + continue; + if (sscanf(buf, "%u %u", &leapsec[i], &offset) != 2) + continue; + if (i != (int)(offset - TAI_1972)) { + break; + } + i++; + } + fclose(str); + if (ptr != NULL) { + msyslog(LOG_INFO, + "crypto_tai: 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); + ptr = emalloc(len); + tai_leap.ptr = (unsigned char *) ptr; + for (; i >= 0; i--) { + *ptr++ = (char) htonl(leapsec[i]); + } + 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_INFO, + "crypto_tai: kernel TAI update failed"); +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ + sprintf(statstr, "%s link %d fs %u offset %u", cp, rval, fstamp, + ntohl(tai_leap.vallen) / 4 + TAI_1972 - 1); + record_crypto_stats(NULL, statstr); +#ifdef DEBUG + if (debug) + printf("crypto_tai: %s\n", statstr); +#endif +} + + +/* + * crypto_setup - load keys, certificate and leapseconds table + * + * This routine loads the public/private host key and certificate. If + * available, it loads the public/private sign key, which defaults to + * the host key, and leapseconds table. The host key must be RSA, but + * the sign key can be either RSA or DSA. In either case, the public key + * on the certificate must agree with the sign key. */ void crypto_setup(void) { - FILE *str; - char hostname[MAXFILENAME]; - char filename[MAXFILENAME]; + EVP_PKEY *pkey; /* private/public key pair */ + char filename[MAXFILENAME]; /* file name buffer */ + l_fp seed; /* crypto PRNG seed as NTP timestamp */ + tstamp_t fstamp; /* filestamp */ + tstamp_t sstamp; /* sign filestamp */ + u_int len, bytes; + u_char *ptr; /* - * Load RSA private key from file. + * Initialize structures. */ - if (private_key_file == NULL) - private_key_file = "ntpkey"; - crypto_read(private_key_file, (u_char *)&private_key, - sizeof(R_RSA_PRIVATE_KEY)); - - /* - * Load RSA public key from file, default "ntpkey_host", where - * host is the DNS name of this machine. - */ - if (public_key_file == NULL) { - gethostname(hostname, MAXFILENAME); - snprintf(filename, MAXFILENAME - 1, "ntpkey_%s", - hostname); - public_key_file = emalloc(strlen(filename) + 1); - strcpy(public_key_file, filename); - } - crypto_read(public_key_file, (u_char *)&public_key, - sizeof(R_RSA_PUBLIC_KEY)); - - /* - * Load Diffie-Hellman key agreement parameters from file. - */ - if (dh_params_file == NULL) - dh_params_file = "ntpkey_dh"; - if (*dh_params_file == '/') - strcpy(filename, dh_params_file); - else - snprintf(filename, MAXFILENAME - 1, "%s%s", keysdir, - dh_params_file); - - str = fopen(filename, "r"); - if (str == NULL) { - msyslog(LOG_ERR, "key file %s not found", - filename); + if (!crypto_flags) return; - } + gethostname(filename, MAXFILENAME); + bytes = strlen(filename) + 1; + sys_hostname = emalloc(bytes); + memcpy(sys_hostname, filename, bytes); + if (passwd == NULL) + passwd = sys_hostname; + memset(&hostval, 0, sizeof(hostval)); + memset(&pubkey, 0, sizeof(pubkey)); + memset(&tai_leap, 0, sizeof(tai_leap)); /* - * Read prime and generator. Note that the private value length - * is set arbitrarily at half the prime length. + * Load required random seed file and seed the random number + * generator. Be default, it is found in the user home + * directory. The root home directory may be / or /root, + * depending on the system. Wiggle the contents a bit and write + * it back so the sequence does not repeat when we next restart. */ - crypto_line(str, &dh_params.prime, &dh_params.primeLen); - crypto_line(str, &dh_params.generator, &dh_params.generatorLen); - if (dh_params.primeLen == 0|| dh_params.generatorLen == 0) { + ERR_load_crypto_strings(); + if (rand_file == NULL) { + if ((RAND_file_name(filename, MAXFILENAME)) != NULL) { + rand_file = emalloc(strlen(filename) + 1); + strcpy(rand_file, filename); + } + } else if (*rand_file != '/') { + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, + rand_file); + free(rand_file); + rand_file = emalloc(strlen(filename) + 1); + strcpy(rand_file, filename); + } + if (rand_file == NULL) { msyslog(LOG_ERR, - "invalid Diffie-Hellman file format or value"); - return; + "crypto_setup: random seed file not specified"); + exit (-1); } - dh_keyLen = dh_params.primeLen / 2; + if ((bytes = RAND_load_file(rand_file, -1)) == 0) { + msyslog(LOG_ERR, + "crypto_setup: random seed file %s not found\n", + rand_file); + exit (-1); + } + get_systime(&seed); + RAND_seed(&seed, sizeof(l_fp)); + RAND_write_file(rand_file); + OpenSSL_add_all_algorithms(); +#ifdef DEBUG + if (debug) + printf( + "crypto_setup: OpenSSL version %lx random seed file %s bytes read %d\n", + SSLeay(), rand_file, bytes); +#endif + + /* + * Load required host key from file "ntpkey_host_". It + * also becomes the default sign key. + */ + if (host_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_host_%s", + sys_hostname); + host_file = emalloc(strlen(filename) + 1); + strcpy(host_file, filename); + } + pkey = crypto_key(host_file, &fstamp); + if (pkey == NULL) { + msyslog(LOG_ERR, + "crypto_setup: host key file %s not found or corrupt", + host_file); + exit (-1); + } + host_pkey = pkey; + sign_pkey = pkey; + sstamp = fstamp; + hostval.fstamp = htonl(fstamp); + if (EVP_MD_type(host_pkey) != EVP_PKEY_RSA) { + msyslog(LOG_ERR, + "crypto_setup: host key is not RSA key type"); + exit (-1); + } + hostval.vallen = htonl(strlen(sys_hostname)); + hostval.ptr = (unsigned char *) sys_hostname; + + /* + * Construct public key extension field for agreement scheme. + */ + len = i2d_PublicKey(host_pkey, NULL); + ptr = emalloc(len); + pubkey.ptr = ptr; + i2d_PublicKey(host_pkey, &ptr); + pubkey.vallen = htonl(len); + pubkey.fstamp = hostval.fstamp; + + /* + * Load optional sign key from file "ntpkey_sign_". If + * loaded, it becomes the sign key. + */ + if (sign_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_sign_%s", + sys_hostname); + sign_file = emalloc(strlen(filename) + 1); + strcpy(sign_file, filename); + } + pkey = crypto_key(sign_file, &fstamp); + if (pkey != NULL) { + sign_pkey = pkey; + sstamp = fstamp; + } + sign_siglen = EVP_PKEY_size(sign_pkey); + + /* + * Load optional IFF parameters from file + * "ntpkey_iff_". + */ + if (iffpar_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_iff_%s", + sys_hostname); + iffpar_file = emalloc(strlen(filename) + 1); + strcpy(iffpar_file, filename); + } + iffpar_pkey = crypto_key(iffpar_file, &if_fstamp); + if (iffpar_pkey != NULL) + crypto_flags |= CRYPTO_FLAG_IFF; + + /* + * Load optional GQ parameters from file "ntpkey_gq_". + */ + if (gqpar_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_gq_%s", + sys_hostname); + gqpar_file = emalloc(strlen(filename) + 1); + strcpy(gqpar_file, filename); + } + gqpar_pkey = crypto_key(gqpar_file, &gq_fstamp); + if (gqpar_pkey != NULL) + crypto_flags |= CRYPTO_FLAG_GQ; + + /* + * Load optional MV parameters from file "ntpkey_mv_". + */ + if (mvpar_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_mv_%s", + sys_hostname); + mvpar_file = emalloc(strlen(filename) + 1); + strcpy(mvpar_file, filename); + } + mvpar_pkey = crypto_key(mvpar_file, &mv_fstamp); + if (mvpar_pkey != NULL) + crypto_flags |= CRYPTO_FLAG_MV; + + /* + * Load required certificate from file "ntpkey_cert_". + */ + if (cert_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_cert_%s", + sys_hostname); + cert_file = emalloc(strlen(filename) + 1); + strcpy(cert_file, filename); + } + if ((cinfo = crypto_cert(cert_file)) == NULL) { + msyslog(LOG_ERR, + "certificate file %s not found or corrupt", + cert_file); + exit (-1); + } + + /* + * The subject name must be the same as the host name, unless + * the certificate is private, in which case it may have come + * from another host. + */ + if (!(cinfo->flags & CERT_PRIV) && strcmp(cinfo->subject, + sys_hostname) != 0) { + msyslog(LOG_ERR, + "crypto_setup: certificate %s not for this host", + cert_file); + cert_free(cinfo); + exit (-1); + } + + /* + * It the certificate is trusted, the subject must be the same + * as the issuer, in other words it must be self signed. + */ + if (cinfo->flags & CERT_PRIV && strcmp(cinfo->subject, + cinfo->issuer) != 0) { + if (cert_valid(cinfo, sign_pkey) != XEVNT_OK) { + msyslog(LOG_ERR, + "crypto_setup: certificate %s is trusted, but not self signed.", + cert_file); + cert_free(cinfo); + exit (-1); + } + } + sign_digest = cinfo->digest; + if (cinfo->flags & CERT_PRIV) + crypto_flags |= CRYPTO_FLAG_PRIV; + crypto_flags |= cinfo->nid << 16; + + /* + * Load optional leapseconds table from file "ntpkey_leap". If + * the file is missing or defective, the values can later be + * retrieved from a server. + */ + if (leap_file == NULL) + leap_file = "ntpkey_leap"; + crypto_tai(leap_file); +#ifdef DEBUG + if (debug) + printf( + "crypto_setup: flags 0x%x host %s signature %s\n", + crypto_flags, sys_hostname, OBJ_nid2ln(cinfo->nid)); +#endif } /* - * crypto_config - configure crypto data. + * crypto_config - configure data from crypto configuration command. */ void crypto_config( - int item, /* configuration item */ - char *cp /* file name */ + int item, /* configuration item */ + char *cp /* file name */ ) { switch (item) { /* - * Initialize flags + * Set random seed file name. */ - case CRYPTO_CONF_FLAGS: - crypto_flags = atoi(cp); - break; - /* - * Override the default Diffie-Hellman parameter file name. - */ - case CRYPTO_CONF_DH: - dh_params_file = emalloc(strlen(cp) + 1); - strcpy(dh_params_file, cp); + case CRYPTO_CONF_RAND: + rand_file = emalloc(strlen(cp) + 1); + strcpy(rand_file, cp); break; /* - * Override the default RSA private key file name. + * Set private key password. + */ + case CRYPTO_CONF_PW: + passwd = emalloc(strlen(cp) + 1); + strcpy(passwd, cp); + break; + + /* + * Set host file name. */ case CRYPTO_CONF_PRIV: - private_key_file = emalloc(strlen(cp) + 1); - strcpy(private_key_file, cp); + host_file = emalloc(strlen(cp) + 1); + strcpy(host_file, cp); break; /* - * Override the default RSA public key file name. + * Set sign key file name. */ - case CRYPTO_CONF_PUBL: - public_key_file = emalloc(strlen(cp) + 1); - strcpy(public_key_file, cp); + case CRYPTO_CONF_SIGN: + sign_file = emalloc(strlen(cp) + 1); + strcpy(sign_file, cp); break; /* - * Override the default crypto keys directory. + * Set iff parameters file name. */ - case CRYPTO_CONF_KEYS: - keysdir = emalloc(strlen(cp) + 1); - strcpy(keysdir, cp); + case CRYPTO_CONF_IFFPAR: + iffpar_file = emalloc(strlen(cp) + 1); + strcpy(iffpar_file, cp); + break; + + /* + * Set gq parameters file name. + */ + case CRYPTO_CONF_GQPAR: + gqpar_file = emalloc(strlen(cp) + 1); + strcpy(gqpar_file, cp); + break; + + /* + * Set mv parameters file name. + */ + case CRYPTO_CONF_MVPAR: + mvpar_file = emalloc(strlen(cp) + 1); + strcpy(mvpar_file, cp); + break; + + /* + * Set certificate file name. + */ + case CRYPTO_CONF_CERT: + cert_file = emalloc(strlen(cp) + 1); + strcpy(cert_file, cp); + break; + + /* + * Set leapseconds file name. + */ + case CRYPTO_CONF_LEAP: + leap_file = emalloc(strlen(cp) + 1); + strcpy(leap_file, cp); break; } + crypto_flags |= CRYPTO_FLAG_ENAB; } - - -/* - * crypto_init () - initialize things. - */ -void -crypto_init(void) -{ - /* - * Zeroize sensitive crypto data. - */ - memset((char *)&private_key, 0, sizeof(private_key)); - memset((char *)&public_key, 0, sizeof(public_key)); - memset((char *)&dh_params, 0, sizeof(dh_params)); - memset((char *)&host, 0, sizeof(host)); -} -#endif /* PUBKEY */ -#endif /* AUTOKEY */ +# else +int ntp_crypto_bs_pubkey; +# endif /* OPENSSL */ diff --git a/dist/ntp/ntpd/ntp_filegen.c b/dist/ntp/ntpd/ntp_filegen.c index 8c3948c4ec1f..7596ab6cf9a4 100644 --- a/dist/ntp/ntpd/ntp_filegen.c +++ b/dist/ntp/ntpd/ntp_filegen.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_filegen.c,v 1.1.1.2 2003/12/04 16:05:26 drochner Exp $ */ +/* $NetBSD: ntp_filegen.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_filegen.c,v 3.12 1994/01/25 19:06:11 kardel Exp diff --git a/dist/ntp/ntpd/ntp_intres.c b/dist/ntp/ntpd/ntp_intres.c index d9cfbd2ae17f..bede933dd50b 100644 --- a/dist/ntp/ntpd/ntp_intres.c +++ b/dist/ntp/ntpd/ntp_intres.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_intres.c,v 1.3 2001/01/16 02:50:27 cgd Exp $ */ +/* $NetBSD: ntp_intres.c,v 1.4 2003/12/04 16:23:37 drochner Exp $ */ /* * ripped off from ../ntpres/ntpres.c by Greg Troxel 4/2/92 @@ -22,10 +22,15 @@ # include #endif +#include "ntp_machine.h" +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_request.h" +#include "ntp_stdlib.h" +#include "ntp_syslog.h" + #include #include -#include -#include #include #include @@ -37,12 +42,6 @@ # include /* MAXHOSTNAMELEN (often) */ #endif -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_request.h" -#include "ntp_stdlib.h" -#include "ntp_syslog.h" - #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) /* @@ -53,8 +52,10 @@ struct conf_entry { struct conf_entry *ce_next; char *ce_name; /* name we are trying to resolve */ struct conf_peer ce_config; /* configuration info for peer */ + struct sockaddr_storage peer_store; /* address info for both fams */ }; #define ce_peeraddr ce_config.peeraddr +#define ce_peeraddr6 ce_config.peeraddr6 #define ce_hmode ce_config.hmode #define ce_version ce_config.version #define ce_minpoll ce_config.minpoll @@ -126,8 +127,7 @@ static int resolve_value; /* next value of resolve timer */ /* * File descriptor for ntp request code. */ -static int sockfd = -1; - +static SOCKET sockfd = INVALID_SOCKET; /* NT uses SOCKET */ /* stuff to be filled in by caller */ @@ -140,7 +140,7 @@ 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, +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)); @@ -162,7 +162,7 @@ struct ntp_res_c_pkt { /* Control packet: */ int version; int minpoll; int maxpoll; - int flags; + u_int flags; int ttl; keyid_t keyid; u_char keystr[MAXFILENAME]; @@ -272,7 +272,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); @@ -280,7 +281,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; @@ -387,7 +389,7 @@ addentry( int version, int minpoll, int maxpoll, - int flags, + u_int flags, int ttl, keyid_t keyid, char *keystr @@ -400,9 +402,9 @@ addentry( #ifdef DEBUG if (debug > 1) msyslog(LOG_INFO, - "intres: <%s> %d %d %d %d %d %d %u %s\n", - name, mode, version, - minpoll, maxpoll, flags, ttl, keyid, keystr); + "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); @@ -411,6 +413,8 @@ addentry( ce = (struct conf_entry *)emalloc(sizeof(struct conf_entry)); ce->ce_name = cp; ce->ce_peeraddr = 0; + ce->ce_peeraddr6 = in6addr_any; + ANYSOCK(&ce->peer_store); ce->ce_hmode = (u_char)mode; ce->ce_version = (u_char)version; ce->ce_minpoll = (u_char)minpoll; @@ -418,7 +422,7 @@ addentry( ce->ce_flags = (u_char)flags; ce->ce_ttl = (u_char)ttl; ce->ce_keyid = keyid; - strncpy(ce->ce_keystr, keystr, MAXFILENAME); + strncpy((char *)ce->ce_keystr, keystr, MAXFILENAME); ce->ce_next = NULL; if (confentries == NULL) { @@ -447,18 +451,18 @@ findhostaddr( struct conf_entry *entry ) { - struct hostent *hp; - struct in_addr in; + struct addrinfo *addr; + int error; checkparent(); /* make sure our guy is still running */ - if (entry->ce_name && entry->ce_peeraddr) { + if (entry->ce_name != NULL && SOCKNUL(&entry->peer_store)) { /* HMS: Squawk? */ msyslog(LOG_ERR, "findhostaddr: both ce_name and ce_peeraddr are defined..."); return 1; } - if (!entry->ce_name && !entry->ce_peeraddr) { + if (entry->ce_name == NULL && !SOCKNUL(&entry->peer_store)) { msyslog(LOG_ERR, "findhostaddr: both ce_name and ce_peeraddr are undefined!"); return 0; } @@ -469,20 +473,33 @@ findhostaddr( msyslog(LOG_INFO, "findhostaddr: Resolving <%s>", entry->ce_name); #endif /* DEBUG */ - hp = gethostbyname(entry->ce_name); + error = getaddrinfo(entry->ce_name, NULL, NULL, &addr); + if (error == 0) { + entry->peer_store = *((struct sockaddr_storage*)(addr->ai_addr)); + if (entry->peer_store.ss_family == AF_INET) { + entry->ce_peeraddr = + GET_INADDR(entry->peer_store); + entry->ce_config.v6_flag = 0; + } else { + entry->ce_peeraddr6 = + GET_INADDR6(entry->peer_store); + entry->ce_config.v6_flag = 1; + } + } } else { #ifdef DEBUG if (debug > 2) - msyslog(LOG_INFO, "findhostaddr: Resolving %x>", - entry->ce_peeraddr); + msyslog(LOG_INFO, "findhostaddr: Resolving %s>", + stoa(&entry->peer_store)); #endif - in.s_addr = entry->ce_peeraddr; - hp = gethostbyaddr((const char *)&in, - sizeof entry->ce_peeraddr, - AF_INET); + entry->ce_name = emalloc(MAXHOSTNAMELEN); + error = getnameinfo((const struct sockaddr *)&entry->peer_store, + SOCKLEN(&entry->peer_store), + (char *)&entry->ce_name, MAXHOSTNAMELEN, + NULL, 0, 0); } - if (hp == NULL) { + if (error != 0) { /* * If the resolver is in use, see if the failure is * temporary. If so, return success. @@ -497,29 +514,11 @@ findhostaddr( 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); @@ -532,22 +531,26 @@ findhostaddr( static void openntp(void) { - struct sockaddr_in saddr; + struct addrinfo hints; + struct addrinfo *addrResult; if (sockfd >= 0) return; - - sockfd = socket(AF_INET, SOCK_DGRAM, 0); + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + if (getaddrinfo(NULL, "ntp", &hints, &addrResult)!=0) { + msyslog(LOG_ERR, "getaddrinfo failed: %m"); + exit(1); + } + sockfd = socket(addrResult->ai_family, addrResult->ai_socktype, 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() */ @@ -576,12 +579,11 @@ openntp(void) } } #endif /* SYS_WINNT */ - - - if (connect(sockfd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) { + if (connect(sockfd, addrResult->ai_addr, addrResult->ai_addrlen) == -1) { msyslog(LOG_ERR, "openntp: connect() failed: %m"); exit(1); } + freeaddrinfo(addrResult); } @@ -640,6 +642,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); @@ -707,7 +714,8 @@ request( if (n < 0) { - msyslog(LOG_ERR, "select() fails: %m"); + if (errno != EINTR) + msyslog(LOG_ERR, "select() fails: %m"); return 0; } else if (n == 0) @@ -828,32 +836,32 @@ request( case INFO_ERR_IMPL: msyslog(LOG_ERR, - "server reports implementation mismatch!!"); + "ntpd reports implementation mismatch!"); return 0; case INFO_ERR_REQ: msyslog(LOG_ERR, - "server claims configuration request is unknown"); + "ntpd says configuration request is unknown!"); return 0; case INFO_ERR_FMT: msyslog(LOG_ERR, - "server indicates a format error occurred(!!)"); + "ntpd indicates a format error occurred!"); return 0; case INFO_ERR_NODATA: msyslog(LOG_ERR, - "server indicates no data available (shouldn't happen)"); + "ntpd indicates no data available!"); return 0; case INFO_ERR_AUTH: msyslog(LOG_ERR, - "server returns a permission denied error"); + "ntpd returns a permission denied error!"); return 0; default: msyslog(LOG_ERR, - "server returns unknown error code %d", n); + "ntpd returns unknown error code %d!", n); return 0; } } @@ -923,7 +931,7 @@ readconf( register int i; char *token[NUMTOK]; u_long intval[NUMTOK]; - int flags; + u_int flags; char buf[MAXLINESIZE]; char *bp; @@ -977,7 +985,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); @@ -993,6 +1001,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; @@ -1023,10 +1033,10 @@ doconfigure( #ifdef DEBUG if (debug > 1) msyslog(LOG_INFO, - "doconfigure: <%s> has peeraddr %#x", - ce->ce_name, ce->ce_peeraddr); + "doconfigure: <%s> has peeraddr %s", + ce->ce_name, stoa(&ce->peer_store)); #endif - if (dores && ce->ce_peeraddr == 0) { + if (dores && !SOCKNUL(&(ce->peer_store))) { if (!findhostaddr(ce)) { msyslog(LOG_ERR, "couldn't resolve `%s', giving up on it", @@ -1038,7 +1048,7 @@ doconfigure( } } - if (ce->ce_peeraddr != 0) { + if (!SOCKNUL(&ce->peer_store)) { if (request(&ce->ce_config)) { ceremove = ce; ce = ceremove->ce_next; diff --git a/dist/ntp/ntpd/ntp_io.c b/dist/ntp/ntpd/ntp_io.c index 8baa9dca06bb..d49049bf17a2 100644 --- a/dist/ntp/ntpd/ntp_io.c +++ b/dist/ntp/ntpd/ntp_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.7 2002/04/19 20:45:54 drochner Exp $ */ +/* $NetBSD: ntp_io.c,v 1.8 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -9,24 +9,43 @@ # include #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 "ntp.h" + +/* Don't include ISC's version of IPv6 variables and structures */ +#define ISC_IPV6_H 1 +#include +#include +#include + +#ifdef SIM +#include "ntpsim.h" +#endif + #include #include -#include #ifdef HAVE_SYS_PARAM_H # include #endif /* HAVE_SYS_PARAM_H */ -#ifdef HAVE_SYS_TIME_H -# include -#endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_NETINET_IN_SYSTM_H # include #else /* Some old linux systems at least have in_system.h instead. */ -# include +# ifdef HAVE_NETINET_IN_SYSTEM_H +# include +# endif #endif /* HAVE_NETINET_IN_SYSTM_H */ -#include +#ifdef HAVE_NETINET_IP_H +# include +#endif #ifdef HAVE_SYS_IOCTL_H # include #endif @@ -35,54 +54,22 @@ #endif #include -#if _BSDI_VERSION >= 199510 || (defined(__NetBSD__) && __NetBSD_Version__ >= 105000000) -# include +extern int listen_to_virtual_ips; + +#if defined(SYS_WINNT) +#include +#include +/* + * Define this macro to control the behavior of connection + * resets on UDP sockets. See Microsoft KnowledgeBase Article Q263823 + * for details. + * NOTE: This requires that Windows 2000 systems install Service Pack 2 + * or later. + */ +#ifndef SIO_UDP_CONNRESET +#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) #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 - -/* "un*x"-compatible names for some items in UCX$INETDEF.H */ -#define ifreq IFREQDEF -#define ifr_name IFR$T_NAME -#define ifr_addr IFR$R_DUMMY.IFR$T_ADDR -#define ifr_broadaddr IFR$R_DUMMY.IFR$T_BROADADDR -#define ifr_flags IFR$R_DUMMY.IFR$R_DUMMY_1_OVRL.IFR$W_FLAGS -#define IFF_UP IFR$M_IFF_UP -#define IFF_BROADCAST IFR$M_IFF_BROADCAST -#define IFF_LOOPBACK IFR$M_IFF_LOOPBACK - -#endif /* VMS */ - - -#if defined(VMS) || defined(SYS_WINNT) -/* structure used in SIOCGIFCONF request (after [KSR] OSF/1) */ -struct ifconf { - int ifc_len; /* size of buffer */ - union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -}; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ - -#endif /* VMS */ - -#if defined(USE_TTY_SIGPOLL) || defined(USE_UDP_SIGPOLL) -# if defined(SYS_AIX) && defined(_IO) /* XXX Identify AIX some other way */ -# undef _IO -# endif -# include #endif /* @@ -118,10 +105,15 @@ 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 ipv4 interface */ +struct interface *any6_interface; /* default ipv6 interface */ +struct interface *loopback_interface; /* loopback ipv4 interface */ +struct interface *loopback6_interface; /* loopback ipv6 interface */ +struct interface inter_list[MAXINTERFACES]; /* Interface list */ +int ninterfaces; /* Total number of interfaces */ +int nwilds; /* Total number of wildcard intefaces */ +int wildipv4 = -1; /* Index into inter_list for IPv4 wildcard */ +int wildipv6 = -1; /* Index into inter_list for IPv6 wildcard */ #ifdef REFCLOCK /* @@ -131,20 +123,94 @@ static int ninterfaces; static struct refclockio *refio; #endif /* REFCLOCK */ + +/* + * Define what the possible "soft" errors can be. These are non-fatal returns + * of various network related functions, like recv() and so on. + * + * For some reason, BSDI (and perhaps others) will sometimes return <0 + * from recv() but will have errno==0. This is broken, but we have to + * work around it here. + */ +#define SOFT_ERROR(e) ((e) == EAGAIN || \ + (e) == EWOULDBLOCK || \ + (e) == EINTR || \ + (e) == 0) + /* * File descriptor masks etc. for call to select + * Not needed for I/O Completion Ports */ fd_set activefds; int maxactivefd; -static int create_sockets P((u_int)); -static int open_socket P((struct sockaddr_in *, int, int)); -static void close_socket P((int)); +static int create_sockets P((u_short)); +static SOCKET open_socket P((struct sockaddr_storage *, int, int)); +static void close_socket P((SOCKET)); #ifdef REFCLOCK -static void close_file P((int)); +static void close_file P((SOCKET)); #endif static char * fdbits P((int, fd_set *)); +static void set_reuseaddr P((int)); +typedef struct vsock vsock_t; + +struct vsock { + SOCKET fd; + ISC_LINK(vsock_t) link; +}; + +ISC_LIST(vsock_t) sockets_list; + +typedef struct remaddr remaddr_t; + +struct remaddr { + struct sockaddr_storage addr; + int if_index; + ISC_LINK(remaddr_t) link; +}; + +ISC_LIST(remaddr_t) remoteaddr_list; + +void add_socket_to_list P((SOCKET)); +void delete_socket_from_list P((SOCKET)); +void add_addr_to_list P((struct sockaddr_storage *, int)); +void delete_addr_from_list P((struct sockaddr_storage *)); +int find_addr_in_list P((struct sockaddr_storage *)); +int create_wildcards P((u_short)); +isc_boolean_t address_okay P((isc_interface_t *)); +void convert_isc_if P((isc_interface_t *, struct interface *, u_short)); + +#ifdef SYS_WINNT +/* + * Windows 2000 systems incorrectly cause UDP sockets using WASRecvFrom + * to not work correctly, returning a WSACONNRESET error when a WSASendTo + * fails with an "ICMP port unreachable" response and preventing the + * socket from using the WSARecvFrom in subsequent operations. + * The function below fixes this, but requires that Windows 2000 + * Service Pack 2 or later be installed on the system. NT 4.0 + * systems are not affected by this and work correctly. + * See Microsoft Knowledge Base Article Q263823 for details of this. + */ +isc_result_t +connection_reset_fix(SOCKET fd) { + DWORD dwBytesReturned = 0; + BOOL bNewBehavior = FALSE; + DWORD status; + + if(isc_win32os_majorversion() < 5) + return (ISC_R_SUCCESS); /* NT 4.0 has no problem */ + + /* disable bad behavior using IOCTL: SIO_UDP_CONNRESET */ + status = WSAIoctl(fd, SIO_UDP_CONNRESET, &bNewBehavior, + sizeof(bNewBehavior), NULL, 0, + &dwBytesReturned, NULL, NULL); + if (status != SOCKET_ERROR) + return (ISC_R_SUCCESS); + else + return (ISC_R_UNEXPECTED); +} +#endif /* * init_io - initialize I/O data structures and call socket creation routine */ @@ -152,8 +218,6 @@ void init_io(void) { #ifdef SYS_WINNT - WORD wVersionRequested; - WSADATA wsaData; init_transmitbuff(); #endif /* SYS_WINNT */ @@ -167,7 +231,8 @@ init_io(void) packets_sent = packets_notsent = 0; handler_calls = handler_pkts = 0; io_timereset = 0; - loopback_interface = 0; + loopback_interface = NULL; + loopback6_interface = NULL; #ifdef REFCLOCK refio = 0; @@ -178,14 +243,17 @@ init_io(void) #endif #ifdef SYS_WINNT - wVersionRequested = MAKEWORD(1,1); - if (WSAStartup(wVersionRequested, &wsaData)) + if (!Win32InitSockets()) { - msyslog(LOG_ERR, "No useable winsock.dll: %m"); + netsyslog(LOG_ERR, "No useable winsock.dll: %m"); exit(1); } #endif /* SYS_WINNT */ + ISC_LIST_INIT(sockets_list); + + ISC_LIST_INIT(remoteaddr_list); + /* * Create the sockets */ @@ -199,474 +267,276 @@ init_io(void) #endif } +int +create_wildcards(u_short port) { + + int idx = 0; + /* + * create pseudo-interface with wildcard IPv4 address + */ + inter_list[idx].sin.ss_family = AF_INET; + ((struct sockaddr_in*)&inter_list[idx].sin)->sin_addr.s_addr = htonl(INADDR_ANY); + ((struct sockaddr_in*)&inter_list[idx].sin)->sin_port = port; + (void) strncpy(inter_list[idx].name, "wildcard", sizeof(inter_list[idx].name)); + inter_list[idx].mask.ss_family = AF_INET; + ((struct sockaddr_in*)&inter_list[idx].mask)->sin_addr.s_addr = htonl(~(u_int32)0); + inter_list[idx].bfd = INVALID_SOCKET; + inter_list[idx].num_mcast = 0; + inter_list[idx].received = 0; + inter_list[idx].sent = 0; + inter_list[idx].notsent = 0; + inter_list[idx].flags = INT_BROADCAST; + any_interface = &inter_list[idx]; +#if defined(MCAST) + /* + * enable possible multicast reception on the broadcast socket + */ + inter_list[idx].bcast.ss_family = AF_INET; + ((struct sockaddr_in*)&inter_list[idx].bcast)->sin_port = port; + ((struct sockaddr_in*)&inter_list[idx].bcast)->sin_addr.s_addr = htonl(INADDR_ANY); +#endif /* MCAST */ + wildipv4 = idx; + idx++; + +#ifdef HAVE_IPV6 + /* + * create pseudo-interface with wildcard IPv6 address + */ + if (isc_net_probeipv6() == ISC_R_SUCCESS) { + inter_list[idx].sin.ss_family = AF_INET6; + ((struct sockaddr_in6*)&inter_list[idx].sin)->sin6_addr = in6addr_any; + ((struct sockaddr_in6*)&inter_list[idx].sin)->sin6_port = port; + (void) strncpy(inter_list[idx].name, "wildcard", sizeof(inter_list[idx].name)); + inter_list[idx].mask.ss_family = AF_INET6; + memset(&((struct sockaddr_in6*)&inter_list[idx].mask)->sin6_addr.s6_addr, 0xff, sizeof(struct in6_addr)); + inter_list[idx].bfd = INVALID_SOCKET; + inter_list[idx].num_mcast = 0; + inter_list[idx].received = 0; + inter_list[idx].sent = 0; + inter_list[idx].notsent = 0; + inter_list[idx].flags = 0; + any6_interface = &inter_list[idx]; + wildipv6 = idx; + idx++; + } +#endif + return (idx); +} + +isc_boolean_t +address_okay(isc_interface_t *isc_if) { + +#ifdef DEBUG + if (debug > 2) + printf("address_okay: listen Virtual: %d, IF name: %s, Up Flag: %d\n", + listen_to_virtual_ips, isc_if->name, (isc_if->flags & INTERFACE_F_UP)); +#endif + + if (listen_to_virtual_ips == 0 && (strchr(isc_if->name, (int)':') != NULL)) + return (ISC_FALSE); + + /* XXXPDM This should be fixed later, but since we may not have set + * the UP flag, we at least get to use the interface. + * The UP flag is not always set so we don't do this right now. + */ +/* if ((isc_if->flags & INTERFACE_F_UP) == 0) + return (ISC_FALSE); +*/ + return (ISC_TRUE); +} +void +convert_isc_if(isc_interface_t *isc_if, struct interface *itf, u_short port) { + + if(isc_if->af == AF_INET) { + itf->sin.ss_family = (u_short) isc_if->af; + strcpy(itf->name, isc_if->name); + memcpy(&(((struct sockaddr_in*)&itf->sin)->sin_addr), + &(isc_if->address.type.in), + sizeof(struct in_addr)); + ((struct sockaddr_in*)&itf->sin)->sin_port = port; + + if((isc_if->flags & INTERFACE_F_BROADCAST) != 0) { + itf->flags |= INT_BROADCAST; + itf->bcast.ss_family = itf->sin.ss_family; + memcpy(&(((struct sockaddr_in*)&itf->bcast)->sin_addr), + &(isc_if->broadcast.type.in), + sizeof(struct in_addr)); + ((struct sockaddr_in*)&itf->bcast)->sin_port = port; + } + + itf->mask.ss_family = itf->sin.ss_family; + memcpy(&(((struct sockaddr_in*)&itf->mask)->sin_addr), + &(isc_if->netmask.type.in), + sizeof(struct in_addr)); + ((struct sockaddr_in*)&itf->mask)->sin_port = port; + + if (((isc_if->flags & INTERFACE_F_LOOPBACK) != 0) && (loopback_interface == NULL)) + { + loopback_interface = itf; + } + } +#ifdef HAVE_IPV6 + else if (isc_if->af == AF_INET6) { + itf->sin.ss_family = (u_short) isc_if->af; + strcpy(itf->name, isc_if->name); + memcpy(&(((struct sockaddr_in6 *)&itf->sin)->sin6_addr), + &(isc_if->address.type.in6), + sizeof(struct in6_addr)); + ((struct sockaddr_in6 *)&itf->sin)->sin6_port = port; + + itf->mask.ss_family = itf->sin.ss_family; + memcpy(&(((struct sockaddr_in6 *)&itf->mask)->sin6_addr), + &(isc_if->netmask.type.in6), + sizeof(struct in6_addr)); + ((struct sockaddr_in6 *)&itf->mask)->sin6_port = port; + + if (((isc_if->flags & INTERFACE_F_LOOPBACK) != 0) && (loopback6_interface == NULL)) + { + loopback6_interface = itf; + } + } +#endif /* HAVE_IPV6 */ + + /* Process the rest of the flags */ + + if((isc_if->flags & INTERFACE_F_UP) != 0) + itf->flags |= INT_UP; + if((isc_if->flags & INTERFACE_F_LOOPBACK) != 0) + itf->flags |= INT_LOOPBACK; + if((isc_if->flags & INTERFACE_F_POINTTOPOINT) != 0) + itf->flags |= INT_PPP; +} /* * create_sockets - create a socket for each interface plus a default * socket for when we don't know where to send */ static int create_sockets( - u_int port + u_short port ) { -#if _BSDI_VERSION >= 199510 || (defined(__NetBSD__) && __NetBSD_Version__ >= 105000000) - int i, j; - struct ifaddrs *ifaddrs, *ifap; - struct sockaddr_in resmask; -#if _BSDI_VERSION < 199701 && !defined(__NetBSD__) - struct ifaddrs *lp; - int num_if; -#endif -#else /* _BSDI_VERSION >= 199510 */ -# ifdef STREAMS_TLI - struct strioctl ioc; -# endif /* STREAMS_TLI */ - char buf[MAXINTERFACES*sizeof(struct ifreq)]; - struct ifconf ifc; - struct ifreq ifreq, *ifr; - int n, i, j, vs, size = 0; - struct sockaddr_in resmask; -#endif /* _BSDI_VERSION >= 199510 */ + struct sockaddr_storage resmask; + int i; + isc_mem_t *mctx = NULL; + isc_interfaceiter_t *iter = NULL; + isc_boolean_t scan_ipv4 = ISC_FALSE; + isc_boolean_t scan_ipv6 = ISC_FALSE; + isc_result_t result; + int idx = 0; #ifdef DEBUG if (debug) printf("create_sockets(%d)\n", ntohs( (u_short) port)); #endif + if (isc_net_probeipv6() == ISC_R_SUCCESS) + scan_ipv6 = ISC_TRUE; +#ifdef HAVE_IPV6 + else + netsyslog(LOG_ERR, "no IPv6 interfaces found"); +#endif + + if (isc_net_probeipv4() == ISC_R_SUCCESS) + scan_ipv4 = ISC_TRUE; + else + netsyslog(LOG_ERR, "no IPv4 interfaces found"); + + nwilds = create_wildcards(port); + idx = nwilds; + + result = isc_interfaceiter_create(mctx, &iter); + if (result != ISC_R_SUCCESS) + return (result); + + for (result = isc_interfaceiter_first(iter); + result == ISC_R_SUCCESS; + result = isc_interfaceiter_next(iter)) + { + isc_interface_t isc_if; + unsigned int family; + + result = isc_interfaceiter_current(iter, &isc_if); + if (result != ISC_R_SUCCESS) + break; + + /* See if we have a valid family to use */ + family = isc_if.address.family; + if (family != AF_INET && family != AF_INET6) + continue; + if (scan_ipv4 == ISC_FALSE && family == AF_INET) + continue; + if (scan_ipv6 == ISC_FALSE && family == AF_INET6) + continue; + + /* Check to see if we are going to use the interface */ + if (address_okay(&isc_if) == ISC_TRUE) { + convert_isc_if(&isc_if, &inter_list[idx], port); + inter_list[idx].fd = INVALID_SOCKET; + inter_list[idx].bfd = INVALID_SOCKET; + inter_list[idx].num_mcast = 0; + inter_list[idx].received = 0; + inter_list[idx].sent = 0; + inter_list[idx].notsent = 0; + idx++; + } + } + isc_interfaceiter_destroy(&iter); + + ninterfaces = idx; /* - * create pseudo-interface with wildcard address + * I/O Completion Ports don't care about the select and FD_SET */ - inter_list[0].sin.sin_family = AF_INET; - inter_list[0].sin.sin_port = port; - inter_list[0].sin.sin_addr.s_addr = htonl(INADDR_ANY); - (void) strncpy(inter_list[0].name, "wildcard", - sizeof(inter_list[0].name)); - inter_list[0].mask.sin_addr.s_addr = htonl(~ (u_int32)0); - inter_list[0].received = 0; - inter_list[0].sent = 0; - inter_list[0].notsent = 0; - inter_list[0].flags = INT_BROADCAST; - -#if _BSDI_VERSION >= 199510 || (defined(__NetBSD__) && __NetBSD_Version__ >= 105000000) -#if _BSDI_VERSION >= 199701 || (defined(__NetBSD__) && __NetBSD_Version__ >= 105000000) - if (getifaddrs(&ifaddrs) < 0) - { - msyslog(LOG_ERR, "getifaddrs: %m"); - exit(1); - } - i = 1; - for (ifap = ifaddrs; ifap != NULL; ifap = ifap->ifa_next) -#else - if (getifaddrs(&ifaddrs, &num_if) < 0) - { - msyslog(LOG_ERR, "create_sockets: getifaddrs() failed: %m"); - exit(1); - } - - i = 1; - - for (ifap = ifaddrs, lp = ifap + num_if; ifap < lp; ifap++) -#endif - { - struct sockaddr_in *sin; - - if (!ifap->ifa_addr) - continue; - - if (ifap->ifa_addr->sa_family != AF_INET) - continue; - - if ((ifap->ifa_flags & IFF_UP) == 0) - continue; - - 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); - - 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) - { - 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) - { - 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)) - { - inter_list[i].mask.sin_addr.s_addr = 0xffffffff; - } - else - { - sin = (struct sockaddr_in *)ifap->ifa_netmask; - inter_list[i].mask = *sin; - } - inter_list[i].mask.sin_family = AF_INET; - inter_list[i].mask.sin_len = sizeof *sin; - - /* - * look for an already existing source interface address. If - * the machine has multiple point to point interfaces, then - * the local address may appear more than once. - * - * A second problem exists if we have two addresses on - * the same network (via "ifconfig alias ..."). Don't - * make two xntp interfaces for the two aliases on the - * one physical interface. -wsr - */ - for (j=0; j < i; j++) - if ((inter_list[j].sin.sin_addr.s_addr & - inter_list[j].mask.sin_addr.s_addr) == - (inter_list[i].sin.sin_addr.s_addr & - inter_list[i].mask.sin_addr.s_addr)) - { - if (inter_list[j].flags & INT_LOOPBACK) - inter_list[j] = inter_list[i]; - break; - } - if (j == i) - i++; - if (i > MAXINTERFACES) - break; - } -#ifdef __NetBSD__ - freeifaddrs(ifaddrs); -#else - free(ifaddrs); -#endif -#else /* _BSDI_VERSION >= 199510 */ -# ifdef USE_STREAMS_DEVICE_FOR_IF_CONFIG - if ((vs = open("/dev/ip", O_RDONLY)) < 0) - { - msyslog(LOG_ERR, "create_sockets: open(/dev/ip) failed: %m"); - exit(1); - } -# else /* not USE_STREAMS_DEVICE_FOR_IF_CONFIG */ - if ( - (vs = socket(AF_INET, SOCK_DGRAM, 0)) -# ifndef SYS_WINNT - < 0 -# else /* SYS_WINNT */ - == INVALID_SOCKET -# endif /* SYS_WINNT */ - ) { - msyslog(LOG_ERR, "create_sockets: socket(AF_INET, SOCK_DGRAM) failed: %m"); - exit(1); - } -# endif /* not USE_STREAMS_DEVICE_FOR_IF_CONFIG */ - - i = 1; -# if !defined(SYS_WINNT) - ifc.ifc_len = sizeof(buf); -# endif -# ifdef STREAMS_TLI - ioc.ic_cmd = SIOCGIFCONF; - ioc.ic_timout = 0; - ioc.ic_dp = (caddr_t)buf; - ioc.ic_len = sizeof(buf); - if(ioctl(vs, I_STR, &ioc) < 0 || - ioc.ic_len < sizeof(struct ifreq)) - { - msyslog(LOG_ERR, "create_sockets: ioctl(I_STR:SIOCGIFCONF) failed: %m - exiting"); - exit(1); - } -# ifdef SIZE_RETURNED_IN_BUFFER - ifc.ifc_len = ioc.ic_len - sizeof(int); - ifc.ifc_buf = buf + sizeof(int); -# else /* not SIZE_RETURNED_IN_BUFFER */ - ifc.ifc_len = ioc.ic_len; - ifc.ifc_buf = buf; -# endif /* not SIZE_RETURNED_IN_BUFFER */ - -# else /* not STREAMS_TLI */ - ifc.ifc_len = sizeof(buf); - ifc.ifc_buf = buf; -# ifndef SYS_WINNT - if (ioctl(vs, SIOCGIFCONF, (char *)&ifc) < 0) -# else - if (WSAIoctl(vs, SIO_GET_INTERFACE_LIST, 0, 0, ifc.ifc_buf, ifc.ifc_len, &ifc.ifc_len, 0, 0) == SOCKET_ERROR) -# endif /* SYS_WINNT */ -{ - msyslog(LOG_ERR, "create_sockets: ioctl(SIOCGIFCONF) failed: %m - exiting"); - exit(1); -} - -# endif /* not STREAMS_TLI */ - - for(n = ifc.ifc_len, ifr = ifc.ifc_req; n > 0; - ifr = (struct ifreq *)((char *)ifr + size)) - { - extern int listen_to_virtual_ips; - - size = sizeof(*ifr); - -# ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR - if (ifr->ifr_addr.sa_len > sizeof(ifr->ifr_addr)) - size += ifr->ifr_addr.sa_len - sizeof(struct sockaddr); -# endif - n -= size; - -# if !defined(SYS_WINNT) - /* Exclude logical interfaces (indicated by ':' in the interface name) */ - if (debug) - printf("interface <%s> ", ifr->ifr_name); - if ((listen_to_virtual_ips == 0) - && (strchr(ifr->ifr_name, (int)':') != NULL)) { - if (debug) - printf("ignored\n"); - continue; - } - if (debug) - printf("OK\n"); - - if ( -# ifdef VMS /* VMS+UCX */ - (((struct sockaddr *)&(ifr->ifr_addr))->sa_family != AF_INET) -# else - (ifr->ifr_addr.sa_family != AF_INET) -# endif /* VMS+UCX */ - ) { - if (debug) - printf("ignoring %s - not AF_INET\n", - ifr->ifr_name); - continue; - } -# endif /* SYS_WINNT */ - ifreq = *ifr; - inter_list[i].flags = 0; - /* is it broadcast capable? */ -# ifndef SYS_WINNT -# ifdef STREAMS_TLI - ioc.ic_cmd = SIOCGIFFLAGS; - ioc.ic_timout = 0; - ioc.ic_dp = (caddr_t)&ifreq; - ioc.ic_len = sizeof(struct ifreq); - if(ioctl(vs, I_STR, &ioc)) { - msyslog(LOG_ERR, "create_sockets: ioctl(I_STR:SIOCGIFFLAGS) failed: %m"); - continue; - } -# else /* not STREAMS_TLI */ - if (ioctl(vs, SIOCGIFFLAGS, (char *)&ifreq) < 0) { - if (errno != ENXIO) - msyslog(LOG_ERR, "create_sockets: ioctl(SIOCGIFFLAGS) failed: %m"); - continue; - } -# endif /* not STREAMS_TLI */ - if ((ifreq.ifr_flags & IFF_UP) == 0) { - if (debug) - printf("ignoring %s - interface not UP\n", - ifr->ifr_name); - continue; - } - inter_list[i].flags = 0; - if (ifreq.ifr_flags & IFF_BROADCAST) - inter_list[i].flags |= INT_BROADCAST; -# endif /* not SYS_WINNT */ -# if !defined(SUN_3_3_STINKS) - if ( -# if defined(IFF_LOCAL_LOOPBACK) /* defined(SYS_HPUX) && (SYS_HPUX < 8) */ - (ifreq.ifr_flags & IFF_LOCAL_LOOPBACK) -# elif defined(IFF_LOOPBACK) - (ifreq.ifr_flags & IFF_LOOPBACK) -# else /* not IFF_LOCAL_LOOPBACK and not IFF_LOOPBACK */ - /* test against 127.0.0.1 (yuck!!) */ - (inter_list[i].sin.sin_addr.s_addr == inet_addr("127.0.0.1")) -# endif /* not IFF_LOCAL_LOOPBACK and not IFF_LOOPBACK */ - ) - { -# ifndef SYS_WINNT - inter_list[i].flags |= INT_LOOPBACK; -# endif /* not SYS_WINNT */ - if (loopback_interface == 0) - { - loopback_interface = &inter_list[i]; - } - } -# endif /* not SUN_3_3_STINKS */ - -#if 0 -# ifndef SYS_WINNT -# ifdef STREAMS_TLI - ioc.ic_cmd = SIOCGIFADDR; - ioc.ic_timout = 0; - ioc.ic_dp = (caddr_t)&ifreq; - ioc.ic_len = sizeof(struct ifreq); - if (ioctl(vs, I_STR, &ioc)) - { - msyslog(LOG_ERR, "create_sockets: ioctl(I_STR:SIOCGIFADDR) failed: %m"); - continue; - } -# else /* not STREAMS_TLI */ - if (ioctl(vs, SIOCGIFADDR, (char *)&ifreq) < 0) - { - if (errno != ENXIO) - msyslog(LOG_ERR, "create_sockets: ioctl(SIOCGIFADDR) failed: %m"); - continue; - } -# endif /* not STREAMS_TLI */ -# endif /* not SYS_WINNT */ -#endif /* 0 */ -# if defined(SYS_WINNT) - {int TODO_FillInTheNameWithSomeThingReasonble;} -# else - (void)strncpy(inter_list[i].name, ifreq.ifr_name, - sizeof(inter_list[i].name)); -# endif - inter_list[i].sin = *(struct sockaddr_in *)&ifr->ifr_addr; - inter_list[i].sin.sin_family = AF_INET; - inter_list[i].sin.sin_port = port; - -# if defined(SUN_3_3_STINKS) - /* - * Oh, barf! I'm too disgusted to even explain this - */ - if (SRCADR(&inter_list[i].sin) == 0x7f000001) - { - inter_list[i].flags |= INT_LOOPBACK; - if (loopback_interface == 0) - loopback_interface = &inter_list[i]; - } -# endif /* SUN_3_3_STINKS */ -# if !defined SYS_WINNT && !defined SYS_CYGWIN32 /* no interface flags on NT */ - if (inter_list[i].flags & INT_BROADCAST) { -# ifdef STREAMS_TLI - ioc.ic_cmd = SIOCGIFBRDADDR; - ioc.ic_timout = 0; - ioc.ic_dp = (caddr_t)&ifreq; - ioc.ic_len = sizeof(struct ifreq); - if(ioctl(vs, I_STR, &ioc)) { - msyslog(LOG_ERR, "create_sockets: ioctl(I_STR:SIOCGIFBRDADDR) failed: %m"); - exit(1); - } -# else /* not STREAMS_TLI */ - if (ioctl(vs, SIOCGIFBRDADDR, (char *)&ifreq) < 0) { - msyslog(LOG_ERR, "create_sockets: ioctl(SIOCGIFBRDADDR) failed: %m"); - exit(1); - } -# endif /* not STREAMS_TLI */ - -# ifndef ifr_broadaddr - inter_list[i].bcast = - *(struct sockaddr_in *)&ifreq.ifr_addr; -# else - inter_list[i].bcast = - *(struct sockaddr_in *)&ifreq.ifr_broadaddr; -# endif /* ifr_broadaddr */ - inter_list[i].bcast.sin_family = AF_INET; - inter_list[i].bcast.sin_port = port; - } - -# ifdef STREAMS_TLI - ioc.ic_cmd = SIOCGIFNETMASK; - ioc.ic_timout = 0; - ioc.ic_dp = (caddr_t)&ifreq; - ioc.ic_len = sizeof(struct ifreq); - if(ioctl(vs, I_STR, &ioc)) { - msyslog(LOG_ERR, "create_sockets: ioctl(I_STR:SIOCGIFNETMASK) failed: %m"); - exit(1); - } -# else /* not STREAMS_TLI */ - if (ioctl(vs, SIOCGIFNETMASK, (char *)&ifreq) < 0) { - msyslog(LOG_ERR, "create_sockets: ioctl(SIOCGIFNETMASK) failed: %m"); - exit(1); - } -# endif /* not STREAMS_TLI */ - inter_list[i].mask = *(struct sockaddr_in *)&ifreq.ifr_addr; -# else - /* winnt here */ - inter_list[i].bcast = ifreq.ifr_broadaddr; - inter_list[i].bcast.sin_family = AF_INET; - inter_list[i].bcast.sin_port = port; - inter_list[i].mask = ifreq.ifr_mask; -# endif /* not SYS_WINNT */ - - /* - * look for an already existing source interface address. If - * the machine has multiple point to point interfaces, then - * the local address may appear more than once. - */ - for (j=0; j < i; j++) - if (inter_list[j].sin.sin_addr.s_addr == - inter_list[i].sin.sin_addr.s_addr) { - break; - } - if (j == i) - i++; - if (i > MAXINTERFACES) - break; - } - closesocket(vs); -#endif /* _BSDI_VERSION >= 199510 */ - - ninterfaces = i; +#ifndef HAVE_IO_COMPLETION_PORT maxactivefd = 0; FD_ZERO(&activefds); +#endif for (i = 0; i < ninterfaces; i++) { - inter_list[i].fd = - open_socket(&inter_list[i].sin, - inter_list[i].flags & INT_BROADCAST, 0); - } - - /* - * Now that we have opened all the sockets, turn off the reuse flag for - * security. - */ - for (i = 0; i < ninterfaces; i++) { - int off = 0; - - /* - * if inter_list[ n ].fd is -1, we might have a adapter - * configured but not present - */ - if ( inter_list[ i ].fd != -1 ) { - if (setsockopt(inter_list[i].fd, SOL_SOCKET, - SO_REUSEADDR, (char *)&off, - sizeof(off))) { - msyslog(LOG_ERR, "create_sockets: setsockopt(SO_REUSEADDR,off) failed: %m"); - } + inter_list[i].fd = open_socket(&inter_list[i].sin, + inter_list[i].flags & INT_BROADCAST, 0); + if (inter_list[i].bfd != INVALID_SOCKET) + msyslog(LOG_INFO, "Listening on interface %s, %s#%d", + inter_list[i].name, + stoa((&inter_list[i].sin)), + NTP_PORT); + if ((inter_list[i].flags & INT_BROADCAST) && + inter_list[i].bfd != INVALID_SOCKET) + msyslog(LOG_INFO, "Listening on broadcast address %s#%d", + stoa((&inter_list[i].bcast)), + NTP_PORT); +#if defined (HAVE_IO_COMPLETION_PORT) + if (inter_list[i].fd != INVALID_SOCKET) { + io_completion_port_add_socket(inter_list[i].fd, &inter_list[i]); } +#endif } -#if defined(MCAST) /* - * enable possible multicast reception on the broadcast socket + * Now that we have opened all the sockets, turn off the reuse + * flag for security. */ - inter_list[0].bcast.sin_addr.s_addr = htonl(INADDR_ANY); - inter_list[0].bcast.sin_family = AF_INET; - inter_list[0].bcast.sin_port = port; -#endif /* MCAST */ + set_reuseaddr(0); /* * Blacklist all bound interface addresses + * Wildcard interfaces are ignored. */ - 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]; + for (i = nwilds; i < ninterfaces; i++) { + SET_HOSTMASK(&resmask, inter_list[i].sin.ss_family); + hack_restrict(RESTRICT_FLAGS, &inter_list[i].sin, &resmask, + RESM_NTPONLY|RESM_INTERFACE, RES_IGNORE); + } + + /* + * Calculate the address hash for each interface address. + */ + for (i = 0; i < ninterfaces; i++) { + inter_list[i].addr_refid = addr2refid(&inter_list[i].sin); + } + + #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", @@ -677,19 +547,14 @@ create_sockets( inter_list[i].flags); /* Leave these as three printf calls. */ printf(" sin=%s", - inet_ntoa((inter_list[i].sin.sin_addr))); + stoa((&inter_list[i].sin))); if (inter_list[i].flags & INT_BROADCAST) printf(" bcast=%s,", - inet_ntoa((inter_list[i].bcast.sin_addr))); + stoa((&inter_list[i].bcast))); printf(" mask=%s\n", - inet_ntoa((inter_list[i].mask.sin_addr))); + stoa((&inter_list[i].mask))); } } -#endif -#if defined (HAVE_IO_COMPLETION_PORT) - for (i = 0; i < ninterfaces; i++) { - io_completion_port_add_socket(&inter_list[i]); - } #endif return ninterfaces; } @@ -702,19 +567,76 @@ io_setbclient(void) { int i; - for (i = 1; i < ninterfaces; i++) - { +#ifdef OPEN_BCAST_SOCKET + set_reuseaddr(1); +#endif + for (i = nwilds; i < ninterfaces; i++) { + /* Only IPv4 addresses are valid for broadcast */ + if (inter_list[i].bcast.ss_family != AF_INET) + continue; + + /* Is this a broadcast address? */ if (!(inter_list[i].flags & INT_BROADCAST)) - continue; + continue; + + /* Do we already have the broadcast address open? */ 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].flags |= INT_BCASTOPEN; + inter_list[i].bfd = open_socket(&inter_list[i].bcast, + INT_BROADCAST, 1); + if (inter_list[i].bfd != INVALID_SOCKET) { + inter_list[i].flags |= INT_BCASTOPEN; +#if defined (HAVE_IO_COMPLETION_PORT) + io_completion_port_add_socket(inter_list[i].bfd, &inter_list[i]); #endif + } +#ifdef DEBUG + if (debug) { + if (inter_list[i].bfd != INVALID_SOCKET) + printf("io_setbclient: Opened broadcast client on interface %d, socket: %d\n", + i, inter_list[i].bfd); + else + printf("io_setbclient: Unable to Open broadcast client on interface %d\n", + i); + } +#endif +#endif + } +#ifdef OPEN_BCAST_SOCKET + set_reuseaddr(0); +#endif +#ifdef DEBUG + if (debug) + printf("io_setbclient: Opened broadcast clients\n"); +#endif +} + +/* + * set_reuseaddr() - set/clear REUSEADDR on all sockets + * NB possible hole - should we be doing this on broadcast + * fd's also? + */ +static void +set_reuseaddr(int flag) { + int i; + + for (i=0; i < ninterfaces; i++) { + /* + * if inter_list[ n ].fd is -1, we might have a adapter + * configured but not present + */ + if (inter_list[i].fd != INVALID_SOCKET) { + if (setsockopt(inter_list[i].fd, SOL_SOCKET, + SO_REUSEADDR, (char *)&flag, + sizeof(flag))) { + netsyslog(LOG_ERR, "set_reuseaddr: setsockopt(SO_REUSEADDR, %s) failed: %m", flag ? "on" : "off"); + } + } } } @@ -724,84 +646,196 @@ io_setbclient(void) */ void io_multicast_add( - u_int32 addr + struct sockaddr_storage addr ) { #ifdef MCAST struct ip_mreq mreq; int i = ninterfaces; /* Use the next interface */ - u_int32 haddr = ntohl(addr); + u_int32 haddr = ntohl(((struct sockaddr_in*)&addr)->sin_addr.s_addr); struct in_addr iaddr; - int s; + SOCKET s; struct sockaddr_in *sinp; - iaddr.s_addr = addr; +#ifdef HAVE_IPV6 + struct ipv6_mreq mreq6; + struct in6_addr iaddr6; + struct sockaddr_in6 *sin6p; +#endif /* HAVE_IPV6 */ - if (!IN_CLASSD(haddr)) + switch (addr.ss_family) { - msyslog(LOG_ERR, - "cannot add multicast address %s as it is not class D", - inet_ntoa(iaddr)); - return; + case AF_INET : + iaddr = (((struct sockaddr_in*)&addr)->sin_addr); + if (!IN_CLASSD(haddr)) { + netsyslog(LOG_ERR, + "multicast address %s not class D", + inet_ntoa(iaddr)); + return; + } + for (i = nwilds; i < ninterfaces; i++) { + /* Be sure it's the correct family */ + if (inter_list[i].sin.ss_family != AF_INET) + continue; + /* Already have this address */ + if (SOCKCMP(&inter_list[i].sin, &addr)) + return; + /* found a free slot */ + if (SOCKNUL(&inter_list[i].sin) && + inter_list[i].fd <= 0 && inter_list[i].bfd <= 0 && + inter_list[i].flags == 0) + break; + } + sinp = (struct sockaddr_in*)&(inter_list[i].sin); + memset((char *)&mreq, 0, sizeof(mreq)); + memset((char *)&inter_list[i], 0, sizeof(struct interface)); + sinp->sin_family = AF_INET; + sinp->sin_addr = iaddr; + sinp->sin_port = htons(NTP_PORT); + + /* + * Try opening a socket for the specified class D address. This + * works under SunOS 4.x, but not OSF1 .. :-( + */ + set_reuseaddr(1); + s = open_socket((struct sockaddr_storage*)sinp, 0, 1); + set_reuseaddr(0); + if (s == INVALID_SOCKET) { + memset((char *)&inter_list[i], 0, sizeof(struct interface)); + if (wildipv4 >= 0) { + i = wildipv4; + /* HACK ! -- stuff in an address */ + inter_list[i].bcast = addr; + netsyslog(LOG_ERR, + "...multicast address %s using wildcard socket", + inet_ntoa(iaddr)); + } else { + netsyslog(LOG_ERR, + "No wildcard socket available to use for address %s", + inet_ntoa(iaddr)); + return; + } + } else { + inter_list[i].fd = s; + inter_list[i].bfd = INVALID_SOCKET; + (void) strncpy(inter_list[i].name, "multicast", + sizeof(inter_list[i].name)); + ((struct sockaddr_in*)&inter_list[i].mask)->sin_addr.s_addr = htonl(~(u_int32)0); +#if defined (HAVE_IO_COMPLETION_PORT) + io_completion_port_add_socket(inter_list[i].fd, &inter_list[i]); +#endif + } + + /* + * enable reception of multicast packets + */ + 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) + netsyslog(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)); + inter_list[i].flags |= INT_MULTICAST; + inter_list[i].num_mcast++; + if (i >= ninterfaces) + ninterfaces = i+1; + + add_addr_to_list(&addr, i); + break; + +#ifdef HAVE_IPV6 + case AF_INET6 : + + iaddr6 = ((struct sockaddr_in6*)&addr)->sin6_addr; + if (!IN6_IS_ADDR_MULTICAST(&iaddr6)) { + netsyslog(LOG_ERR, + "address %s not IPv6 multicast address", + stoa(&addr)); + return; + } + for (i = nwilds; i < ninterfaces; i++) { + /* Be sure it's the correct family */ + if(inter_list[i].sin.ss_family != AF_INET6) + continue; + /* Already have this address */ + if (SOCKCMP(&inter_list[i].sin, &addr)) + return; + /* found a free slot */ + if (SOCKNUL(&inter_list[i].sin) && + inter_list[i].fd <= 0 && inter_list[i].bfd <= 0 && + inter_list[i].flags == 0) + break; + } + sin6p = (struct sockaddr_in6*)&inter_list[i].sin; + memset((char *)&mreq6, 0, sizeof(mreq6)); + memset((char *)&inter_list[i], 0, sizeof(struct interface)); + sin6p->sin6_family = AF_INET6; + sin6p->sin6_addr = iaddr6; + sin6p->sin6_port = htons(NTP_PORT); + + /* + * Try opening a socket for the specified class D address. This + * works under SunOS 4.x, but not OSF1 .. :-( + */ + set_reuseaddr(1); + s = open_socket((struct sockaddr_storage*)sin6p, 0, 1); + set_reuseaddr(0); + if(s == INVALID_SOCKET){ + memset((char *)&inter_list[i], 0, sizeof(struct interface)); + if (wildipv6 >= 0) { + i = wildipv6; + /* HACK ! -- stuff in an address */ + inter_list[i].bcast = addr; + netsyslog(LOG_ERR, + "...multicast address %s using wildcard socket", + stoa(&addr)); + } else { + netsyslog(LOG_ERR, + "No wildcard socket available to use for address %s", + stoa(&addr)); + return; + } + } else { + inter_list[i].fd = s; + inter_list[i].bfd = INVALID_SOCKET; + (void)strncpy(inter_list[i].name, "multicast", + sizeof(inter_list[i].name)); + memset(&(((struct sockaddr_in6*)&inter_list[i].mask)->sin6_addr), 1, sizeof(struct in6_addr)); +#if defined (HAVE_IO_COMPLETION_PORT) + io_completion_port_add_socket(inter_list[i].fd, &inter_list[i]); +#endif + } + + /* + * enable reception of multicast packets + */ + mreq6.ipv6mr_multiaddr = iaddr6; + mreq6.ipv6mr_interface = 0; + if(setsockopt(inter_list[i].fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, + (char *)&mreq6, sizeof(mreq6)) == -1) + netsyslog(LOG_ERR, + "setsockopt IPV6_JOIN_GROUP fails: %m on interface %d(%s)", + mreq6.ipv6mr_interface, stoa(&addr)); + inter_list[i].flags |= INT_MULTICAST; + inter_list[i].num_mcast++; + if(i >= ninterfaces) + ninterfaces = i+1; + + add_addr_to_list(&addr, i); + break; +#endif /* HAVE_IPV6 */ } - for (i = 0; i < ninterfaces; i++) - { - /* Already have this address */ - 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; - } - 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); - - 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) - { - 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 - { - inter_list[i].fd = s; - inter_list[i].bfd = -1; - (void) strncpy(inter_list[i].name, "multicast", - sizeof(inter_list[i].name)); - inter_list[i].mask.sin_addr.s_addr = htonl(~(u_int32)0); - } - - /* - * enable reception of multicast packets - */ - 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, - "setsockopt IP_ADD_MEMBERSHIP fails: %m for %x / %x (%s)", - 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; +#ifdef DEBUG + if (debug) + printf("io_multicast_add %s\n", stoa(&addr)); +#endif #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)); + netsyslog(LOG_ERR, + "cannot add multicast address %s as no MCAST support", + stoa(&addr)); #endif /* MCAST */ } @@ -813,12 +847,12 @@ io_unsetbclient(void) { int i; - for (i = 1; i < ninterfaces; i++) + for (i = nwilds; i < ninterfaces; i++) { if (!(inter_list[i].flags & INT_BCASTOPEN)) continue; close_socket(inter_list[i].bfd); - inter_list[i].bfd = -1; + inter_list[i].bfd = INVALID_SOCKET; inter_list[i].flags &= ~INT_BCASTOPEN; } } @@ -829,57 +863,125 @@ io_unsetbclient(void) */ void io_multicast_del( - u_int32 addr + struct sockaddr_storage addr ) { #ifdef MCAST int i; struct ip_mreq mreq; - u_int32 haddr = ntohl(addr); - struct sockaddr_in sinaddr; + u_int32 haddr; - if (!IN_CLASSD(haddr)) - { - sinaddr.sin_addr.s_addr = addr; - msyslog(LOG_ERR, - "invalid multicast address %s", ntoa(&sinaddr)); - return; - } +#ifdef HAVE_IPV6 + struct ipv6_mreq mreq6; + struct in6_addr haddr6; +#endif /* HAVE_IPV6 */ - /* - * Disable reception of multicast packets - */ - mreq.imr_multiaddr.s_addr = addr; - mreq.imr_interface.s_addr = htonl(INADDR_ANY); - for (i = 0; i < ninterfaces; i++) + switch (addr.ss_family) { - if (!(inter_list[i].flags & INT_MULTICAST)) - continue; - if (!(inter_list[i].fd < 0)) - continue; - if (addr != inter_list[i].sin.sin_addr.s_addr) - continue; - if (i != 0) + case AF_INET : + + haddr = ntohl(((struct sockaddr_in*)&addr)->sin_addr.s_addr); + + if (!IN_CLASSD(haddr)) { - /* we have an explicit fd, so we can close it */ - close_socket(inter_list[i].fd); - memset((char *)&inter_list[i], 0, sizeof inter_list[0]); - inter_list[i].fd = -1; - inter_list[i].bfd = -1; + netsyslog(LOG_ERR, + "invalid multicast address %s", stoa(&addr)); + return; } - else + + /* + * Disable reception of multicast packets + */ + mreq.imr_multiaddr = ((struct sockaddr_in*)&addr)->sin_addr; + mreq.imr_interface.s_addr = htonl(INADDR_ANY); + for (i = 0; i < ninterfaces; i++) { - /* We are sharing "any address" port :-( Don't close it! */ - if (setsockopt(inter_list[i].fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, - (char *)&mreq, sizeof(mreq)) == -1) - msyslog(LOG_ERR, "setsockopt IP_DROP_MEMBERSHIP fails: %m"); - /* This is **WRONG** -- there may be others ! */ - /* There should be a count of users ... */ - inter_list[i].flags &= ~INT_MULTICAST; + /* Be sure it's the correct family */ + if (inter_list[i].sin.ss_family != AF_INET) + continue; + if (!(inter_list[i].flags & INT_MULTICAST)) + continue; + if (!(inter_list[i].fd < 0)) + continue; + if (!SOCKCMP(&addr, &inter_list[i].sin)) + continue; + if (i != wildipv4) + { + /* we have an explicit fd, so we can close it */ + close_socket(inter_list[i].fd); + memset((char *)&inter_list[i], 0, sizeof(struct interface)); + inter_list[i].fd = INVALID_SOCKET; + inter_list[i].bfd = INVALID_SOCKET; + } + else + { + /* We are sharing "any address" port :-( Don't close it! */ + if (setsockopt(inter_list[i].fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, + (char *)&mreq, sizeof(mreq)) == -1) + netsyslog(LOG_ERR, "setsockopt IP_DROP_MEMBERSHIP fails on address: %s %m", + stoa(&addr)); + inter_list[i].num_mcast--; + /* If there are none left negate the Multicast flag */ + if(inter_list[i].num_mcast == 0) + inter_list[i].flags &= ~INT_MULTICAST; + } } - } + break; + +#ifdef HAVE_IPV6 + case AF_INET6 : + haddr6 = ((struct sockaddr_in6*)&addr)->sin6_addr; + + if (!IN6_IS_ADDR_MULTICAST(&haddr6)) + { + netsyslog(LOG_ERR, + "invalid multicast address %s", stoa(&addr)); + return; + } + + /* + * Disable reception of multicast packets + */ + mreq6.ipv6mr_multiaddr = ((struct sockaddr_in6*)&addr)->sin6_addr; + mreq6.ipv6mr_interface = 0; + for (i = 0; i < ninterfaces; i++) + { + /* Be sure it's the correct family */ + if (inter_list[i].sin.ss_family != AF_INET6) + continue; + if (!(inter_list[i].flags & INT_MULTICAST)) + continue; + if (!(inter_list[i].fd < 0)) + continue; + if (!SOCKCMP(&addr, &inter_list[i].sin)) + continue; + if (i != wildipv6) + { + /* we have an explicit fd, so we can close it */ + close_socket(inter_list[i].fd); + memset((char *)&inter_list[i], 0, sizeof(struct interface)); + inter_list[i].fd = INVALID_SOCKET; + inter_list[i].bfd = INVALID_SOCKET; + } + else + { + /* We are sharing "any address" port :-( Don't close it! */ + if (setsockopt(inter_list[i].fd, IPPROTO_IPV6, IPV6_LEAVE_GROUP, + (char *)&mreq6, sizeof(mreq6)) == -1) + netsyslog(LOG_ERR, "setsockopt IP_DROP_MEMBERSHIP fails on address %s: %m", + stoa(&addr)); + /* If there are none left negate the Multicast flag */ + if(inter_list[i].num_mcast == 0) + inter_list[i].flags &= ~INT_MULTICAST; + } + } + break; +#endif /* HAVE_IPV6 */ + }/* switch */ + delete_addr_from_list(&addr); + #else /* not MCAST */ - msyslog(LOG_ERR, "this function requires multicast kernel"); + netsyslog(LOG_ERR, "this function requires multicast kernel"); #endif /* not MCAST */ } @@ -887,81 +989,163 @@ io_multicast_del( /* * open_socket - open a socket, returning the file descriptor */ -static int + +static SOCKET open_socket( - struct sockaddr_in *addr, + struct sockaddr_storage *addr, int flags, int turn_off_reuse ) { - int fd, tos; + int errval; + SOCKET 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 */ + + if ((addr->ss_family == AF_INET6) && (isc_net_probeipv6() != ISC_R_SUCCESS)) + return (INVALID_SOCKET); /* create a datagram (UDP) socket */ - if ( (fd = socket(AF_INET, SOCK_DGRAM, 0)) #ifndef SYS_WINNT - < 0 -#else - == INVALID_SOCKET -#endif /* SYS_WINNT */ - ) - { - msyslog(LOG_ERR, "socket(AF_INET, SOCK_DGRAM, 0) failed: %m"); + if ( (fd = socket(addr->ss_family, SOCK_DGRAM, 0)) < 0) { + errval = errno; + if(addr->ss_family == AF_INET) + netsyslog(LOG_ERR, "socket(AF_INET, SOCK_DGRAM, 0) failed on address %s: %m", + stoa(addr)); + else if(addr->ss_family == AF_INET6) + netsyslog(LOG_ERR, "socket(AF_INET6, SOCK_DGRAM, 0) failed on address %s: %m", + stoa(addr)); + if (errval == EPROTONOSUPPORT || errval == EAFNOSUPPORT || + errval == EPFNOSUPPORT) + return (INVALID_SOCKET); exit(1); /*NOTREACHED*/ } +#else + if ( (fd = socket(addr->ss_family, SOCK_DGRAM, 0)) == INVALID_SOCKET) { + errval = WSAGetLastError(); + if(addr->ss_family == AF_INET) + netsyslog(LOG_ERR, "socket(AF_INET, SOCK_DGRAM, 0) failed on address %s: %m", + stoa(addr)); + else if(addr->ss_family == AF_INET6) + netsyslog(LOG_ERR, "socket(AF_INET6, SOCK_DGRAM, 0) failed on address %s: %m", + stoa(addr)); + if (errval == WSAEPROTONOSUPPORT || errval == WSAEAFNOSUPPORT || + errval == WSAEPFNOSUPPORT) + return (INVALID_SOCKET); + exit(1); + /*NOTREACHED*/ + } + if (connection_reset_fix(fd) != ISC_R_SUCCESS) { + netsyslog(LOG_ERR, "connection_reset_fix(fd) failed on address %s: %m", + stoa(addr)); + } + +#endif /* SYS_WINNT */ /* set SO_REUSEADDR since we will be binding the same port number on each interface */ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on))) { - msyslog(LOG_ERR, "setsockopt SO_REUSEADDR on fails: %m"); + netsyslog(LOG_ERR, "setsockopt SO_REUSEADDR on fails on address %s: %m", + stoa(addr)); } #if defined(IPTOS_LOWDELAY) && defined(IPPROTO_IP) && defined(IP_TOS) /* set IP_TOS to minimize packet delay */ tos = IPTOS_LOWDELAY; - if (setsockopt(fd, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos)) < 0) - { - msyslog(LOG_ERR, "setsockopt IPTOS_LOWDELAY on fails: %m"); - } + if (addr->ss_family == AF_INET) + if (setsockopt(fd, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos)) < 0) + { + netsyslog(LOG_ERR, "setsockopt IPTOS_LOWDELAY on fails on address %s: %m", + stoa(addr)); + } + +#if defined(IPV6_V6ONLY) + if (addr->ss_family == AF_INET6) + if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, + (char*)&on, sizeof(on))) + { + netsyslog(LOG_ERR, "setsockopt IPV6_V6ONLY on fails on address %s: %m", + stoa(addr)); + } +#else /* IPV6_V6ONLY */ +#if defined(IPV6_BINDV6ONLY) + if (addr->ss_family == AF_INET6) + if (setsockopt(fd, IPPROTO_IPV6, IPV6_BINDV6ONLY, + (char*)&on, sizeof(on))) + { + netsyslog(LOG_ERR, + "setsockopt IPV6_BINDV6ONLY on fails on address %s: %m", + stoa(addr)); + } +#endif /* IPV6_BINDV6ONLY */ +#endif /* IPV6_V6ONLY */ + #endif /* IPTOS_LOWDELAY && IPPROTO_IP && IP_TOS */ /* * bind the local address. */ - if (bind(fd, (struct sockaddr *)addr, sizeof(*addr)) < 0) { - msyslog(LOG_ERR, "bind() fd %d, family %d, port %d, addr %s, in_classd=%d flags=%d fails: %m", - fd, addr->sin_family, (int)ntohs(addr->sin_port), - ntoa(addr), - IN_CLASSD(ntohl(addr->sin_addr.s_addr)), flags); + if (bind(fd, (struct sockaddr *)addr, SOCKLEN(addr)) < 0) { + char buff[160]; + + if(addr->ss_family == AF_INET) + sprintf(buff, + "bind() fd %d, family %d, port %d, addr %s, in_classd=%d flags=%d fails: %%m", + fd, addr->ss_family, (int)ntohs(((struct sockaddr_in*)addr)->sin_port), + stoa(addr), + IN_CLASSD(ntohl(((struct sockaddr_in*)addr)->sin_addr.s_addr)), flags); + else if(addr->ss_family == AF_INET6) + sprintf(buff, + "bind() fd %d, family %d, port %d, addr %s, in6_is_addr_multicast=%d flags=%d fails: %%m", + fd, addr->ss_family, (int)ntohs(((struct sockaddr_in6*)addr)->sin6_port), + stoa(addr), + IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)addr)->sin6_addr), flags); + else return INVALID_SOCKET; + + netsyslog(LOG_ERR, buff); closesocket(fd); /* - * soft fail if opening a class D address + * soft fail if opening a multicast address */ - if (IN_CLASSD(ntohl(addr->sin_addr.s_addr))) - return -1; + if(addr->ss_family == AF_INET){ + if(IN_CLASSD(ntohl(((struct sockaddr_in*)addr)->sin_addr.s_addr))) + return (INVALID_SOCKET); + } + else { + if(IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)addr)->sin6_addr)) + return (INVALID_SOCKET); + } #if 0 exit(1); #else - return -1; + return INVALID_SOCKET; #endif } #ifdef DEBUG if (debug) printf("bind() fd %d, family %d, port %d, addr %s, flags=%d\n", fd, - addr->sin_family, - (int)ntohs(addr->sin_port), - ntoa(addr), + addr->ss_family, + (int)ntohs(((struct sockaddr_in*)addr)->sin_port), + stoa(addr), flags); #endif + + /* + * I/O Completion Ports don't care about the select and FD_SET + */ +#ifndef HAVE_IO_COMPLETION_PORT if (fd > maxactivefd) maxactivefd = fd; FD_SET(fd, &activefds); - +#endif + add_socket_to_list(fd); /* * set non-blocking, */ @@ -978,43 +1162,46 @@ open_socket( #if defined(O_NONBLOCK) /* POSIX */ if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { - msyslog(LOG_ERR, "fcntl(O_NONBLOCK) fails: %m"); + netsyslog(LOG_ERR, "fcntl(O_NONBLOCK) fails on address %s: %m", + stoa(addr)); exit(1); /*NOTREACHED*/ } #elif defined(FNDELAY) if (fcntl(fd, F_SETFL, FNDELAY) < 0) { - msyslog(LOG_ERR, "fcntl(FNDELAY) fails: %m"); + netsyslog(LOG_ERR, "fcntl(FNDELAY) fails on address %s: %m", + stoa(addr)); exit(1); /*NOTREACHED*/ } #elif defined(O_NDELAY) /* generally the same as FNDELAY */ if (fcntl(fd, F_SETFL, O_NDELAY) < 0) { - msyslog(LOG_ERR, "fcntl(O_NDELAY) fails: %m"); + netsyslog(LOG_ERR, "fcntl(O_NDELAY) fails on address %s: %m", + stoa(addr)); exit(1); /*NOTREACHED*/ } #elif defined(FIONBIO) - if ( # if defined(VMS) - (ioctl(fd,FIONBIO,&1) < 0) + if (ioctl(fd,FIONBIO,&on) < 0) # elif defined(SYS_WINNT) - (ioctlsocket(fd,FIONBIO,(u_long *) &on) == SOCKET_ERROR) + if (ioctlsocket(fd,FIONBIO,(u_long *) &on) == SOCKET_ERROR) # else - (ioctl(fd,FIONBIO,&on) < 0) + if (ioctl(fd,FIONBIO,&on) < 0) # endif - ) { - msyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m"); + netsyslog(LOG_ERR, "ioctl(FIONBIO) fails on address %s: %m", + stoa(addr)); exit(1); /*NOTREACHED*/ } #elif defined(FIOSNBIO) if (ioctl(fd,FIOSNBIO,&on) < 0) { - msyslog(LOG_ERR, "ioctl(FIOSNBIO) fails: %m"); + netsyslog(LOG_ERR, "ioctl(FIOSNBIO) fails on address %s: %m", + stoa(addr)); exit(1); /*NOTREACHED*/ } @@ -1036,7 +1223,8 @@ open_socket( if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&off, sizeof(off))) { - msyslog(LOG_ERR, "setsockopt SO_REUSEADDR off fails: %m"); + netsyslog(LOG_ERR, "setsockopt SO_REUSEADDR off fails on address %s: %m", + stoa(addr)); } #ifdef SO_BROADCAST @@ -1046,7 +1234,8 @@ open_socket( if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char *)&on, sizeof(on))) { - msyslog(LOG_ERR, "setsockopt(SO_BROADCAST): %m"); + netsyslog(LOG_ERR, "setsockopt(SO_BROADCAST) on address %s: %m", + stoa(addr)); } } #endif /* SO_BROADCAST */ @@ -1068,77 +1257,64 @@ open_socket( */ static void close_socket( - int fd + SOCKET fd ) { - int i, newmax; + SOCKET i, newmax; (void) closesocket(fd); + + /* + * I/O Completion Ports don't care about select and fd_set + */ +#ifndef HAVE_IO_COMPLETION_PORT 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; } +#endif + delete_socket_from_list(fd); + } -#ifdef REFCLOCK + /* * close_file - close a file and remove from the activefd list * added 1/31/1997 Greg Schueman for Windows NT portability */ +#ifdef REFCLOCK static void close_file( - int fd + SOCKET fd ) { int i, newmax; (void) close(fd); + /* + * I/O Completion Ports don't care about select and fd_set + */ +#ifndef HAVE_IO_COMPLETION_PORT 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; } +#endif + delete_socket_from_list(fd); + } #endif -/* - * 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 */ /* @@ -1148,7 +1324,7 @@ findbcastinter( */ void sendpkt( - struct sockaddr_in *dest, + struct sockaddr_storage *dest, struct interface *inter, int ttl, struct pkt *pkt, @@ -1161,7 +1337,7 @@ sendpkt( #endif /* SYS_WINNT */ /* - * Send error cache. Empty slots have port == 0 + * Send error caches. Empty slots have port == 0 * Set ERRORCACHESIZE to 0 to disable */ struct cache { @@ -1169,62 +1345,121 @@ sendpkt( struct in_addr addr; }; +#ifdef HAVE_IPV6 + struct cache6 { + u_short port; + struct in6_addr addr; + }; +#endif /* HAVE_IPV6 */ + #ifndef ERRORCACHESIZE #define ERRORCACHESIZE 8 #endif #if ERRORCACHESIZE > 0 static struct cache badaddrs[ERRORCACHESIZE]; +#ifdef HAVE_IPV6 + static struct cache6 badaddrs6[ERRORCACHESIZE]; +#endif /* HAVE_IPV6 */ #else #define badaddrs ((struct cache *)0) /* Only used in empty loops! */ +#ifdef HAVE_IPV6 +#define badaddrs6 ((struct cache6 *)0) /* Only used in empty loops! */ +#endif /* HAVE_IPV6 */ #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", (ttl >= 0) ? "\tMCAST\t*****" : "", - inter->fd, ntoa(dest), - ntoa(&inter->sin), ttl, len); + inter->fd, stoa(dest), + stoa(&inter->sin), ttl, len); #endif #ifdef MCAST - /* 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 */ - if (setsockopt(inter->fd, IPPROTO_IP, IP_MULTICAST_TTL, - &mttl, sizeof(mttl)) == -1) - { - msyslog(LOG_ERR, "setsockopt IP_MULTICAST_TTL fails: %m"); + switch (inter->sin.ss_family) { + + case AF_INET : + + /* + * for the moment we use the bcast option to set multicast ttl + */ + if (ttl > 0 && ttl != inter->last_ttl) { + + /* + * set the multicast ttl for outgoing packets + */ + if (setsockopt(inter->fd, IPPROTO_IP, IP_MULTICAST_TTL, + (char *) &ttl, sizeof(ttl)) != 0) { + netsyslog(LOG_ERR, "setsockopt IP_MULTICAST_TTL fails on address %s: %m", + stoa(&inter->sin)); + } + else + inter->last_ttl = ttl; } - else inter->last_ttl = ttl; + break; + +#ifdef HAVE_IPV6 + case AF_INET6 : + + /* + * for the moment we use the bcast option to set + * multicast max hops + */ + if (ttl > 0 && ttl != inter->last_ttl) { + + /* + * set the multicast ttl for outgoing packets + */ + if (setsockopt(inter->fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, + &ttl, sizeof(ttl)) == -1) + netsyslog(LOG_ERR, "setsockopt IP_MULTICAST_TTL fails on address %s: %m", + stoa(&inter->sin)); + else + inter->last_ttl = ttl; + } + break; +#endif /* HAVE_IPV6 */ + + default : + exit(1); + } + + #endif /* MCAST */ for (slot = ERRORCACHESIZE; --slot >= 0; ) - if (badaddrs[slot].port == dest->sin_port && - badaddrs[slot].addr.s_addr == dest->sin_addr.s_addr) - break; + if(dest->ss_family == AF_INET) { + if (badaddrs[slot].port == ((struct sockaddr_in*)dest)->sin_port && + badaddrs[slot].addr.s_addr == ((struct sockaddr_in*)dest)->sin_addr.s_addr) + break; + } +#ifdef HAVE_IPV6 + else if (dest->ss_family == AF_INET6) { + if (badaddrs6[slot].port == ((struct sockaddr_in6*)dest)->sin6_port && + badaddrs6[slot].addr.s6_addr == ((struct sockaddr_in6*)dest)->sin6_addr.s6_addr) + break; + } +#endif /* HAVE_IPV6 */ + else exit(1); /* address family not supported yet */ #if defined(HAVE_IO_COMPLETION_PORT) 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, - sizeof(struct sockaddr_in)); +#ifdef SIM + cc = srvr_rply(&ntp_node, dest, inter, pkt); +#else /* SIM */ + cc = sendto(inter->fd, (char *)pkt, (unsigned int)len, 0, (struct sockaddr *)dest, + SOCKLEN(dest)); +#endif /* SIM */ if (cc == -1) #endif { inter->notsent++; packets_notsent++; #if defined(HAVE_IO_COMPLETION_PORT) + err = WSAGetLastError(); if (err != WSAEWOULDBLOCK && err != WSAENOBUFS && slot < 0) #else if (errno != EWOULDBLOCK && errno != ENOBUFS && slot < 0) @@ -1233,14 +1468,37 @@ sendpkt( /* * Remember this, if there's an empty slot */ - for (slot = ERRORCACHESIZE; --slot >= 0; ) - if (badaddrs[slot].port == 0) - { - badaddrs[slot].port = dest->sin_port; - badaddrs[slot].addr = dest->sin_addr; - break; - } - msyslog(LOG_ERR, "sendto(%s): %m", ntoa(dest)); + switch (dest->ss_family) { + + case AF_INET : + + for (slot = ERRORCACHESIZE; --slot >= 0; ) + if (badaddrs[slot].port == 0) + { + badaddrs[slot].port = SRCPORT(dest); + badaddrs[slot].addr = ((struct sockaddr_in*)dest)->sin_addr; + break; + } + break; + +#ifdef HAVE_IPV6 + case AF_INET6 : + + for (slot = ERRORCACHESIZE; --slot >= 0; ) + if (badaddrs6[slot].port == 0) + { + badaddrs6[slot].port = SRCPORT(dest); + badaddrs6[slot].addr = ((struct sockaddr_in6*)dest)->sin6_addr; + break; + } + break; +#endif /* HAVE_IPV6 */ + + default : + exit(1); + } + + netsyslog(LOG_ERR, "sendto(%s): %m", stoa(dest)); } } else @@ -1252,8 +1510,17 @@ sendpkt( */ if (slot >= 0) { - msyslog(LOG_INFO, "Connection re-established to %s", ntoa(dest)); - badaddrs[slot].port = 0; + netsyslog(LOG_INFO, "Connection re-established to %s", stoa(dest)); + switch (dest->ss_family) { + case AF_INET : + badaddrs[slot].port = 0; + break; +#ifdef HAVE_IPV6 + case AF_INET6 : + badaddrs6[slot].port = 0; + break; +#endif /* HAVE_IPV6 */ + } } } } @@ -1287,7 +1554,7 @@ fdbits( /* * input_handler - receive packets asynchronously */ -extern void +void input_handler( l_fp *cts ) @@ -1295,7 +1562,7 @@ input_handler( register int i, n; register struct recvbuf *rb; register int doing; - register int fd; + register SOCKET fd; struct timeval tvzero; int fromlen; l_fp ts; /* Timestamp at BOselect() gob */ @@ -1361,14 +1628,17 @@ input_handler( if (rb->recv_length == -1) { - msyslog(LOG_ERR, "clock read fd %d: %m", fd); + netsyslog(LOG_ERR, "clock read fd %d: %m", fd); freerecvbuf(rb); goto select_again; } /* - * Got one. Mark how and when it got here, - * put it on the full list and do bookkeeping. + * Got one. Mark how + * and when it got here, + * put it on the full + * list and do + * bookkeeping. */ rb->recv_srcclock = rp->srcclock; rb->dstadr = 0; @@ -1379,13 +1649,25 @@ input_handler( if (rp->io_input) { /* - * have direct input routine for refclocks + * have direct + * input routine + * for refclocks */ if (rp->io_input(rb) == 0) { /* - * data was consumed - nothing to pass up - * into block input machine + * data + * was + * consumed + * - + * nothing + * to + * pass + * up + * into + * block + * input + * machine */ freerecvbuf(rb); #if 1 @@ -1406,7 +1688,8 @@ input_handler( #endif /* REFCLOCK */ /* - * Loop through the interfaces looking for data to read. + * Loop through the interfaces looking for data + * to read. */ for (i = ninterfaces - 1; (i >= 0) && (n > 0); i--) { @@ -1428,9 +1711,12 @@ input_handler( n--; /* - * Get a buffer and read the frame. If we - * haven't got a buffer, or this is received - * on the wild card socket, just dump the + * Get a buffer and read + * the frame. If we + * haven't got a buffer, + * or this is received + * on the wild card + * socket, just dump the * packet. */ if ( @@ -1441,23 +1727,24 @@ input_handler( */ (free_recvbuffs() == 0) #else - ((i == 0) || (free_recvbuffs() == 0)) + ((i == wildipv4) || (i == wildipv6)|| + (free_recvbuffs() == 0)) #endif ) { char buf[RX_BUFF_SIZE]; - struct sockaddr from; + struct sockaddr_storage from; fromlen = sizeof from; - (void) recvfrom(fd, buf, sizeof(buf), 0, &from, &fromlen); + (void) recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr*)&from, &fromlen); #ifdef DEBUG if (debug) printf("%s on %d(%lu) fd=%d from %s\n", (i) ? "drop" : "ignore", i, free_recvbuffs(), fd, - inet_ntoa(((struct sockaddr_in *) &from)->sin_addr)); + stoa(&from)); #endif - if (i == 0) + if (i == wildipv4 || i == wildipv6) packets_ignored++; else packets_dropped++; @@ -1466,7 +1753,7 @@ input_handler( rb = get_free_recv_buffer(); - fromlen = sizeof(struct sockaddr_in); + fromlen = sizeof(struct sockaddr_storage); rb->recv_length = recvfrom(fd, (char *)&rb->recv_space, sizeof(rb->recv_space), 0, @@ -1485,7 +1772,8 @@ input_handler( } else if (rb->recv_length < 0) { - msyslog(LOG_ERR, "recvfrom() fd=%d: %m", fd); + netsyslog(LOG_ERR, "recvfrom(%s) fd=%d: %m", + stoa(&rb->recv_srcadr), fd); #ifdef DEBUG if (debug) printf("input_handler: fd=%d dropped (bad recvfrom)\n", fd); @@ -1494,12 +1782,18 @@ input_handler( continue; } #ifdef DEBUG - if (debug > 2) - printf("input_handler: fd=%d length %d from %08lx %s\n", - fd, rb->recv_length, - (u_long)ntohl(rb->recv_srcadr.sin_addr.s_addr) & - 0x00000000ffffffff, - inet_ntoa(rb->recv_srcadr.sin_addr)); + if (debug > 2) { + if(rb->recv_srcadr.ss_family == AF_INET) + printf("input_handler: if=%d fd=%d length %d from %08lx %s\n", + i, fd, rb->recv_length, + (u_long)ntohl(((struct sockaddr_in*)&rb->recv_srcadr)->sin_addr.s_addr) & + 0x00000000ffffffff, + stoa(&rb->recv_srcadr)); + else + printf("input_handler: if=%d fd=%d length %d from %s\n", + i, fd, rb->recv_length, + stoa(&rb->recv_srcadr)); + } #endif /* @@ -1512,7 +1806,7 @@ input_handler( rb->receiver = receive; add_full_recv_buffer(rb); - + inter_list[i].received++; packets_received++; goto select_again; @@ -1536,19 +1830,20 @@ input_handler( if (select_count == 0) /* We really had nothing to do */ { if (debug) - msyslog(LOG_DEBUG, "input_handler: select() returned 0"); + netsyslog(LOG_DEBUG, "input_handler: select() returned 0"); --handler_count; return; } /* We've done our work */ get_systime(&ts_e); /* - * (ts_e - ts) is the amount of time we spent processing - * this gob of file descriptors. Log it. + * (ts_e - ts) is the amount of time we spent + * processing this gob of file descriptors. Log + * it. */ L_SUB(&ts_e, &ts); if (debug > 3) - msyslog(LOG_INFO, "input_handler: Processed a gob of fd's in %s msec", lfptoms(&ts_e, 6)); + netsyslog(LOG_INFO, "input_handler: Processed a gob of fd's in %s msec", lfptoms(&ts_e, 6)); /* just bail. */ --handler_count; @@ -1561,8 +1856,11 @@ input_handler( /* * extended FAU debugging output */ - msyslog(LOG_ERR, "select(%d, %s, 0L, 0L, &0.000000) error: %m", - maxactivefd+1, fdbits(maxactivefd, &activefds)); + if (err != EINTR) + netsyslog(LOG_ERR, + "select(%d, %s, 0L, 0L, &0.0) error: %m", + maxactivefd+1, + fdbits(maxactivefd, &activefds)); if (err == EBADF) { int j, b; @@ -1571,7 +1869,7 @@ input_handler( if ( (FD_ISSET(j, &fds) && (read(j, &b, 0) == -1)) ) - msyslog(LOG_ERR, "Bad file descriptor %d", j); + netsyslog(LOG_ERR, "Bad file descriptor %d", j); } --handler_count; return; @@ -1583,29 +1881,116 @@ 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 + struct sockaddr_storage *addr ) { - register int i; - register u_int32 saddr; - + SOCKET s; + int rtn, i; + struct sockaddr_storage saddr; + int saddrlen = SOCKLEN(addr); /* - * 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++) + memset(&saddr, 0, sizeof(saddr)); + saddr.ss_family = addr->ss_family; + if(addr->ss_family == AF_INET) + memcpy(&((struct sockaddr_in*)&saddr)->sin_addr, &((struct sockaddr_in*)addr)->sin_addr, sizeof(struct in_addr)); + else if(addr->ss_family == AF_INET6) + memcpy(&((struct sockaddr_in6*)&saddr)->sin6_addr, &((struct sockaddr_in6*)addr)->sin6_addr, sizeof(struct in6_addr)); + ((struct sockaddr_in*)&saddr)->sin_port = htons(2000); + s = socket(addr->ss_family, SOCK_DGRAM, 0); + if (s == INVALID_SOCKET) + return ANY_INTERFACE_CHOOSE(addr); + + rtn = connect(s, (struct sockaddr *)&saddr, SOCKLEN(&saddr)); +#ifndef SYS_WINNT + if (rtn < 0) +#else + if (rtn == SOCKET_ERROR) +#endif { - if (inter_list[i].sin.sin_addr.s_addr == saddr) - return &inter_list[i]; + closesocket(s); + return ANY_INTERFACE_CHOOSE(addr); } - return (struct interface *)0; + + rtn = getsockname(s, (struct sockaddr *)&saddr, &saddrlen); + closesocket(s); +#ifndef SYS_WINNT + if (rtn < 0) +#else + if (rtn == SOCKET_ERROR) +#endif + return ANY_INTERFACE_CHOOSE(addr); + + for (i = 0; i < ninterfaces; i++) { + /* + * First look if is the the correct family + */ + if(inter_list[i].sin.ss_family != saddr.ss_family) + continue; + /* + * We match the unicast address only. + */ + if (SOCKCMP(&inter_list[i].sin, &saddr)) + return (&inter_list[i]); + } + return ANY_INTERFACE_CHOOSE(addr); +} + +/* + * findbcastinter - find broadcast interface corresponding to address + */ +struct interface * +findbcastinter( + struct sockaddr_storage *addr + ) +{ +#if !defined(MPE) && (defined(SIOCGIFCONF) || defined(SYS_WINNT)) + register int i; + + i = find_addr_in_list(addr); + if(i >= 0) + return (&inter_list[i]); + + for (i = 0; i < ninterfaces; i++) { + /* + * First look if this is the correct family + */ + if(inter_list[i].sin.ss_family != addr->ss_family) + continue; + /* + * 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(addr->ss_family == AF_INET) { + if (SOCKCMP(&inter_list[i].bcast, addr)) + return (&inter_list[i]); + if ((NSRCADR(&inter_list[i].sin) & + NSRCADR(&inter_list[i].mask)) == (NSRCADR(addr) & + NSRCADR(&inter_list[i].mask))) + return (&inter_list[i]); + } + else if(addr->ss_family == AF_INET6) { + if (SOCKCMP(&inter_list[i].bcast, addr)) + return (&inter_list[i]); + if (SOCKCMP(netof(&inter_list[i].sin), netof(addr))) + return (&inter_list[i]); + } + } +#endif /* SIOCGIFCONF */ + return ANY_INTERFACE_CHOOSE(addr); } @@ -1646,9 +2031,14 @@ io_addclock_simple( rio->next = refio; refio = rio; + /* + * I/O Completion Ports don't care about select and fd_set + */ +#ifndef HAVE_IO_COMPLETION_PORT if (rio->fd > maxactivefd) maxactivefd = rio->fd; FD_SET(rio->fd, &activefds); +#endif UNBLOCKIO(); return 1; } @@ -1680,16 +2070,21 @@ io_addclock( # elif defined(HAVE_IO_COMPLETION_PORT) if (io_completion_port_add_clock_io(rio)) { + add_socket_to_list(rio->fd); refio = rio->next; UNBLOCKIO(); return 0; } # endif + /* + * I/O Completion Ports don't care about select and fd_set + */ +#ifndef HAVE_IO_COMPLETION_PORT if (rio->fd > maxactivefd) maxactivefd = rio->fd; FD_SET(rio->fd, &activefds); - +#endif UNBLOCKIO(); return 1; } @@ -1738,12 +2133,127 @@ io_closeclock( } #endif /* REFCLOCK */ + /* + * I/O Completion Ports don't care about select and fd_set + */ +#ifndef HAVE_IO_COMPLETION_PORT void -kill_asyncio(void) +kill_asyncio( + int startfd + ) { - int i; + SOCKET i; BLOCKIO(); - for (i = 0; i <= maxactivefd; i++) + for (i = startfd; i <= maxactivefd; i++) (void)close_socket(i); } +#else +/* + * On NT a SOCKET is an unsigned int so we cannot possibly keep it in + * an array. So we use one of the ISC_LIST functions to hold the + * socket value and use that when we want to enumerate it. + */ +void +kill_asyncio(int startfd) +{ + vsock_t *lsock; + vsock_t *next; + + BLOCKIO(); + + lsock = ISC_LIST_HEAD(sockets_list); + while (lsock != NULL) { + next = ISC_LIST_NEXT(lsock, link); + close_socket(lsock->fd); + lsock = next; + } + +} +#endif +/* + * Add and delete functions for the list of open sockets + */ +void +add_socket_to_list(SOCKET fd){ + vsock_t *lsock = malloc(sizeof(vsock_t)); + lsock->fd = fd; + + ISC_LIST_APPEND(sockets_list, lsock, link); +} +void +delete_socket_from_list(SOCKET fd) { + + vsock_t *next; + vsock_t *lsock = ISC_LIST_HEAD(sockets_list); + + while(lsock != NULL) { + next = ISC_LIST_NEXT(lsock, link); + if(lsock->fd == fd) { + ISC_LIST_DEQUEUE(sockets_list, lsock, link); + free(lsock); + break; + } + else + lsock = next; + } +} +void +add_addr_to_list(struct sockaddr_storage *addr, int if_index){ + remaddr_t *laddr = malloc(sizeof(remaddr_t)); + memcpy(&laddr->addr, addr, sizeof(addr)); + laddr->if_index = if_index; + + ISC_LIST_APPEND(remoteaddr_list, laddr, link); +#ifdef DEBUG + if (debug) + printf("Added addr %s to list of addresses\n", + stoa(addr)); +#endif + + +} +void +delete_addr_from_list(struct sockaddr_storage *addr) { + + remaddr_t *next; + remaddr_t *laddr = ISC_LIST_HEAD(remoteaddr_list); + + while(laddr != NULL) { + next = ISC_LIST_NEXT(laddr, link); + if(SOCKCMP(&laddr->addr, addr)) { + ISC_LIST_DEQUEUE(remoteaddr_list, laddr, link); + free(laddr); + break; + } + else + laddr = next; + } +#ifdef DEBUG + if (debug) + printf("Deleted addr %s from list of addresses\n", + stoa(addr)); +#endif +} +int +find_addr_in_list(struct sockaddr_storage *addr) { + + remaddr_t *next; + remaddr_t *laddr = ISC_LIST_HEAD(remoteaddr_list); +#ifdef DEBUG + if (debug) + printf("Finding addr %s in list of addresses\n", + stoa(addr)); +#endif + + while(laddr != NULL) { + next = ISC_LIST_NEXT(laddr, link); + if(SOCKCMP(&laddr->addr, addr)) { + return (laddr->if_index); + break; + } + else + laddr = next; + } + return (-1); /* Not found */ +} diff --git a/dist/ntp/ntpd/ntp_loopfilter.c b/dist/ntp/ntpd/ntp_loopfilter.c index 2bcbb0a020db..9256de5523e2 100644 --- a/dist/ntp/ntpd/ntp_loopfilter.c +++ b/dist/ntp/ntpd/ntp_loopfilter.c @@ -1,26 +1,26 @@ -/* $NetBSD: ntp_loopfilter.c,v 1.2 2002/09/20 14:09:45 uwe Exp $ */ +/* $NetBSD: ntp_loopfilter.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_loopfilter.c - implements the NTP loop filter algorithm * + * ATTENTION: Get approval from Dave Mills on all changes to this file! + * */ #ifdef HAVE_CONFIG_H # include #endif -#include -#include -#include - - -#include -#include - #include "ntpd.h" #include "ntp_io.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include +#include + +#include +#include + #if defined(VMS) && defined(VMS_LOCALUNIT) /*wjm*/ #include "ntp_refclock.h" #endif /* VMS */ @@ -36,24 +36,42 @@ * included to protect against timewarps, timespikes and general mayhem. * All units are in s and s/s, unless noted otherwise. */ -#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_MAXERR 1e-2 /* max phase jitter (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) */ -#define CLOCK_MINSTEP 900. /* step-change timeout (s) */ -#define CLOCK_DAY 86400. /* one day of seconds */ +#define CLOCK_MAX .128 /* default step threshold (s) */ +#define CLOCK_MINSTEP 900. /* default stepout threshold (s) */ +#define CLOCK_PANIC 1000. /* default panic threshold (s) */ +#define CLOCK_PHI 15e-6 /* max frequency error (s/s) */ +#define CLOCK_PLL 16. /* PLL loop gain */ +#define CLOCK_FLL 8. /* FLL loop gain */ +#define CLOCK_AVG 4. /* parameter averaging constant */ +#define CLOCK_ALLAN 1500. /* compromise Allan intercept (s) */ +#define CLOCK_DAY 86400. /* one day in seconds (s) */ #define CLOCK_LIMIT 30 /* poll-adjust threshold */ #define CLOCK_PGATE 4. /* poll-adjust gate */ -#define CLOCK_ALLAN 1024. /* min Allan intercept (s) */ -#define CLOCK_ADF 1e11 /* Allan deviation factor */ +#define PPS_MAXAGE 120 /* kernel pps signal timeout (s) */ /* * 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 */ @@ -74,10 +92,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 @@ -90,21 +108,28 @@ * also a signal for the external clock driver to discipline the system * clock. */ -#define PPS_MAXAGE 120 /* kernel pps signal timeout (s) */ +/* + * Program variables that can be tinkered. + */ +double clock_max = CLOCK_MAX; /* step threshold (s) */ +double clock_minstep = CLOCK_MINSTEP; /* stepout threshold (s) */ +double clock_panic = CLOCK_PANIC; /* panic threshold (s) */ +double clock_phi = CLOCK_PHI; /* dispersion rate (s/s) */ +double allan_xpt = CLOCK_ALLAN; /* 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, u_long, 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 */ /* @@ -113,32 +138,36 @@ 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_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_poll = NTP_MINDPOLL; /* system poll interval (log2 s) */ int state; /* clock discipline state */ -int tc_counter; /* poll-adjust counter */ +int tc_counter; /* hysteresis 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() */ @@ -155,12 +184,15 @@ 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); } /* * local_clock - the NTP logical clock loop filter. Returns 1 if the * clock was stepped, 0 if it was slewed and -1 if it is hopeless. + * + * LOCKCLOCK: The only thing this routine does is set the + * sys_rootdispersion variable equal to the peer dispersion. */ int local_clock( @@ -169,7 +201,7 @@ local_clock( double epsil /* jittter (square s*s) */ ) { - double mu; /* interval since last update (s) */ + u_long mu; /* interval since last update (s) */ double oerror; /* previous error estimate */ double flladj; /* FLL frequency adjustment (ppm) */ double plladj; /* PLL frequency adjustment (ppm) */ @@ -177,30 +209,72 @@ 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 offset %.9f jitter %.9f state %d\n", + peer->associd, fp_offset, SQRT(epsil), state); #endif - if (!ntp_enable) - return(0); +#ifdef LOCKCLOCK + sys_rootdispersion = peer->rootdispersion; + return (0); + +#else /* LOCKCLOCK */ + 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 (fabs(fp_offset) > clock_max && clock_max > 0) { + step_systime(fp_offset); + msyslog(LOG_NOTICE, "time reset %+.6f s", + fp_offset); + printf("ntpd: time set %+.6fs\n", fp_offset); + } else { + adj_systime(fp_offset); + 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 @@ -209,32 +283,66 @@ local_clock( * get here again. */ if (state == S_NSET) { - step_systime(fp_offset); - NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) - msyslog(LOG_NOTICE, "time set %.6f s", fp_offset); - rstclock(S_TSET); - rstclock(S_FREQ); + if (fabs(fp_offset) > clock_max && clock_max > 0) { + step_systime(fp_offset); + msyslog(LOG_NOTICE, "time reset %+.6f s", + fp_offset); + reinit_timer(); + } + rstclock(S_FREQ, peer->epoch, 0); 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) { /* @@ -245,32 +353,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. @@ -288,48 +393,37 @@ local_clock( * reset or shaken, but never stirred. */ default: - if (allow_set_backward || correct_any) { - step_systime(fp_offset); - NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) - msyslog(LOG_NOTICE, "time reset %.6f s", - fp_offset); - rstclock(S_TSET); - 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; - } + step_systime(fp_offset); + msyslog(LOG_NOTICE, "time reset %+.6f s", + fp_offset); + reinit_timer(); + rstclock(S_TSET, peer->epoch, 0); + retval = 1; break; } } else { 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; /* @@ -339,58 +433,65 @@ local_clock( */ case S_TSET: case S_SPIK: - rstclock(S_SYNC); + state = S_SYNC; /* fall through to default */ /* * We come here in the normal case for linear phase and - * frequency adjustments. If the offset exceeds the - * previous time error estimate by CLOCK_SGATE and the - * interval since the last update is less than twice the - * poll interval, consider the update a popcorn spike - * and ignore it. + * frequency adjustments. If the difference between the + * last offset and the current one exceeds the jitter 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.. */ default: - if (fabs(fp_offset - last_offset) > - CLOCK_SGATE * oerror && mu < - ULOGTOD(sys_poll + 1)) { + allow_panic = FALSE; + dtemp = fabs(fp_offset - last_offset); +/* + if (dtemp > CLOCK_SGATE * oerror && mu < + (u_long) 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", + dtemp, oerror); #endif last_offset = fp_offset; return (0); } +*/ /* - * 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. + * The FLL and PLL frequency gain constants + * depend on the poll interval and Allan + * intercept. The PLL constant is calculated + * throughout the poll interval range, but the + * update interval is clamped so as not to + * exceed the poll interval. The FLL gain is + * zero below one-half the Allan intercept and + * unity at MAXPOLL. It decreases as 1 / + * (MAXPOLL + 1 - poll interval) in a feeble + * effort to match the loop stiffness to the + * Allan wobble. 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.); - flladj = fp_offset * etemp / (dtemp * - CLOCK_AVG); - dtemp = ULOGTOD(SHIFT_PLL + 2 + sys_poll); - etemp = min(mu, ULOGTOD(sys_poll)); + if (ULOGTOD(sys_poll) > allan_xpt / 2) { + dtemp = NTP_MAXPOLL + 1 - sys_poll; + flladj = (fp_offset - clock_offset) / + (max(mu, allan_xpt) * dtemp); + } + etemp = min(mu, (u_long)ULOGTOD(sys_poll)); + dtemp = 4 * CLOCK_PLL * ULOGTOD(sys_poll); plladj = fp_offset * etemp / (dtemp * dtemp); - clock_offset = fp_offset; + last_time = peer->epoch; + last_offset = clock_offset = fp_offset; break; } } +#ifdef KERNEL_PLL /* * This code segment works when clock adjustments are made using * precision time kernel support and the ntp_adjtime() system @@ -401,7 +502,6 @@ local_clock( * modifications provide a true microsecond clock and nanosecond * clock, respectively. */ -#if defined(KERNEL_PLL) if (pll_control && kern_enable) { /* @@ -415,7 +515,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 { @@ -424,25 +524,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; @@ -469,63 +565,60 @@ local_clock( */ if (sys_poll > NTP_MAXDPOLL) ntv.status |= STA_FLL; + + /* + * 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); + } } /* - * 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; - - /* - * 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", + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, + "kernel time sync disabled %04x", + ntv.status); + ntv.status &= ~(STA_PPSFREQ | STA_PPSTIME); + } else { + if (ntv.status != pll_status) + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, + "kernel time sync enabled %04x", ntv.status); } 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,23 +630,36 @@ local_clock( * drift_comp is a sham and used only for updating the drift * file and for billboard eye candy. */ - 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; - dtemp = SQUARE(clock_stability); - etemp = SQUARE(etemp) - dtemp; - clock_stability = SQRT(dtemp + etemp / CLOCK_AVG); - allan_xpt = max(CLOCK_ALLAN, clock_stability * CLOCK_ADF); + dtemp = clock_frequency + flladj + plladj; + etemp = drift_comp + dtemp; + if (etemp > NTP_MAXFREQ) + drift_comp = NTP_MAXFREQ; + else if (etemp <= -NTP_MAXFREQ) + drift_comp = -NTP_MAXFREQ; + else + drift_comp = etemp; + if (fabs(etemp) > NTP_MAXFREQ) + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, + "frequency error %.0f PPM exceeds tolerance %.0f PPM", + etemp * 1e6, NTP_MAXFREQ * 1e6); + + etemp = SQUARE(clock_stability); + dtemp = SQUARE(dtemp); + clock_stability = SQRT(etemp + (dtemp - etemp) / CLOCK_AVG); /* - * 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; @@ -577,40 +683,38 @@ local_clock( /* * Update the system time variables. */ - last_time = current_time; - last_offset = clock_offset; - dtemp = peer->disp + SQRT(peer->variance + SQUARE(sys_error)); - if ((peer->flags & FLAG_REFCLOCK) == 0 && dtemp < MINDISPERSE) + dtemp = peer->disp + (current_time - peer->epoch) * clock_phi + + sys_jitter + fabs(last_offset); + if (!(peer->flags & FLAG_REFCLOCK) && dtemp < MINDISPERSE) dtemp = MINDISPERSE; sys_rootdispersion = peer->rootdispersion + dtemp; - (void)record_loop_stats(); + record_loop_stats(last_offset, drift_comp, sys_jitter, + clock_stability, sys_poll); + #ifdef DEBUG - if (debug > 1) + 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 */ -#ifdef DEBUG - if (debug > 1) - printf( - "local_clock: jitter %.6f freq %.3f stab %.3f poll %d count %d\n", - sys_error, drift_comp * 1e6, clock_stability * 1e6, - sys_poll, tc_counter); + "local_clock: mu %lu rootjit %.6f stab %.3f poll %d count %d\n", + mu, dtemp, clock_stability * 1e6, sys_poll, + tc_counter); #endif /* DEBUG */ return (retval); +#endif /* LOCKCLOCK */ } /* * adj_host_clock - Called once every second to update the local clock. + * + * LOCKCLOCK: The only thing this routine does is increment the + * sys_rootdispersion variable. */ void adj_host_clock( void ) { - double adjustment; + double adjustment; /* * Update the dispersion since the last update. In contrast to @@ -622,26 +726,25 @@ 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; +#ifndef LOCKCLOCK /* * Declare PPS kernel unsync if the pps signal has not been * heard for a few minutes. */ if (pps_control && current_time - pps_control > PPS_MAXAGE) { if (pps_control) - NLOG(NLOG_SYSEVENT) /* conditional if clause */ - msyslog(LOG_INFO, "pps sync disabled"); + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, "pps sync disabled"); pps_control = 0; } - if (!ntp_enable) - return; /* - * If the phase-lock loop is implemented in the kernel, we - * have no business going further. + * If NTP is disabled or ntpdate mode enabled or the kernel + * discipline enabled, we have no business going further. */ - if (pll_control && kern_enable) + if (!ntp_enable || mode_ntpdate || (pll_control && kern_enable)) return; /* @@ -656,9 +759,15 @@ adj_host_clock( sys_peer->flags & FLAG_PREFER) return; } - adjustment = clock_offset / ULOGTOD(SHIFT_PLL + sys_poll); + + /* + * Implement the phase and frequency adjustments. Note the + * black art formerly practiced here has been whitewashed. + */ + adjustment = clock_offset / (CLOCK_PLL * ULOGTOD(sys_poll)); clock_offset -= adjustment; adj_systime(adjustment + drift_comp); +#endif /* LOCKCLOCK */ } @@ -667,57 +776,48 @@ adj_host_clock( */ static void rstclock( - int trans /* new state */ + int trans, /* new state */ + u_long epoch, /* last time */ + double offset /* last offset */ ) { - correct_any = FALSE; + tc_counter = 0; + sys_poll = NTP_MINPOLL; state = trans; - switch (state) { + last_time = epoch; + last_offset = clock_offset = offset; +#ifdef DEBUG + if (debug) + printf("local_clock: at %lu state %d\n", last_time, + trans); +#endif +} - /* - * 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; - /* - * Synchronized mode. Discipline the poll interval. - */ - case S_SYNC: - sys_poll = NTP_MINDPOLL; - allan_xpt = CLOCK_ALLAN; - tc_counter = 0; - break; +/* + * huff-n'-puff filter + */ +void +huffpuff() +{ + int i; - /* - * Don't do anything in S_SPIK state; just continue from S_SYNC - * state. - */ - case S_SPIK: - break; - - /* - * 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]; } } /* * loop_config - configure the loop filter + * + * LOCKCLOCK: The LOOP_DRIFTINIT and LOOP_DRIFTCOMP cases are no-ops. */ void loop_config( @@ -725,111 +825,159 @@ 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; +#ifndef LOCKCLOCK #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. + * + * Call out the safety patrol. If ntpdate mode or if the + * step threshold has been changed by the -x option or + * tinker command, kernel discipline is unsafe, so don't + * do any of this stuff. */ - memset((char *)&ntv, 0, sizeof ntv); + if (mode_ntpdate || clock_max != CLOCK_MAX) + break; + 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; -#endif /* STA_NANO */ -#ifdef STA_CLK - - if (ntv.status & STA_CLK) { + if (pll_status & STA_CLK) ext_enable = 1; - } 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); - } -#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 /* STA_NANO */ + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_INFO, + "kernel time sync status %04x", + pll_status); } #endif /* KERNEL_PLL */ +#endif /* LOCKCLOCK */ + break; + + case LOOP_DRIFTCOMP: + +#ifndef LOCKCLOCK + /* + * If the frequency value is reasonable, set the initial + * frequency to the given value and the state to S_FSET. + * Otherwise, the drift file may be missing or broken, + * so set the frequency to zero. This erases past + * history should somebody break something. + */ + if (freq <= NTP_MAXFREQ && freq >= -NTP_MAXFREQ) { + drift_comp = freq; + rstclock(S_FSET, current_time, 0); + } else { + drift_comp = 0; + } + +#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); + } + (void)ntp_adjtime(&ntv); + } +#endif /* KERNEL_PLL */ +#endif /* LOCKCLOCK */ + break; + + /* + * Special tinker variables for Ulrich Windl. Very dangerous. + */ + case LOOP_MAX: /* step threshold */ + clock_max = freq; + break; + + case LOOP_PANIC: /* panic 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_ALLAN: /* Allan intercept */ + 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; + + case LOOP_FREQ: /* initial frequency */ + drift_comp = freq / 1e6; + rstclock(S_FSET, current_time, 0); + break; } } diff --git a/dist/ntp/ntpd/ntp_monitor.c b/dist/ntp/ntpd/ntp_monitor.c index a40e5b5dd398..554baff6bd69 100644 --- a/dist/ntp/ntpd/ntp_monitor.c +++ b/dist/ntp/ntpd/ntp_monitor.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_monitor.c,v 1.1.1.2 2003/12/04 16:05:26 drochner Exp $ */ +/* $NetBSD: ntp_monitor.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_monitor - monitor ntpd statistics diff --git a/dist/ntp/ntpd/ntp_peer.c b/dist/ntp/ntpd/ntp_peer.c index 8f792513ab19..28dd557a2b63 100644 --- a/dist/ntp/ntpd/ntp_peer.c +++ b/dist/ntp/ntpd/ntp_peer.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_peer.c,v 1.1.1.3 2003/12/04 16:05:26 drochner Exp $ */ +/* $NetBSD: ntp_peer.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_peer.c - management of data maintained for peer associations diff --git a/dist/ntp/ntpd/ntp_proto.c b/dist/ntp/ntpd/ntp_proto.c index 16e541fbc9be..0faf72f20b7b 100644 --- a/dist/ntp/ntpd/ntp_proto.c +++ b/dist/ntp/ntpd/ntp_proto.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_proto.c,v 1.1.1.3 2003/12/04 16:05:26 drochner Exp $ */ +/* $NetBSD: ntp_proto.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_proto.c - NTP version 4 protocol machinery diff --git a/dist/ntp/ntpd/ntp_refclock.c b/dist/ntp/ntpd/ntp_refclock.c index 320ee8f04a65..320d1814d308 100644 --- a/dist/ntp/ntpd/ntp_refclock.c +++ b/dist/ntp/ntpd/ntp_refclock.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_refclock.c,v 1.1.1.2 2003/12/04 16:05:26 drochner Exp $ */ +/* $NetBSD: ntp_refclock.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_refclock - processing support for reference clocks diff --git a/dist/ntp/ntpd/ntp_request.c b/dist/ntp/ntpd/ntp_request.c index ffbe38c341e1..4894dd07640d 100644 --- a/dist/ntp/ntpd/ntp_request.c +++ b/dist/ntp/ntpd/ntp_request.c @@ -1,18 +1,12 @@ -/* $NetBSD: ntp_request.c,v 1.2 2000/04/22 15:49:33 simonb Exp $ */ +/* $NetBSD: ntp_request.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_request.c - respond to information requests */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include "ntpd.h" #include "ntp_io.h" @@ -21,6 +15,13 @@ #include "ntp_refclock.h" #include "ntp_if.h" #include "ntp_stdlib.h" + +#include +#include +#include +#include +#include + #include "recvbuff.h" #ifdef KERNEL_PLL @@ -34,12 +35,21 @@ #define AUTH 1 #define NO_REQUEST (-1) +/* + * Because we now have v6 addresses in the messages, we need to compensate + * for the larger size. Therefore, we introduce the alternate size to + * keep us friendly with older implementations. A little ugly. + */ +static int client_v6_capable = 0; /* the client can handle longer messages */ + +#define v6sizeof(type) (client_v6_capable ? sizeof(type) : v4sizeof(type)) struct req_proc { short request_code; /* defined request code */ short needs_auth; /* true when authentication needed */ - short sizeofitem; /* size of request data item */ - void (*handler) P((struct sockaddr_in *, struct interface *, + short sizeofitem; /* size of request data item (older size)*/ + short v6_sizeofitem; /* size of request data item (new size)*/ + void (*handler) P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); /* routine to handle request */ }; @@ -50,105 +60,120 @@ static struct req_proc univ_codes[] = { { NO_REQUEST, NOAUTH, 0, 0 } }; -static void req_ack P((struct sockaddr_in *, struct interface *, struct req_pkt *, int)); -static char * prepare_pkt P((struct sockaddr_in *, struct interface *, struct req_pkt *, u_int)); +static void req_ack P((struct sockaddr_storage *, struct interface *, struct req_pkt *, int)); +static char * prepare_pkt P((struct sockaddr_storage *, struct interface *, struct req_pkt *, u_int)); static char * more_pkt P((void)); static void flush_pkt P((void)); -static void peer_list P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void peer_list_sum P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void peer_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void peer_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void sys_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void sys_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void mem_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -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 *)); -static void clr_sys_flag P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void setclr_flags P((struct sockaddr_in *, struct interface *, struct req_pkt *, u_long)); -static void list_restrict P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void do_resaddflags P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void do_ressubflags P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void do_unrestrict P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void do_restrict P((struct sockaddr_in *, struct interface *, struct req_pkt *, int)); -static void mon_getlist_0 P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void mon_getlist_1 P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void reset_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void reset_peer P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -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 *, u_long)); -static void get_auth_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +static void peer_list P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void peer_list_sum P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void peer_info P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void peer_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void sys_info P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void sys_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void mem_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void io_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void timer_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void loop_info P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_conf P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_unconf P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void set_sys_flag P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void clr_sys_flag P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void setclr_flags P((struct sockaddr_storage *, struct interface *, struct req_pkt *, u_long)); +static void list_restrict P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_resaddflags P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_ressubflags P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_unrestrict P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_restrict P((struct sockaddr_storage *, struct interface *, struct req_pkt *, int)); +static void mon_getlist_0 P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void mon_getlist_1 P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void reset_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void reset_peer P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_key_reread P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void trust_key P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void untrust_key P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_trustkey P((struct sockaddr_storage *, struct interface *, struct req_pkt *, u_long)); +static void get_auth_info P((struct sockaddr_storage *, 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 *)); -static void req_set_trap P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void req_clr_trap P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void do_setclr_trap P((struct sockaddr_in *, struct interface *, struct req_pkt *, int)); -static void set_request_keyid P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void set_control_keyid P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void get_ctl_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +static void req_get_traps P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void req_set_trap P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void req_clr_trap P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void do_setclr_trap P((struct sockaddr_storage *, struct interface *, struct req_pkt *, int)); +static void set_request_keyid P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void set_control_keyid P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void get_ctl_stats P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); #ifdef KERNEL_PLL -static void get_kernel_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +static void get_kernel_info P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); #endif /* KERNEL_PLL */ #ifdef REFCLOCK -static void get_clock_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void set_clock_fudge P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +static void get_clock_info P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); +static void set_clock_fudge P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); #endif /* REFCLOCK */ #ifdef REFCLOCK -static void get_clkbug_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +static void get_clkbug_info P((struct sockaddr_storage *, struct interface *, struct req_pkt *)); #endif /* REFCLOCK */ /* * ntpd request codes */ static struct req_proc ntp_codes[] = { - { REQ_PEER_LIST, NOAUTH, 0, peer_list }, - { REQ_PEER_LIST_SUM, NOAUTH, 0, peer_list_sum }, - { REQ_PEER_INFO, NOAUTH, sizeof(struct info_peer_list), peer_info }, - { REQ_PEER_STATS, NOAUTH, sizeof(struct info_peer_list), peer_stats }, - { REQ_SYS_INFO, NOAUTH, 0, sys_info }, - { REQ_SYS_STATS, NOAUTH, 0, sys_stats }, - { REQ_IO_STATS, NOAUTH, 0, io_stats }, - { 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 }, - { REQ_CLR_SYS_FLAG, AUTH, sizeof(struct conf_sys_flags), clr_sys_flag }, - { REQ_GET_RESTRICT, NOAUTH, 0, list_restrict }, - { REQ_RESADDFLAGS, AUTH, sizeof(struct conf_restrict), do_resaddflags }, - { REQ_RESSUBFLAGS, AUTH, sizeof(struct conf_restrict), do_ressubflags }, - { REQ_UNRESTRICT, AUTH, sizeof(struct conf_restrict), do_unrestrict }, - { REQ_MON_GETLIST, NOAUTH, 0, mon_getlist_0 }, - { REQ_MON_GETLIST_1, NOAUTH, 0, mon_getlist_1 }, - { REQ_RESET_STATS, AUTH, sizeof(struct reset_flags), reset_stats }, - { REQ_RESET_PEER, AUTH, sizeof(struct conf_unpeer), reset_peer }, - { REQ_REREAD_KEYS, AUTH, 0, do_key_reread }, - { REQ_TRUSTKEY, AUTH, sizeof(u_long), trust_key }, - { REQ_UNTRUSTKEY, AUTH, sizeof(u_long), untrust_key }, - { REQ_AUTHINFO, NOAUTH, 0, get_auth_info }, - { REQ_TRAPS, NOAUTH, 0, req_get_traps }, - { REQ_ADD_TRAP, AUTH, sizeof(struct conf_trap), req_set_trap }, - { REQ_CLR_TRAP, AUTH, sizeof(struct conf_trap), req_clr_trap }, - { REQ_REQUEST_KEY, AUTH, sizeof(u_long), set_request_keyid }, - { REQ_CONTROL_KEY, AUTH, sizeof(u_long), set_control_keyid }, - { REQ_GET_CTLSTATS, NOAUTH, 0, get_ctl_stats }, + { REQ_PEER_LIST, NOAUTH, 0, 0, peer_list }, + { REQ_PEER_LIST_SUM, NOAUTH, 0, 0, peer_list_sum }, + { REQ_PEER_INFO, NOAUTH, v4sizeof(struct info_peer_list), + sizeof(struct info_peer_list), peer_info}, + { REQ_PEER_STATS, NOAUTH, v4sizeof(struct info_peer_list), + sizeof(struct info_peer_list), peer_stats}, + { REQ_SYS_INFO, NOAUTH, 0, 0, sys_info }, + { REQ_SYS_STATS, NOAUTH, 0, 0, sys_stats }, + { REQ_IO_STATS, NOAUTH, 0, 0, io_stats }, + { REQ_MEM_STATS, NOAUTH, 0, 0, mem_stats }, + { REQ_LOOP_INFO, NOAUTH, 0, 0, loop_info }, + { REQ_TIMER_STATS, NOAUTH, 0, 0, timer_stats }, + { REQ_CONFIG, AUTH, v4sizeof(struct conf_peer), + sizeof(struct conf_peer), do_conf }, + { REQ_UNCONFIG, AUTH, v4sizeof(struct conf_unpeer), + sizeof(struct conf_unpeer), do_unconf }, + { REQ_SET_SYS_FLAG, AUTH, sizeof(struct conf_sys_flags), + sizeof(struct conf_sys_flags), set_sys_flag }, + { REQ_CLR_SYS_FLAG, AUTH, sizeof(struct conf_sys_flags), + sizeof(struct conf_sys_flags), clr_sys_flag }, + { REQ_GET_RESTRICT, NOAUTH, 0, 0, list_restrict }, + { REQ_RESADDFLAGS, AUTH, v4sizeof(struct conf_restrict), + sizeof(struct conf_restrict), do_resaddflags }, + { REQ_RESSUBFLAGS, AUTH, v4sizeof(struct conf_restrict), + sizeof(struct conf_restrict), do_ressubflags }, + { REQ_UNRESTRICT, AUTH, v4sizeof(struct conf_restrict), + sizeof(struct conf_restrict), do_unrestrict }, + { REQ_MON_GETLIST, NOAUTH, 0, 0, mon_getlist_0 }, + { REQ_MON_GETLIST_1, NOAUTH, 0, 0, mon_getlist_1 }, + { REQ_RESET_STATS, AUTH, sizeof(struct reset_flags), 0, reset_stats }, + { REQ_RESET_PEER, AUTH, v4sizeof(struct conf_unpeer), + sizeof(struct conf_unpeer), reset_peer }, + { REQ_REREAD_KEYS, AUTH, 0, 0, do_key_reread }, + { REQ_TRUSTKEY, AUTH, sizeof(u_long), sizeof(u_long), trust_key }, + { REQ_UNTRUSTKEY, AUTH, sizeof(u_long), sizeof(u_long), untrust_key }, + { REQ_AUTHINFO, NOAUTH, 0, 0, get_auth_info }, + { REQ_TRAPS, NOAUTH, 0, 0, req_get_traps }, + { REQ_ADD_TRAP, AUTH, v4sizeof(struct conf_trap), + sizeof(struct conf_trap), req_set_trap }, + { REQ_CLR_TRAP, AUTH, v4sizeof(struct conf_trap), + sizeof(struct conf_trap), req_clr_trap }, + { REQ_REQUEST_KEY, AUTH, sizeof(u_long), sizeof(u_long), + set_request_keyid }, + { REQ_CONTROL_KEY, AUTH, sizeof(u_long), sizeof(u_long), + set_control_keyid }, + { REQ_GET_CTLSTATS, NOAUTH, 0, 0, get_ctl_stats }, #ifdef KERNEL_PLL - { REQ_GET_KERNEL, NOAUTH, 0, get_kernel_info }, + { REQ_GET_KERNEL, NOAUTH, 0, 0, get_kernel_info }, #endif #ifdef REFCLOCK - { REQ_GET_CLOCKINFO, NOAUTH, sizeof(u_int32), get_clock_info }, - { REQ_SET_CLKFUDGE, AUTH, sizeof(struct conf_fudge), set_clock_fudge }, - { REQ_GET_CLKBUGINFO, NOAUTH, sizeof(u_int32), get_clkbug_info }, + { REQ_GET_CLOCKINFO, NOAUTH, sizeof(u_int32), sizeof(u_int32), + get_clock_info }, + { REQ_SET_CLKFUDGE, AUTH, sizeof(struct conf_fudge), + sizeof(struct conf_fudge), set_clock_fudge }, + { REQ_GET_CLKBUGINFO, NOAUTH, sizeof(u_int32), sizeof(u_int32), + get_clkbug_info }, #endif - { NO_REQUEST, NOAUTH, 0, 0 } + { NO_REQUEST, NOAUTH, 0, 0, 0 } }; @@ -188,7 +213,7 @@ static int itemsize; static int databytes; static char exbuf[RESP_DATA_SIZE]; static int usingexbuf; -static struct sockaddr_in *toaddr; +static struct sockaddr_storage *toaddr; static struct interface *frominter; /* @@ -214,7 +239,7 @@ init_request (void) */ static void req_ack( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt, int errcode @@ -244,7 +269,7 @@ req_ack( */ static char * prepare_pkt( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *pkt, u_int structsize @@ -256,7 +281,7 @@ prepare_pkt( #endif /* - * Fill in the implementation, reqest and itemsize fields + * Fill in the implementation, request and itemsize fields * since these won't change. */ rpkt.implementation = pkt->implementation; @@ -382,10 +407,12 @@ process_private( ) { struct req_pkt *inpkt; - struct sockaddr_in *srcadr; + struct req_pkt_tail *tailinpkt; + struct sockaddr_storage *srcadr; struct interface *inter; struct req_proc *proc; int ec; + short temp_size; /* * Initialize pointers, for convenience @@ -412,10 +439,9 @@ process_private( || (++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) + || (++ec, rbufp->recv_length < REQ_LEN_HDR) ) { - msyslog(LOG_ERR, "process_private: INFO_ERR_FMT: test %d failed", ec); + msyslog(LOG_ERR, "process_private: INFO_ERR_FMT: test %d failed, pkt from %s", ec, stoa(srcadr)); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -427,7 +453,8 @@ process_private( */ if (inpkt->implementation == IMPL_UNIV) proc = univ_codes; - else if (inpkt->implementation == IMPL_XNTPD) + else if ((inpkt->implementation == IMPL_XNTPD) || + (inpkt->implementation == IMPL_XNTPD_OLD)) proc = ntp_codes; else { req_ack(srcadr, inter, inpkt, INFO_ERR_IMPL); @@ -453,6 +480,50 @@ process_private( printf("found request in tables\n"); #endif + /* + * If we need data, check to see if we have some. If we + * don't, check to see that there is none (picky, picky). + */ + + /* This part is a bit tricky, we want to be sure that the size + * returned is either the old or the new size. We also can find + * out if the client can accept both types of messages this way. + * + * Handle the exception of REQ_CONFIG. It can have two data sizes. + */ + temp_size = INFO_ITEMSIZE(inpkt->mbz_itemsize); + if ((temp_size != proc->sizeofitem && + temp_size != proc->v6_sizeofitem) && + !(inpkt->implementation == IMPL_XNTPD && + inpkt->request == REQ_CONFIG && + temp_size == sizeof(struct old_conf_peer))) { + if (debug > 2) + printf("process_private: wrong item size, received %d, should be %d or %d\n", + temp_size, proc->sizeofitem, proc->v6_sizeofitem); + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + return; + } + if ((proc->sizeofitem != 0) && + ((temp_size * INFO_NITEMS(inpkt->err_nitems)) > + (rbufp->recv_length - REQ_LEN_HDR))) { + if (debug > 2) + printf("process_private: not enough data\n"); + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + return; + } + + switch (inpkt->implementation) { + case IMPL_XNTPD: + client_v6_capable = 1; + break; + case IMPL_XNTPD_OLD: + client_v6_capable = 0; + break; + default: + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + return; + } + /* * If we need to authenticate, do so. Note that an * authenticatable packet must include a mac field, must @@ -465,18 +536,32 @@ process_private( l_fp ftmp; double dtemp; + if (rbufp->recv_length < (int)((REQ_LEN_HDR + + (INFO_ITEMSIZE(inpkt->mbz_itemsize) * + INFO_NITEMS(inpkt->err_nitems)) + + sizeof(struct req_pkt_tail)))) { + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + } + tailinpkt = (struct req_pkt_tail *)((char *)&rbufp->recv_pkt + + rbufp->recv_length - sizeof(struct req_pkt_tail)); + /* * If this guy is restricted from doing this, don't let him * If wrong key was used, or packet doesn't have mac, return. */ if (!INFO_IS_AUTH(inpkt->auth_seq) || info_auth_keyid == 0 - || ntohl(inpkt->keyid) != info_auth_keyid) { + || ntohl(tailinpkt->keyid) != info_auth_keyid) { #ifdef DEBUG if (debug > 4) printf("failed auth %d info_auth_keyid %lu pkt keyid %lu\n", - INFO_IS_AUTH(inpkt->auth_seq), - (u_long)info_auth_keyid, - (u_long)ntohl(inpkt->keyid)); + INFO_IS_AUTH(inpkt->auth_seq), + (u_long)info_auth_keyid, + (u_long)ntohl(tailinpkt->keyid)); + msyslog(LOG_DEBUG, + "process_private: failed auth %d info_auth_keyid %lu pkt keyid %lu\n", + INFO_IS_AUTH(inpkt->auth_seq), + (u_long)info_auth_keyid, + (u_long)ntohl(tailinpkt->keyid)); #endif req_ack(srcadr, inter, inpkt, INFO_ERR_AUTH); return; @@ -487,8 +572,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); + msyslog(LOG_ERR, "process_private: bad pkt length %d", + rbufp->recv_length); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -496,6 +581,9 @@ process_private( #ifdef DEBUG if (debug > 4) printf("failed auth mod_okay %d\n", mod_okay); + msyslog(LOG_DEBUG, + "process_private: failed auth mod_okay %d\n", + mod_okay); #endif req_ack(srcadr, inter, inpkt, INFO_ERR_AUTH); return; @@ -505,13 +593,17 @@ process_private( * calculate absolute time difference between xmit time stamp * and receive time stamp. If too large, too bad. */ - NTOHL_FP(&inpkt->tstamp, &ftmp); + NTOHL_FP(&tailinpkt->tstamp, &ftmp); L_SUB(&ftmp, &rbufp->recv_time); LFPTOD(&ftmp, dtemp); if (fabs(dtemp) >= INFO_TS_MAXSKEW) { /* * He's a loser. Tell him. */ +#ifdef DEBUG + if (debug > 4) + printf("xmit/rcv timestamp delta > INFO_TS_MAXSKEW\n"); +#endif req_ack(srcadr, inter, inpkt, INFO_ERR_AUTH); return; } @@ -520,32 +612,17 @@ process_private( * So far so good. See if decryption works out okay. */ if (!authdecrypt(info_auth_keyid, (u_int32 *)inpkt, - REQ_LEN_NOMAC, (int)(rbufp->recv_length - REQ_LEN_NOMAC))) { + rbufp->recv_length - sizeof(struct req_pkt_tail) + + REQ_LEN_HDR, sizeof(struct req_pkt_tail) - REQ_LEN_HDR)) { +#ifdef DEBUG + if (debug > 4) + printf("authdecrypt failed\n"); +#endif req_ack(srcadr, inter, inpkt, INFO_ERR_AUTH); return; } } - /* - * If we need data, check to see if we have some. If we - * 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"); @@ -563,7 +640,7 @@ process_private( */ static void peer_list( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -571,26 +648,44 @@ peer_list( register struct info_peer_list *ip; register struct peer *pp; register int i; + register int skip = 0; ip = (struct info_peer_list *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_peer_list)); + v6sizeof(struct info_peer_list)); for (i = 0; i < HASH_SIZE && ip != 0; i++) { pp = peer_hash[i]; while (pp != 0 && ip != 0) { - ip->address = pp->srcadr.sin_addr.s_addr; - ip->port = pp->srcadr.sin_port; - ip->hmode = pp->hmode; - ip->flags = 0; - if (pp->flags & FLAG_CONFIG) - ip->flags |= INFO_FLAG_CONFIG; - if (pp == sys_peer) - ip->flags |= INFO_FLAG_SYSPEER; - if (pp->status == CTL_PST_SEL_SYNCCAND) - ip->flags |= INFO_FLAG_SEL_CANDIDATE; - if (pp->status >= CTL_PST_SEL_SYSPEER) - ip->flags |= INFO_FLAG_SHORTLIST; - ip = (struct info_peer_list *)more_pkt(); - pp = pp->next; + if (pp->srcadr.ss_family == AF_INET6) { + if (client_v6_capable) { + ip->addr6 = GET_INADDR6(pp->srcadr); + ip->v6_flag = 1; + skip = 0; + } else { + skip = 1; + break; + } + } else { + ip->addr = GET_INADDR(pp->srcadr); + if (client_v6_capable) + ip->v6_flag = 0; + skip = 0; + } + + if(!skip) { + ip->port = NSRCPORT(&pp->srcadr); + ip->hmode = pp->hmode; + ip->flags = 0; + if (pp->flags & FLAG_CONFIG) + ip->flags |= INFO_FLAG_CONFIG; + if (pp == sys_peer) + ip->flags |= INFO_FLAG_SYSPEER; + if (pp->status == CTL_PST_SEL_SYNCCAND) + ip->flags |= INFO_FLAG_SEL_CANDIDATE; + if (pp->status >= CTL_PST_SEL_SYSPEER) + ip->flags |= INFO_FLAG_SHORTLIST; + ip = (struct info_peer_list *)more_pkt(); + } + pp = pp->next; } } flush_pkt(); @@ -602,7 +697,7 @@ peer_list( */ static void peer_list_sum( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -611,14 +706,14 @@ peer_list_sum( register struct peer *pp; register int i; l_fp ltmp; + register int skip; #ifdef DEBUG if (debug > 2) printf("wants peer list summary\n"); #endif - ips = (struct info_peer_summary *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_peer_summary)); + v6sizeof(struct info_peer_summary)); for (i = 0; i < HASH_SIZE && ips != 0; i++) { pp = peer_hash[i]; while (pp != 0 && ips != 0) { @@ -626,46 +721,66 @@ 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->srcadr = pp->srcadr.sin_addr.s_addr; - ips->srcport = pp->srcadr.sin_port; - ips->stratum = pp->stratum; - ips->hpoll = pp->hpoll; - ips->ppoll = pp->ppoll; - ips->reach = pp->reach; - ips->flags = 0; - if (pp == sys_peer) - ips->flags |= INFO_FLAG_SYSPEER; - if (pp->flags & FLAG_CONFIG) - ips->flags |= INFO_FLAG_CONFIG; - if (pp->flags & FLAG_REFCLOCK) - ips->flags |= INFO_FLAG_REFCLOCK; - if (pp->flags & FLAG_AUTHENABLE) - ips->flags |= INFO_FLAG_AUTHENABLE; - if (pp->flags & FLAG_PREFER) - ips->flags |= INFO_FLAG_PREFER; - if (pp->flags & FLAG_BURST) - ips->flags |= INFO_FLAG_BURST; - if (pp->status == CTL_PST_SEL_SYNCCAND) - ips->flags |= INFO_FLAG_SEL_CANDIDATE; - if (pp->status >= CTL_PST_SEL_SYSPEER) - ips->flags |= INFO_FLAG_SHORTLIST; - ips->hmode = pp->hmode; - ips->delay = HTONS_FP(DTOFP(pp->delay)); - DTOLFP(pp->offset, <mp); - HTONL_FP(<mp, &ips->offset); - ips->dispersion = HTONS_FP(DTOUFP(pp->disp)); + /* + * Be careful here not to return v6 peers when we + * want only v4. + */ + if (pp->srcadr.ss_family == AF_INET6) { + if (client_v6_capable) { + ips->srcadr6 = GET_INADDR6(pp->srcadr); + ips->v6_flag = 1; + ips->dstadr6 = GET_INADDR6(pp->dstadr->sin); + skip = 0; + } else { + skip = 1; + break; + } + } else { + ips->srcadr = GET_INADDR(pp->srcadr); + if (client_v6_capable) + ips->v6_flag = 0; +/* XXX PDM This code is buggy. Need to replace with a straightforward assignment */ + ips->dstadr = (pp->processed) ? + pp->cast_flags == MDF_BCAST ? + GET_INADDR(pp->dstadr->bcast): + pp->cast_flags ? + GET_INADDR(pp->dstadr->sin) ? + GET_INADDR(pp->dstadr->sin): + GET_INADDR(pp->dstadr->bcast): + 1 : GET_INADDR(pp->dstadr->sin); - pp = pp->next; + skip = 0; + } + if (!skip){ + ips->srcport = NSRCPORT(&pp->srcadr); + ips->stratum = pp->stratum; + ips->hpoll = pp->hpoll; + ips->ppoll = pp->ppoll; + ips->reach = pp->reach; + ips->flags = 0; + if (pp == sys_peer) + ips->flags |= INFO_FLAG_SYSPEER; + if (pp->flags & FLAG_CONFIG) + ips->flags |= INFO_FLAG_CONFIG; + if (pp->flags & FLAG_REFCLOCK) + ips->flags |= INFO_FLAG_REFCLOCK; + if (pp->flags & FLAG_AUTHENABLE) + ips->flags |= INFO_FLAG_AUTHENABLE; + if (pp->flags & FLAG_PREFER) + ips->flags |= INFO_FLAG_PREFER; + if (pp->flags & FLAG_BURST) + ips->flags |= INFO_FLAG_BURST; + if (pp->status == CTL_PST_SEL_SYNCCAND) + ips->flags |= INFO_FLAG_SEL_CANDIDATE; + if (pp->status >= CTL_PST_SEL_SYSPEER) + ips->flags |= INFO_FLAG_SHORTLIST; + ips->hmode = pp->hmode; + ips->delay = HTONS_FP(DTOFP(pp->delay)); + DTOLFP(pp->offset, <mp); + HTONL_FP(<mp, &ips->offset); + ips->dispersion = HTONS_FP(DTOUFP(pp->disp)); + } + pp = pp->next; ips = (struct info_peer_summary *)more_pkt(); } } @@ -678,7 +793,7 @@ peer_list_sum( */ static void peer_info ( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -688,33 +803,53 @@ peer_info ( register struct info_peer *ip; register int items; register int i, j; - struct sockaddr_in addr; + struct sockaddr_storage addr; extern struct peer *sys_peer; l_fp ltmp; memset((char *)&addr, 0, sizeof addr); - addr.sin_family = AF_INET; items = INFO_NITEMS(inpkt->err_nitems); ipl = (struct info_peer_list *) inpkt->data; + ip = (struct info_peer *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_peer)); + v6sizeof(struct info_peer)); while (items-- > 0 && ip != 0) { - addr.sin_port = ipl->port; - addr.sin_addr.s_addr = ipl->address; + memset((char *)&addr, 0, sizeof(addr)); + NSRCPORT(&addr) = ipl->port; + if (client_v6_capable && ipl->v6_flag != 0) { + addr.ss_family = AF_INET6; + GET_INADDR6(addr) = ipl->addr6; + } else { + addr.ss_family = AF_INET; + GET_INADDR(addr) = ipl->addr; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + addr.ss_len = SOCKLEN(&addr); +#endif 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->srcadr = NSRCADR(&pp->srcadr); + if (pp->srcadr.ss_family == AF_INET6) { + ip->dstadr6 = pp->cast_flags == MDF_BCAST ? + GET_INADDR6(pp->dstadr->bcast) : + GET_INADDR6(pp->dstadr->sin); + ip->srcadr6 = GET_INADDR6(pp->srcadr); + ip->v6_flag = 1; + } else { +/* XXX PDM This code is buggy. Need to replace with a straightforward assignment */ + ip->dstadr = (pp->processed) ? + pp->cast_flags == MDF_BCAST ? + GET_INADDR(pp->dstadr->bcast): + pp->cast_flags ? + GET_INADDR(pp->dstadr->sin) ? + GET_INADDR(pp->dstadr->sin): + GET_INADDR(pp->dstadr->bcast): + 2 : GET_INADDR(pp->dstadr->sin); + + ip->srcadr = GET_INADDR(pp->srcadr); + if (client_v6_capable) + ip->v6_flag = 0; + } ip->srcport = NSRCPORT(&pp->srcadr); ip->flags = 0; if (pp == sys_peer) @@ -741,11 +876,10 @@ 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->unreach = (u_char) pp->unreach; ip->flash = (u_char)pp->flash; - ip->flash2 = pp->flash; + ip->flash2 = (u_short) pp->flash; ip->estbdelay = HTONS_FP(DTOFP(pp->estbdelay)); ip->ttl = pp->ttl; ip->associd = htons(pp->associd); @@ -763,8 +897,8 @@ peer_info ( ip->filtdelay[i] = HTONS_FP(DTOFP(pp->filter_delay[j])); DTOLFP(pp->filter_offset[j], <mp); HTONL_FP(<mp, &ip->filtoffset[i]); - ip->order[i] = (pp->filter_nextpt+NTP_SHIFT-1) - - pp->filter_order[i]; + ip->order[i] = (u_char)((pp->filter_nextpt+NTP_SHIFT-1) + - pp->filter_order[i]); if (ip->order[i] >= NTP_SHIFT) ip->order[i] -= NTP_SHIFT; } @@ -772,7 +906,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(); @@ -784,7 +918,7 @@ peer_info ( */ static void peer_stats ( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -793,32 +927,54 @@ peer_stats ( register struct peer *pp; register struct info_peer_stats *ip; register int items; - struct sockaddr_in addr; + struct sockaddr_storage addr; extern struct peer *sys_peer; - memset((char *)&addr, 0, sizeof addr); - addr.sin_family = AF_INET; + printf("peer_stats: called\n"); items = INFO_NITEMS(inpkt->err_nitems); ipl = (struct info_peer_list *) inpkt->data; ip = (struct info_peer_stats *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_peer_stats)); + v6sizeof(struct info_peer_stats)); while (items-- > 0 && ip != 0) { - addr.sin_port = ipl->port; - addr.sin_addr.s_addr = ipl->address; - ipl++; + memset((char *)&addr, 0, sizeof(addr)); + NSRCPORT(&addr) = ipl->port; + if (client_v6_capable && ipl->v6_flag) { + addr.ss_family = AF_INET6; + GET_INADDR6(addr) = ipl->addr6; + } else { + addr.ss_family = AF_INET; + GET_INADDR(addr) = ipl->addr; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + addr.ss_len = SOCKLEN(&addr); +#endif + printf("peer_stats: looking for %s, %d, %d\n", stoa(&addr), + ipl->port, ((struct sockaddr_in6 *)&addr)->sin6_port); + ipl = (struct info_peer_list *)((char *)ipl + + INFO_ITEMSIZE(inpkt->mbz_itemsize)); + 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->srcadr = NSRCADR(&pp->srcadr); + printf("peer_stats: found %s\n", stoa(&addr)); + if (pp->srcadr.ss_family == AF_INET) { + ip->dstadr = (pp->processed) ? + pp->cast_flags == MDF_BCAST ? + GET_INADDR(pp->dstadr->bcast): + pp->cast_flags ? + GET_INADDR(pp->dstadr->sin) ? + GET_INADDR(pp->dstadr->sin): + GET_INADDR(pp->dstadr->bcast): + 3 : 7; + ip->srcadr = GET_INADDR(pp->srcadr); + if (client_v6_capable) + ip->v6_flag = 0; + } else { + ip->dstadr6 = pp->cast_flags == MDF_BCAST ? + GET_INADDR6(pp->dstadr->bcast): + GET_INADDR6(pp->dstadr->sin); + ip->srcadr6 = GET_INADDR6(pp->srcadr); + ip->v6_flag = 1; + } ip->srcport = NSRCPORT(&pp->srcadr); ip->flags = 0; if (pp == sys_peer) @@ -859,7 +1015,7 @@ peer_stats ( */ static void sys_info( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -882,24 +1038,35 @@ 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)); + v6sizeof(struct info_sys)); if (sys_peer != 0) { - is->peer = NSRCADR(&sys_peer->srcadr); + if (sys_peer->srcadr.ss_family == AF_INET) { + is->peer = GET_INADDR(sys_peer->srcadr); + if (client_v6_capable) + is->v6_flag = 0; + } else if (client_v6_capable) { + is->peer6 = GET_INADDR6(sys_peer->srcadr); + is->v6_flag = 1; + } is->peer_mode = sys_peer->hmode; } else { is->peer = 0; + if (client_v6_capable) { + is->v6_flag = 0; + } is->peer_mode = 0; } + is->leap = sys_leap; is->stratum = sys_stratum; 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); @@ -907,22 +1074,24 @@ sys_info( is->poll = sys_poll; is->flags = 0; - if (sys_bclient) - is->flags |= INFO_FLAG_BCLIENT; if (sys_authenticate) - is->flags |= INFO_FLAG_AUTHENTICATE; + is->flags |= INFO_FLAG_AUTHENTICATE; + if (sys_bclient) + is->flags |= INFO_FLAG_BCLIENT; +#ifdef REFCLOCK + if (cal_enable) + is->flags |= INFO_FLAG_CAL; +#endif /* REFCLOCK */ if (kern_enable) - is->flags |= INFO_FLAG_KERNEL; - if (ntp_enable) - is->flags |= INFO_FLAG_NTP; - if (pll_control) - is->flags |= INFO_FLAG_PLL_SYNC; - if (pps_control) - is->flags |= INFO_FLAG_PPS_SYNC; + is->flags |= INFO_FLAG_KERNEL; if (mon_enabled != MON_OFF) - is->flags |= INFO_FLAG_MONITOR; + is->flags |= INFO_FLAG_MONITOR; + if (ntp_enable) + is->flags |= INFO_FLAG_NTP; + if (pps_enable) + is->flags |= INFO_FLAG_PPS_SYNC; if (stats_control) - is->flags |= INFO_FLAG_FILEGEN; + is->flags |= INFO_FLAG_FILEGEN; is->bdelay = HTONS_FP(DTOFP(sys_bdelay)); HTONL_UF(sys_authdelay.l_f, &is->authdelay); @@ -936,7 +1105,7 @@ sys_info( */ static void sys_stats( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -946,22 +1115,11 @@ sys_stats( /* * Importations from the protocol module */ - extern u_long sys_stattime; - extern u_long sys_badstratum; - extern u_long sys_oldversionpkt; - extern u_long sys_newversionpkt; - extern u_long sys_unknownversion; - extern u_long sys_badlength; - extern u_long sys_processed; - extern u_long sys_badauth; - extern u_long sys_limitrejected; - ss = (struct info_sys_stats *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_sys_stats)); - + sizeof(struct info_sys_stats)); ss->timeup = htonl((u_int32)current_time); ss->timereset = htonl((u_int32)(current_time - sys_stattime)); - ss->badstratum = htonl((u_int32)sys_badstratum); + ss->denied = htonl((u_int32)sys_restricted); ss->oldversionpkt = htonl((u_int32)sys_oldversionpkt); ss->newversionpkt = htonl((u_int32)sys_newversionpkt); ss->unknownversion = htonl((u_int32)sys_unknownversion); @@ -969,6 +1127,7 @@ sys_stats( ss->processed = htonl((u_int32)sys_processed); ss->badauth = htonl((u_int32)sys_badauth); ss->limitrejected = htonl((u_int32)sys_limitrejected); + ss->received = htonl((u_int32)sys_received); (void) more_pkt(); flush_pkt(); } @@ -979,7 +1138,7 @@ sys_stats( */ static void mem_stats( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1025,7 +1184,7 @@ mem_stats( */ static void io_stats( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1063,7 +1222,7 @@ io_stats( */ static void timer_stats( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1095,7 +1254,7 @@ timer_stats( */ static void loop_info( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1131,15 +1290,17 @@ loop_info( */ static void do_conf( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) { - register struct conf_peer *cp; - register int items; - struct sockaddr_in peeraddr; - int fl; + int items; + u_int fl; + struct conf_peer *cp; + struct conf_peer temp_cp; + struct sockaddr_storage peeraddr; + struct sockaddr_in tmp_clock; /* * Do a check of everything to see that it looks @@ -1148,24 +1309,25 @@ do_conf( */ items = INFO_NITEMS(inpkt->err_nitems); cp = (struct conf_peer *)inpkt->data; - + memset(&temp_cp, 0, sizeof(struct conf_peer)); + memcpy(&temp_cp, (char *)cp, INFO_ITEMSIZE(inpkt->mbz_itemsize)); fl = 0; while (items-- > 0 && !fl) { - if (((cp->version) > NTP_VERSION) - || ((cp->version) < NTP_OLDVERSION)) + if (((temp_cp.version) > NTP_VERSION) + || ((temp_cp.version) < NTP_OLDVERSION)) fl = 1; - if (cp->hmode != MODE_ACTIVE - && cp->hmode != MODE_CLIENT - && cp->hmode != MODE_BROADCAST) + if (temp_cp.hmode != MODE_ACTIVE + && temp_cp.hmode != MODE_CLIENT + && temp_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 (temp_cp.flags & ~(CONF_FLAG_AUTHENABLE | CONF_FLAG_PREFER + | CONF_FLAG_BURST | CONF_FLAG_SKEY)) fl = 1; - cp++; + cp = (struct conf_peer *) + ((char *)cp + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } if (fl) { - msyslog(LOG_ERR, "do_conf: fl is nonzero!"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1174,61 +1336,70 @@ do_conf( * Looks okay, try it out */ items = INFO_NITEMS(inpkt->err_nitems); - cp = (struct conf_peer *)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, "do_conf: !ISREFCLOCK && ISBADADR"); -#else - msyslog(LOG_ERR, "do_conf: ISBADADR"); -#endif - req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); - return; - } + cp = (struct conf_peer *)inpkt->data; while (items-- > 0) { + memset(&temp_cp, 0, sizeof(struct conf_peer)); + memcpy(&temp_cp, (char *)cp, INFO_ITEMSIZE(inpkt->mbz_itemsize)); + memset((char *)&peeraddr, 0, sizeof(struct sockaddr_storage)); + fl = 0; - if (cp->flags & CONF_FLAG_AUTHENABLE) + if (temp_cp.flags & CONF_FLAG_AUTHENABLE) fl |= FLAG_AUTHENABLE; - if (cp->flags & CONF_FLAG_PREFER) + if (temp_cp.flags & CONF_FLAG_PREFER) fl |= FLAG_PREFER; - if (cp->flags & CONF_FLAG_NOSELECT) - fl |= FLAG_NOSELECT; - if (cp->flags & CONF_FLAG_BURST) + if (temp_cp.flags & CONF_FLAG_BURST) fl |= FLAG_BURST; - if (cp->flags & CONF_FLAG_SKEY) + if (temp_cp.flags & CONF_FLAG_SKEY) fl |= FLAG_SKEY; - peeraddr.sin_addr.s_addr = cp->peeraddr; + if (client_v6_capable && temp_cp.v6_flag != 0) { + peeraddr.ss_family = AF_INET6; + GET_INADDR6(peeraddr) = temp_cp.peeraddr6; + } else { + peeraddr.ss_family = AF_INET; + GET_INADDR(peeraddr) = temp_cp.peeraddr; + /* + * Make sure the address is valid + */ + tmp_clock = *CAST_V4(peeraddr); + if ( +#ifdef REFCLOCK + !ISREFCLOCKADR(&tmp_clock) && +#endif + ISBADADR(&tmp_clock)) { + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + return; + } + + } + NSRCPORT(&peeraddr) = htons(NTP_PORT); +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + peeraddr.ss_len = SOCKLEN(&peeraddr); +#endif + /* 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, cp->keystr) == 0) { + temp_cp.hmode, temp_cp.version, temp_cp.minpoll, + temp_cp.maxpoll, fl, temp_cp.ttl, temp_cp.keyid, + NULL) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } - cp++; + cp = (struct conf_peer *) + ((char *)cp + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } req_ack(srcadr, inter, inpkt, INFO_OKAY); } - +#if 0 +/* XXX */ /* * dns_a - Snarf DNS info for an association ID */ static void dns_a( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1272,13 +1443,13 @@ dns_a( } while (items-- > 0) { - u_short associd; + associd_t associd; size_t hnl; struct peer *peer; int bogon = 0; associd = dp->associd; - peer = findpeerbyassoc((int)associd); + peer = findpeerbyassoc(associd); if (peer == 0 || peer->flags & FLAG_REFCLOCK) { msyslog(LOG_ERR, "dns_a: %s", (peer == 0) @@ -1295,40 +1466,44 @@ dns_a( } msyslog(LOG_INFO, "dns_a: <%s> for %s, AssocID %d, bogon %d", - dp->hostname, inet_ntoa(peeraddr.sin_addr), associd, + dp->hostname, + stoa((struct sockaddr_storage *)&peeraddr), 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); } - +#endif /* 0 */ /* * do_unconf - remove a peer from the configuration list */ static void do_unconf( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) { register struct conf_unpeer *cp; + struct conf_unpeer temp_cp; register int items; register struct peer *peer; - struct sockaddr_in peeraddr; + struct sockaddr_storage peeraddr; int bad, found; /* @@ -1337,17 +1512,28 @@ do_unconf( * configured. If so, we remove them. If not, we return * an error. */ - peeraddr.sin_family = AF_INET; - peeraddr.sin_port = htons(NTP_PORT); - items = INFO_NITEMS(inpkt->err_nitems); cp = (struct conf_unpeer *)inpkt->data; bad = 0; while (items-- > 0 && !bad) { - peeraddr.sin_addr.s_addr = cp->peeraddr; + memset(&temp_cp, 0, sizeof(temp_cp)); + memset(&peeraddr, 0, sizeof(peeraddr)); + memcpy(&temp_cp, cp, INFO_ITEMSIZE(inpkt->mbz_itemsize)); + if (client_v6_capable && temp_cp.v6_flag != 0) { + peeraddr.ss_family = AF_INET6; + GET_INADDR6(peeraddr) = temp_cp.peeraddr6; + } else { + peeraddr.ss_family = AF_INET; + GET_INADDR(peeraddr) = temp_cp.peeraddr; + } + NSRCPORT(&peeraddr) = htons(NTP_PORT); +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + peeraddr.ss_len = SOCKLEN(&peeraddr); +#endif found = 0; peer = (struct peer *)0; + printf("searching for %s\n", stoa(&peeraddr)); while (!found) { peer = findexistingpeer(&peeraddr, peer, -1); if (peer == (struct peer *)0) @@ -1357,7 +1543,8 @@ do_unconf( } if (!found) bad = 1; - cp++; + cp = (struct conf_unpeer *) + ((char *)cp + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } if (bad) { @@ -1372,9 +1559,23 @@ do_unconf( items = INFO_NITEMS(inpkt->err_nitems); cp = (struct conf_unpeer *)inpkt->data; while (items-- > 0) { - peeraddr.sin_addr.s_addr = cp->peeraddr; + memset(&temp_cp, 0, sizeof(temp_cp)); + memset(&peeraddr, 0, sizeof(peeraddr)); + memcpy(&temp_cp, cp, INFO_ITEMSIZE(inpkt->mbz_itemsize)); + if (client_v6_capable && temp_cp.v6_flag != 0) { + peeraddr.ss_family = AF_INET6; + GET_INADDR6(peeraddr) = temp_cp.peeraddr6; + } else { + peeraddr.ss_family = AF_INET; + GET_INADDR(peeraddr) = temp_cp.peeraddr; + } + NSRCPORT(&peeraddr) = htons(NTP_PORT); +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + peeraddr.ss_len = SOCKLEN(&peeraddr); +#endif peer_unconfig(&peeraddr, (struct interface *)0, -1); - cp++; + cp = (struct conf_unpeer *) + ((char *)cp + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } req_ack(srcadr, inter, inpkt, INFO_OKAY); @@ -1386,7 +1587,7 @@ do_unconf( */ static void set_sys_flag( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1400,7 +1601,7 @@ set_sys_flag( */ static void clr_sys_flag( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1414,13 +1615,13 @@ clr_sys_flag( */ static void setclr_flags( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt, 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"); @@ -1430,29 +1631,34 @@ setclr_flags( 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: %#lx", - flags & ~(SYS_FLAG_BCLIENT | SYS_FLAG_AUTHENTICATE | + SYS_FLAG_FILEGEN | SYS_FLAG_AUTH | SYS_FLAG_CAL)) { + 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)); + SYS_FLAG_MONITOR | SYS_FLAG_FILEGEN | + SYS_FLAG_AUTH | SYS_FLAG_CAL)); 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.); + proto_config(PROTO_BROADCLIENT, set, 0., NULL); + if (flags & SYS_FLAG_PPS) + proto_config(PROTO_PPS, set, 0., NULL); if (flags & SYS_FLAG_NTP) - proto_config(PROTO_NTP, set, 0.); + proto_config(PROTO_NTP, set, 0., NULL); if (flags & SYS_FLAG_KERNEL) - proto_config(PROTO_KERNEL, set, 0.); + proto_config(PROTO_KERNEL, set, 0., NULL); if (flags & SYS_FLAG_MONITOR) - proto_config(PROTO_MONITOR, set, 0.); + proto_config(PROTO_MONITOR, set, 0., NULL); if (flags & SYS_FLAG_FILEGEN) - proto_config(PROTO_FILEGEN, set, 0.); + proto_config(PROTO_FILEGEN, set, 0., NULL); + if (flags & SYS_FLAG_AUTH) + proto_config(PROTO_AUTHENTICATE, set, 0., NULL); + if (flags & SYS_FLAG_CAL) + proto_config(PROTO_CAL, set, 0., NULL); req_ack(srcadr, inter, inpkt, INFO_OKAY); } @@ -1462,30 +1668,43 @@ setclr_flags( */ static void list_restrict( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) { register struct info_restrict *ir; register struct restrictlist *rl; - extern struct restrictlist *restrictlist; + register struct restrictlist6 *rl6; #ifdef DEBUG if (debug > 2) - printf("wants peer list summary\n"); + printf("wants restrict list summary\n"); #endif ir = (struct info_restrict *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_restrict)); + v6sizeof(struct info_restrict)); + for (rl = restrictlist; rl != 0 && ir != 0; rl = rl->next) { ir->addr = htonl(rl->addr); + if (client_v6_capable) + ir->v6_flag = 0; ir->mask = htonl(rl->mask); ir->count = htonl((u_int32)rl->count); ir->flags = htons(rl->flags); ir->mflags = htons(rl->mflags); ir = (struct info_restrict *)more_pkt(); } + if (client_v6_capable) + for (rl6 = restrictlist6; rl6 != 0 && ir != 0; rl6 = rl6->next) { + ir->addr6 = rl6->addr6; + ir->mask6 = rl6->mask6; + ir->v6_flag = 1; + ir->count = htonl((u_int32)rl6->count); + ir->flags = htons(rl6->flags); + ir->mflags = htons(rl6->mflags); + ir = (struct info_restrict *)more_pkt(); + } flush_pkt(); } @@ -1496,7 +1715,7 @@ list_restrict( */ static void do_resaddflags( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1511,7 +1730,7 @@ do_resaddflags( */ static void do_ressubflags( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1525,7 +1744,7 @@ do_ressubflags( */ static void do_unrestrict( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1542,7 +1761,7 @@ do_unrestrict( */ static void do_restrict( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt, int op @@ -1550,8 +1769,8 @@ do_restrict( { register struct conf_restrict *cr; register int items; - struct sockaddr_in matchaddr; - struct sockaddr_in matchmask; + struct sockaddr_storage matchaddr; + struct sockaddr_storage matchmask; int bad; /* @@ -1568,9 +1787,16 @@ do_restrict( bad |= 1; if (cr->flags & ~(RES_ALLFLAGS)) bad |= 2; - if (cr->addr == htonl(INADDR_ANY) && cr->mask != htonl(INADDR_ANY)) - bad |= 4; - cr++; + if (cr->mask != htonl(INADDR_ANY)) { + if (client_v6_capable && cr->v6_flag != 0) { + if (IN6_IS_ADDR_UNSPECIFIED(&cr->addr6)) + bad |= 4; + } else + if (cr->addr == htonl(INADDR_ANY)) + bad |= 8; + } + cr = (struct conf_restrict *)((char *)cr + + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } if (bad) { @@ -1584,14 +1810,21 @@ do_restrict( */ items = INFO_NITEMS(inpkt->err_nitems); cr = (struct conf_restrict *)inpkt->data; - memset((char *)&matchaddr, 0, sizeof(struct sockaddr_in)); - memset((char *)&matchmask, 0, sizeof(struct sockaddr_in)); - matchaddr.sin_family = AF_INET; - matchmask.sin_family = AF_INET; + memset((char *)&matchaddr, 0, sizeof(struct sockaddr_storage)); + memset((char *)&matchmask, 0, sizeof(struct sockaddr_storage)); while (items-- > 0) { - matchaddr.sin_addr.s_addr = cr->addr; - matchmask.sin_addr.s_addr = cr->mask; + if (client_v6_capable && cr->v6_flag != 0) { + GET_INADDR6(matchaddr) = cr->addr6; + GET_INADDR6(matchmask) = cr->mask6; + matchaddr.ss_family = AF_INET6; + matchmask.ss_family = AF_INET6; + } else { + GET_INADDR(matchaddr) = cr->addr; + GET_INADDR(matchmask) = cr->mask; + matchaddr.ss_family = AF_INET; + matchmask.ss_family = AF_INET; + } hack_restrict(op, &matchaddr, &matchmask, cr->mflags, cr->flags); cr++; @@ -1606,7 +1839,7 @@ do_restrict( */ static void mon_getlist_0( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1624,19 +1857,24 @@ mon_getlist_0( req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } - im = (struct info_monitor *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_monitor)); + v6sizeof(struct info_monitor)); for (md = mon_mru_list.mru_next; md != &mon_mru_list && im != 0; md = md->mru_next) { - im->lasttime = htonl((u_int32)(current_time - md->lasttime)); - im->firsttime = htonl((u_int32)(current_time - md->firsttime)); - if (md->lastdrop) - im->lastdrop = htonl((u_int32)(current_time - md->lastdrop)); - else - im->lastdrop = 0; + im->lasttime = htonl((u_int32)md->avg_interval); + im->firsttime = htonl((u_int32)(current_time - md->lasttime)); + im->lastdrop = htonl((u_int32)md->drop_count); im->count = htonl((u_int32)(md->count)); - im->addr = md->rmtadr; + if (md->rmtadr.ss_family == AF_INET6) { + if (!client_v6_capable) + continue; + im->addr6 = GET_INADDR6(md->rmtadr); + im->v6_flag = 1; + } else { + im->addr = GET_INADDR(md->rmtadr); + if (client_v6_capable) + im->v6_flag = 0; + } im->port = md->rmtport; im->mode = md->mode; im->version = md->version; @@ -1650,7 +1888,7 @@ mon_getlist_0( */ static void mon_getlist_1( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1660,36 +1898,36 @@ mon_getlist_1( extern struct mon_data mon_mru_list; extern int mon_enabled; -#ifdef DEBUG - if (debug > 2) - printf("wants monitor 1 list\n"); -#endif if (!mon_enabled) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } - im = (struct info_monitor_1 *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_monitor_1)); + v6sizeof(struct info_monitor_1)); for (md = mon_mru_list.mru_next; md != &mon_mru_list && im != 0; md = md->mru_next) { - im->lasttime = htonl((u_int32)(current_time - md->lasttime)); - im->firsttime = htonl((u_int32)(current_time - md->firsttime)); - if (md->lastdrop) - im->lastdrop = htonl((u_int32)(current_time - md->lastdrop)); - else - im->lastdrop = 0; + im->lasttime = htonl((u_int32)md->avg_interval); + im->firsttime = htonl((u_int32)(current_time - md->lasttime)); + im->lastdrop = htonl((u_int32)md->drop_count); im->count = htonl((u_int32)md->count); - im->addr = md->rmtadr; - im->daddr = - (md->cast_flags == MDF_BCAST) - ? md->interface->bcast.sin_addr.s_addr - : (md->cast_flags - ? (md->interface->sin.sin_addr.s_addr - ? md->interface->sin.sin_addr.s_addr - : md->interface->bcast.sin_addr.s_addr - ) - : 4); + if (md->rmtadr.ss_family == AF_INET6) { + if (!client_v6_capable) + continue; + im->addr6 = GET_INADDR6(md->rmtadr); + im->v6_flag = 1; + im->daddr6 = GET_INADDR6(md->interface->sin); + } else { + im->addr = GET_INADDR(md->rmtadr); + if (client_v6_capable) + im->v6_flag = 0; + im->daddr = (md->cast_flags == MDF_BCAST) + ? GET_INADDR(md->interface->bcast) + : (md->cast_flags + ? (GET_INADDR(md->interface->sin) + ? GET_INADDR(md->interface->sin) + : GET_INADDR(md->interface->bcast)) + : 4); + } im->flags = md->cast_flags; im->port = md->rmtport; im->mode = md->mode; @@ -1723,7 +1961,7 @@ struct reset_entry reset_entries[] = { */ static void reset_stats( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1759,7 +1997,7 @@ reset_stats( */ static void reset_peer( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1767,26 +2005,36 @@ reset_peer( register struct conf_unpeer *cp; register int items; register struct peer *peer; - struct sockaddr_in peeraddr; + struct sockaddr_storage peeraddr; int bad; /* * We check first to see that every peer exists. If not, * we return an error. */ - peeraddr.sin_family = AF_INET; - peeraddr.sin_port = htons(NTP_PORT); items = INFO_NITEMS(inpkt->err_nitems); cp = (struct conf_unpeer *)inpkt->data; bad = 0; while (items-- > 0 && !bad) { - peeraddr.sin_addr.s_addr = cp->peeraddr; + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + if (client_v6_capable && cp->v6_flag != 0) { + GET_INADDR6(peeraddr) = cp->peeraddr6; + peeraddr.ss_family = AF_INET6; + } else { + GET_INADDR(peeraddr) = cp->peeraddr; + peeraddr.ss_family = AF_INET; + } + NSRCPORT(&peeraddr) = htons(NTP_PORT); +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + peeraddr.ss_len = SOCKLEN(&peeraddr); +#endif peer = findexistingpeer(&peeraddr, (struct peer *)0, -1); if (peer == (struct peer *)0) bad++; - cp++; + cp = (struct conf_unpeer *)((char *)cp + + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } if (bad) { @@ -1801,13 +2049,24 @@ reset_peer( items = INFO_NITEMS(inpkt->err_nitems); cp = (struct conf_unpeer *)inpkt->data; while (items-- > 0) { - peeraddr.sin_addr.s_addr = cp->peeraddr; + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + if (client_v6_capable && cp->v6_flag != 0) { + GET_INADDR6(peeraddr) = cp->peeraddr6; + peeraddr.ss_family = AF_INET6; + } else { + GET_INADDR(peeraddr) = cp->peeraddr; + peeraddr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + peeraddr.ss_len = SOCKLEN(&peeraddr); +#endif peer = findexistingpeer(&peeraddr, (struct peer *)0, -1); while (peer != 0) { peer_reset(peer); peer = findexistingpeer(&peeraddr, (struct peer *)peer, -1); } - cp++; + cp = (struct conf_unpeer *)((char *)cp + + INFO_ITEMSIZE(inpkt->mbz_itemsize)); } req_ack(srcadr, inter, inpkt, INFO_OKAY); @@ -1819,7 +2078,7 @@ reset_peer( */ static void do_key_reread( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1834,7 +2093,7 @@ do_key_reread( */ static void trust_key( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1848,7 +2107,7 @@ trust_key( */ static void untrust_key( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1862,7 +2121,7 @@ untrust_key( */ static void do_trustkey( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt, u_long trust @@ -1887,7 +2146,7 @@ do_trustkey( */ static void get_auth_info( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1955,7 +2214,7 @@ reset_auth_stats(void) */ static void req_get_traps( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -1976,16 +2235,27 @@ req_get_traps( } it = (struct info_trap *)prepare_pkt(srcadr, inter, inpkt, - sizeof(struct info_trap)); + v6sizeof(struct info_trap)); for (i = 0, tr = ctl_trap; i < CTL_MAXTRAPS; i++, tr++) { if (tr->tr_flags & TRAP_INUSE) { - if (tr->tr_localaddr == any_interface) - it->local_address = 0; - else - it->local_address - = NSRCADR(&tr->tr_localaddr->sin); - it->trap_address = NSRCADR(&tr->tr_addr); + if (tr->tr_addr.ss_family == AF_INET) { + if (tr->tr_localaddr == any_interface) + it->local_address = 0; + else + it->local_address + = GET_INADDR(tr->tr_localaddr->sin); + it->trap_address = GET_INADDR(tr->tr_addr); + if (client_v6_capable) + it->v6_flag = 0; + } else { + if (!client_v6_capable) + continue; + it->local_address6 + = GET_INADDR6(tr->tr_localaddr->sin); + it->trap_address6 = GET_INADDR6(tr->tr_addr); + it->v6_flag = 1; + } it->trap_port = NSRCPORT(&tr->tr_addr); it->sequence = htons(tr->tr_sequence); it->settime = htonl((u_int32)(current_time - tr->tr_settime)); @@ -2004,7 +2274,7 @@ req_get_traps( */ static void req_set_trap( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2019,7 +2289,7 @@ req_set_trap( */ static void req_clr_trap( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2034,7 +2304,7 @@ req_clr_trap( */ static void do_setclr_trap( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt, int set @@ -2043,14 +2313,14 @@ do_setclr_trap( register struct conf_trap *ct; register struct interface *linter; int res; - struct sockaddr_in laddr; + struct sockaddr_storage laddr; /* - * Prepare sockaddr_in structure + * Prepare sockaddr_storage structure */ memset((char *)&laddr, 0, sizeof laddr); - laddr.sin_family = AF_INET; - laddr.sin_port = ntohs(NTP_PORT); + laddr.ss_family = srcadr->ss_family; + NSRCPORT(&laddr) = ntohs(NTP_PORT); /* * Restrict ourselves to one item only. This eliminates @@ -2069,7 +2339,10 @@ do_setclr_trap( if (ct->local_address == 0) { linter = any_interface; } else { - laddr.sin_addr.s_addr = ct->local_address; + if (laddr.ss_family == AF_INET) + GET_INADDR(laddr) = ct->local_address; + else + GET_INADDR6(laddr) = ct->local_address6; linter = findinterface(&laddr); if (linter == NULL) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); @@ -2077,11 +2350,14 @@ do_setclr_trap( } } - laddr.sin_addr.s_addr = ct->trap_address; - if (ct->trap_port != 0) - laddr.sin_port = ct->trap_port; + if (laddr.ss_family == AF_INET) + GET_INADDR(laddr) = ct->trap_address; else - laddr.sin_port = htons(TRAPPORT); + GET_INADDR6(laddr) = ct->trap_address6; + if (ct->trap_port != 0) + NSRCPORT(&laddr) = ct->trap_port; + else + NSRCPORT(&laddr) = htons(TRAPPORT); if (set) { res = ctlsettrap(&laddr, linter, 0, @@ -2105,7 +2381,7 @@ do_setclr_trap( */ static void set_request_keyid( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2133,7 +2409,7 @@ set_request_keyid( */ static void set_control_keyid( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2162,7 +2438,7 @@ set_control_keyid( */ static void get_ctl_stats( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2218,7 +2494,7 @@ get_ctl_stats( */ static void get_kernel_info( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2273,7 +2549,7 @@ get_kernel_info( */ static void get_clock_info( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2282,12 +2558,16 @@ get_clock_info( register u_int32 *clkaddr; register int items; struct refclockstat clock_stat; - struct sockaddr_in addr; + struct sockaddr_storage addr; + struct sockaddr_in tmp_clock; l_fp ltmp; memset((char *)&addr, 0, sizeof addr); - addr.sin_family = AF_INET; - addr.sin_port = htons(NTP_PORT); + addr.ss_family = AF_INET; +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + addr.ss_len = SOCKLEN(&addr); +#endif + NSRCPORT(&addr) = htons(NTP_PORT); items = INFO_NITEMS(inpkt->err_nitems); clkaddr = (u_int32 *) inpkt->data; @@ -2295,8 +2575,9 @@ get_clock_info( sizeof(struct info_clock)); while (items-- > 0) { - addr.sin_addr.s_addr = *clkaddr++; - if (!ISREFCLOCKADR(&addr) || + tmp_clock.sin_addr.s_addr = *clkaddr++; + CAST_V4(addr)->sin_addr = tmp_clock.sin_addr; + if (!ISREFCLOCKADR(&tmp_clock) || findexistingpeer(&addr, (struct peer *)0, -1) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; @@ -2306,7 +2587,7 @@ get_clock_info( refclock_control(&addr, (struct refclockstat *)0, &clock_stat); - ic->clockadr = addr.sin_addr.s_addr; + ic->clockadr = tmp_clock.sin_addr.s_addr; ic->type = clock_stat.type; ic->flags = clock_stat.flags; ic->lastevent = clock_stat.lastevent; @@ -2318,7 +2599,7 @@ get_clock_info( ic->timestarted = htonl((u_int32)clock_stat.timereset); DTOLFP(clock_stat.fudgetime1, <mp); HTONL_FP(<mp, &ic->fudgetime1); - DTOLFP(clock_stat.fudgetime1, <mp); + DTOLFP(clock_stat.fudgetime2, <mp); HTONL_FP(<mp, &ic->fudgetime2); ic->fudgeval1 = htonl((u_int32)clock_stat.fudgeval1); ic->fudgeval2 = htonl((u_int32)clock_stat.fudgeval2); @@ -2337,7 +2618,7 @@ get_clock_info( */ static void set_clock_fudge( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2345,19 +2626,24 @@ set_clock_fudge( register struct conf_fudge *cf; register int items; struct refclockstat clock_stat; - struct sockaddr_in addr; + struct sockaddr_storage addr; + struct sockaddr_in tmp_clock; l_fp ltmp; memset((char *)&addr, 0, sizeof addr); memset((char *)&clock_stat, 0, sizeof clock_stat); - addr.sin_family = AF_INET; - addr.sin_port = htons(NTP_PORT); items = INFO_NITEMS(inpkt->err_nitems); cf = (struct conf_fudge *) inpkt->data; while (items-- > 0) { - addr.sin_addr.s_addr = cf->clockadr; - if (!ISREFCLOCKADR(&addr) || + tmp_clock.sin_addr.s_addr = cf->clockadr; + *CAST_V4(addr) = tmp_clock; + addr.ss_family = AF_INET; +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + addr.ss_len = SOCKLEN(&addr); +#endif + NSRCPORT(&addr) = htons(NTP_PORT); + if (!ISREFCLOCKADR(&tmp_clock) || findexistingpeer(&addr, (struct peer *)0, -1) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; @@ -2383,7 +2669,7 @@ set_clock_fudge( clock_stat.haveflags = CLK_HAVEVAL2; break; case FUDGE_FLAGS: - clock_stat.flags = (u_char) ntohl(cf->fudgeval_flags) & 0xf; + clock_stat.flags = (u_char) (ntohl(cf->fudgeval_flags) & 0xf); clock_stat.haveflags = (CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3|CLK_HAVEFLAG4); break; @@ -2406,7 +2692,7 @@ set_clock_fudge( */ static void get_clkbug_info( - struct sockaddr_in *srcadr, + struct sockaddr_storage *srcadr, struct interface *inter, struct req_pkt *inpkt ) @@ -2416,11 +2702,15 @@ get_clkbug_info( register u_int32 *clkaddr; register int items; struct refclockbug bug; - struct sockaddr_in addr; + struct sockaddr_storage addr; + struct sockaddr_in tmp_clock; memset((char *)&addr, 0, sizeof addr); - addr.sin_family = AF_INET; - addr.sin_port = htons(NTP_PORT); + addr.ss_family = AF_INET; +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + addr.ss_len = SOCKLEN(&addr); +#endif + NSRCPORT(&addr) = htons(NTP_PORT); items = INFO_NITEMS(inpkt->err_nitems); clkaddr = (u_int32 *) inpkt->data; @@ -2428,8 +2718,9 @@ get_clkbug_info( sizeof(struct info_clkbug)); while (items-- > 0) { - addr.sin_addr.s_addr = *clkaddr++; - if (!ISREFCLOCKADR(&addr) || + tmp_clock.sin_addr.s_addr = *clkaddr++; + GET_INADDR(addr) = tmp_clock.sin_addr.s_addr; + if (!ISREFCLOCKADR(&tmp_clock) || findexistingpeer(&addr, (struct peer *)0, -1) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; @@ -2442,7 +2733,7 @@ get_clkbug_info( return; } - ic->clockadr = addr.sin_addr.s_addr; + ic->clockadr = tmp_clock.sin_addr.s_addr; i = bug.nvalues; if (i > NUMCBUGVALUES) i = NUMCBUGVALUES; diff --git a/dist/ntp/ntpd/ntp_resolver.c b/dist/ntp/ntpd/ntp_resolver.c deleted file mode 100644 index 5d55041cbae7..000000000000 --- a/dist/ntp/ntpd/ntp_resolver.c +++ /dev/null @@ -1,991 +0,0 @@ -/* $NetBSD: ntp_resolver.c,v 1.2 2002/05/16 19:30:17 wiz Exp $ */ - -/* -** 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 -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_request.h" -#include "ntp_stdlib.h" -#include "ntp_syslog.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 - 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; - 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/dist/ntp/ntpd/ntp_restrict.c b/dist/ntp/ntpd/ntp_restrict.c index 4173592bc4e7..05921067535b 100644 --- a/dist/ntp/ntpd/ntp_restrict.c +++ b/dist/ntp/ntpd/ntp_restrict.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_restrict.c,v 1.1.1.2 2003/12/04 16:05:26 drochner Exp $ */ +/* $NetBSD: ntp_restrict.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_restrict.c - determine host restrictions diff --git a/dist/ntp/ntpd/ntp_timer.c b/dist/ntp/ntpd/ntp_timer.c index 4f60790cd0a2..8909c0ffe79b 100644 --- a/dist/ntp/ntpd/ntp_timer.c +++ b/dist/ntp/ntpd/ntp_timer.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_timer.c,v 1.1.1.3 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: ntp_timer.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_timer.c - event timer support routines diff --git a/dist/ntp/ntpd/ntp_util.c b/dist/ntp/ntpd/ntp_util.c index 6b6e4e62e2b7..1382196d2ff3 100644 --- a/dist/ntp/ntpd/ntp_util.c +++ b/dist/ntp/ntpd/ntp_util.c @@ -1,20 +1,13 @@ -/* $NetBSD: ntp_util.c,v 1.3 2000/05/03 06:08:47 simonb Exp $ */ +/* $NetBSD: ntp_util.c,v 1.4 2003/12/04 16:23:37 drochner Exp $ */ /* * ntp_util.c - stuff I didn't have any other place for */ + #ifdef HAVE_CONFIG_H # include #endif -#include -#include -#include -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#include - #include "ntpd.h" #include "ntp_io.h" #include "ntp_unixtime.h" @@ -22,6 +15,20 @@ #include "ntp_if.h" #include "ntp_stdlib.h" +#include +#include +#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif + +#ifdef HAVE_IEEEFP_H +# include +#endif +#ifdef HAVE_MATH_H +# include +#endif + #ifdef DOSYNCTODR #if !defined(VMS) #include @@ -34,11 +41,10 @@ /* * This contains odds and ends. Right now the only thing you'll find - * in here is the hourly stats printer and some code to support rereading - * the keys file, but I may eventually put other things in here such as - * code to do something with the leap bits. + * in here is the hourly stats printer and some code to support + * rereading the keys file, but I may eventually put other things in + * here such as code to do something with the leap bits. */ - /* * Name of the keys file */ @@ -71,6 +77,10 @@ static FILEGEN peerstats; static FILEGEN loopstats; static FILEGEN clockstats; static FILEGEN rawstats; +static FILEGEN sysstats; +#ifdef OPENSSL +static FILEGEN cryptostats; +#endif /* OPENSSL */ /* * This controls whether stats are written to the fileset. Provided @@ -92,6 +102,11 @@ init_util(void) #define LOOPNAME "loopstats" #define CLOCKNAME "clockstats" #define RAWNAME "rawstats" +#define STANAME "systats" +#ifdef OPENSSL +#define CRYPTONAME "cryptostats" +#endif /* OPENSSL */ + peerstats.fp = NULL; peerstats.prefix = &statsdir[0]; peerstats.basename = (char*)emalloc(strlen(PEERNAME)+1); @@ -128,11 +143,34 @@ init_util(void) rawstats.flag = FGEN_FLAG_LINK; /* not yet enabled !!*/ filegen_register("rawstats", &rawstats); + sysstats.fp = NULL; + sysstats.prefix = &statsdir[0]; + sysstats.basename = (char*)emalloc(strlen(STANAME)+1); + strcpy(sysstats.basename, STANAME); + sysstats.id = 0; + sysstats.type = FILEGEN_DAY; + sysstats.flag = FGEN_FLAG_LINK; /* not yet enabled !!*/ + filegen_register("sysstats", &sysstats); + +#ifdef OPENSSL + cryptostats.fp = NULL; + cryptostats.prefix = &statsdir[0]; + cryptostats.basename = (char*)emalloc(strlen(CRYPTONAME)+1); + strcpy(cryptostats.basename, CRYPTONAME); + cryptostats.id = 0; + cryptostats.type = FILEGEN_DAY; + cryptostats.flag = FGEN_FLAG_LINK; /* not yet enabled !!*/ + filegen_register("cryptostats", &cryptostats); +#endif /* OPENSSL */ + #undef PEERNAME #undef LOOPNAME #undef CLOCKNAME #undef RAWNAME - +#undef STANAME +#ifdef OPENSSL +#undef CRYPTONAME +#endif /* OPENSSL */ } @@ -178,27 +216,27 @@ hourly_stats(void) #if !defined(VMS) /* (prr) getpriority returns -1 on error, but -1 is also a valid - * return value (!), so instead we have to zero errno before the call - * and check it for non-zero afterwards. + * return value (!), so instead we have to zero errno before the + * call and check it for non-zero afterwards. */ - errno = 0; prio_set = 0; o_prio = getpriority(PRIO_PROCESS,0); /* Save setting */ - /* (prr) if getpriority succeeded, call setpriority to raise + /* + * (prr) if getpriority succeeded, call setpriority to raise * scheduling priority as high as possible. If that succeeds * as well, set the prio_set flag so we remember to reset - * priority to its previous value below. Note that on Solaris 2.6 - * (and beyond?), both getpriority and setpriority will fail with - * ESRCH, because sched_setscheduler (called from main) put us in - * the real-time scheduling class which setpriority doesn't know about. - * Being in the real-time class is better than anything setpriority - * can do, anyhow, so this error is silently ignored. + * priority to its previous value below. Note that on Solaris + * 2.6 (and beyond?), both getpriority and setpriority will fail + * with ESRCH, because sched_setscheduler (called from main) put + * us in the real-time scheduling class which setpriority + * doesn't know about. Being in the real-time class is better + * than anything setpriority can do, anyhow, so this error is + * silently ignored. */ - if ((errno == 0) && (setpriority(PRIO_PROCESS,0,-20) == 0)) - prio_set = 1; /* overdrive */ + prio_set = 1; /* overdrive */ #endif /* VMS */ #ifdef HAVE_GETCLOCK (void) getclock(TIMEOFDAY, &ts); @@ -207,21 +245,23 @@ hourly_stats(void) #else /* not HAVE_GETCLOCK */ GETTIMEOFDAY(&tv,(struct timezone *)NULL); #endif /* not HAVE_GETCLOCK */ - if (ntp_set_tod(&tv,(struct timezone *)NULL) != 0) - { + if (ntp_set_tod(&tv,(struct timezone *)NULL) != 0) { msyslog(LOG_ERR, "can't sync battery time: %m"); } #if !defined(VMS) if (prio_set) - setpriority(PRIO_PROCESS, 0, o_prio); /* downshift */ + setpriority(PRIO_PROCESS, 0, o_prio); /* downshift */ #endif /* VMS */ #endif /* DOSYNCTODR */ 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); + + record_sys_stats(); if (stats_drift_file != 0) { if ((fp = fopen(stats_temp_file, "w")) == NULL) { msyslog(LOG_ERR, "can't open %s: %m", @@ -232,7 +272,7 @@ hourly_stats(void) (void)fclose(fp); /* atomic */ #ifdef SYS_WINNT - (void) unlink(stats_drift_file); /* rename semantics differ under NT */ + (void) _unlink(stats_drift_file); /* rename semantics differ under NT */ #endif /* SYS_WINNT */ #ifndef NO_RENAME @@ -275,14 +315,14 @@ stats_config( double old_drift; int len; - /* Expand environment strings under Windows NT, since the command - * interpreter doesn't do this, the program must. + /* + * Expand environment strings under Windows NT, since the + * command interpreter doesn't do this, the program must. */ #ifdef SYS_WINNT char newvalue[MAX_PATH], parameter[MAX_PATH]; - if (!ExpandEnvironmentStrings(invalue, newvalue, MAX_PATH)) - { + if (!ExpandEnvironmentStrings(invalue, newvalue, MAX_PATH)) { switch(item) { case STATS_FREQ_FILE: strcpy(parameter,"STATS_FREQ_FILE"); @@ -301,15 +341,13 @@ stats_config( msyslog(LOG_ERR, "ExpandEnvironmentStrings(%s) failed: %m\n", parameter); - } - else + } else { value = newvalue; + } #else value = invalue; #endif /* SYS_WINNT */ - - switch(item) { case STATS_FREQ_FILE: if (stats_drift_file != 0) { @@ -324,39 +362,41 @@ stats_config( stats_drift_file = (char*)emalloc((u_int)(len + 1)); #if !defined(VMS) - stats_temp_file = (char*)emalloc((u_int)(len + sizeof(".TEMP"))); + stats_temp_file = (char*)emalloc((u_int)(len + + sizeof(".TEMP"))); #else - stats_temp_file = (char*)emalloc((u_int)(len + sizeof("-TEMP"))); + stats_temp_file = (char*)emalloc((u_int)(len + + sizeof("-TEMP"))); #endif /* VMS */ memmove(stats_drift_file, value, (unsigned)(len+1)); memmove(stats_temp_file, value, (unsigned)len); #if !defined(VMS) - memmove(stats_temp_file + len, ".TEMP", sizeof(".TEMP")); + memmove(stats_temp_file + len, ".TEMP", + sizeof(".TEMP")); #else - memmove(stats_temp_file + len, "-TEMP", sizeof("-TEMP")); + memmove(stats_temp_file + len, "-TEMP", + sizeof("-TEMP")); #endif /* VMS */ /* - * Open drift file and read frequency + * Open drift file and read frequency. If the file is + * missing or contains errors, tell the loop to reset. */ if ((fp = fopen(stats_drift_file, "r")) == NULL) { + loop_config(LOOP_DRIFTCOMP, 1e9); break; } if (fscanf(fp, "%lf", &old_drift) != 1) { - msyslog(LOG_ERR, "Un-parsable frequency in %s", + msyslog(LOG_ERR, "Frequency format error in %s", stats_drift_file); - (void) fclose(fp); + loop_config(LOOP_DRIFTCOMP, 1e9); + fclose(fp); break; } - (void) fclose(fp); - if ( !finite(old_drift) - || (fabs(old_drift) > (sys_maxfreq * 1e6))) { - msyslog(LOG_ERR, "invalid frequency (%f) in %s", - old_drift, stats_drift_file); - exit(1); - } - msyslog(LOG_INFO, "frequency initialized %.3f from %s", - old_drift, stats_drift_file); + fclose(fp); + msyslog(LOG_INFO, + "frequency initialized %.3f PPM from %s", + old_drift, stats_drift_file); loop_config(LOOP_DRIFTCOMP, old_drift / 1e6); break; @@ -394,6 +434,20 @@ stats_config( rawstats.fp = NULL; filegen_setup(&rawstats, now.l_ui); } + if(sysstats.prefix == &statsdir[0] && + sysstats.fp != NULL) { + fclose(sysstats.fp); + sysstats.fp = NULL; + filegen_setup(&sysstats, now.l_ui); + } +#ifdef OPENSSL + if(cryptostats.prefix == &statsdir[0] && + cryptostats.fp != NULL) { + fclose(cryptostats.fp); + cryptostats.fp = NULL; + filegen_setup(&cryptostats, now.l_ui); + } +#endif /* OPENSSL */ } break; @@ -427,38 +481,28 @@ stats_config( */ void record_peer_stats( - struct sockaddr_in *addr, - int status, - double offset, - double delay, - double dispersion, - double skew + struct sockaddr_storage *addr, + int status, + double offset, + double delay, + double dispersion, + double skew ) { - struct timeval tv; -#ifdef HAVE_GETCLOCK - struct timespec ts; -#endif - u_long day, sec, msec; + l_fp now; + u_long day; if (!stats_control) return; -#ifdef HAVE_GETCLOCK - (void) getclock(TIMEOFDAY, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; -#else /* not HAVE_GETCLOCK */ - GETTIMEOFDAY(&tv, (struct timezone *)NULL); -#endif /* not HAVE_GETCLOCK */ - day = tv.tv_sec / 86400 + MJD_1970; - sec = tv.tv_sec % 86400; - msec = tv.tv_usec / 1000; - filegen_setup(&peerstats, (u_long)(tv.tv_sec + JAN_1970)); + get_systime(&now); + filegen_setup(&peerstats, now.l_ui); + day = now.l_ui / 86400 + MJD_1900; + now.l_ui %= 86400; if (peerstats.fp != NULL) { fprintf(peerstats.fp, - "%lu %lu.%03lu %s %x %.9f %.9f %.9f %.9f\n", - day, sec, msec, ntoa(addr), status, offset, + "%lu %s %s %x %.9f %.9f %.9f %.9f\n", + day, ulfptoa(&now, 3), stoa(addr), status, offset, delay, dispersion, skew); fflush(peerstats.fp); } @@ -474,32 +518,28 @@ 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 spoll + ) { - struct timeval tv; -#ifdef HAVE_GETCLOCK - struct timespec ts; -#endif - u_long day, sec, msec; + l_fp now; + u_long day; if (!stats_control) return; -#ifdef HAVE_GETCLOCK - (void) getclock(TIMEOFDAY, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; -#else /* not HAVE_GETCLOCK */ - GETTIMEOFDAY(&tv, (struct timezone *)NULL); -#endif /* not HAVE_GETCLOCK */ - day = tv.tv_sec / 86400 + MJD_1970; - sec = tv.tv_sec % 86400; - msec = tv.tv_usec / 1000; - filegen_setup(&loopstats, (u_long)(tv.tv_sec + JAN_1970)); + get_systime(&now); + filegen_setup(&loopstats, now.l_ui); + day = now.l_ui / 86400 + MJD_1900; + now.l_ui %= 86400; 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); + fprintf(loopstats.fp, "%lu %s %.9f %.6f %.9f %.6f %d\n", + day, ulfptoa(&now, 3), offset, freq * 1e6, jitter, + stability * 1e6, spoll); fflush(loopstats.fp); } } @@ -515,33 +555,23 @@ record_loop_stats(void) */ void record_clock_stats( - struct sockaddr_in *addr, + struct sockaddr_storage *addr, const char *text ) { - struct timeval tv; -#ifdef HAVE_GETCLOCK - struct timespec ts; -#endif - u_long day, sec, msec; + l_fp now; + u_long day; if (!stats_control) return; -#ifdef HAVE_GETCLOCK - (void) getclock(TIMEOFDAY, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; -#else /* not HAVE_GETCLOCK */ - GETTIMEOFDAY(&tv, (struct timezone *)NULL); -#endif /* not HAVE_GETCLOCK */ - day = tv.tv_sec / 86400 + MJD_1970; - sec = tv.tv_sec % 86400; - msec = tv.tv_usec / 1000; - filegen_setup(&clockstats, (u_long)(tv.tv_sec + JAN_1970)); + get_systime(&now); + filegen_setup(&clockstats, now.l_ui); + day = now.l_ui / 86400 + MJD_1900; + now.l_ui %= 86400; if (clockstats.fp != NULL) { - fprintf(clockstats.fp, "%lu %lu.%03lu %s %s\n", - day, sec, msec, ntoa(addr), text); + fprintf(clockstats.fp, "%lu %s %s %s\n", + day, ulfptoa(&now, 3), stoa(addr), text); fflush(clockstats.fp); } } @@ -558,43 +588,116 @@ record_clock_stats( */ void record_raw_stats( - struct sockaddr_in *srcadr, - struct sockaddr_in *dstadr, - l_fp *t1, - l_fp *t2, - l_fp *t3, - l_fp *t4 + struct sockaddr_storage *srcadr, + struct sockaddr_storage *dstadr, + l_fp *t1, + l_fp *t2, + l_fp *t3, + l_fp *t4 ) { - struct timeval tv; -#ifdef HAVE_GETCLOCK - struct timespec ts; -#endif - u_long day, sec, msec; + l_fp now; + u_long day; if (!stats_control) return; -#ifdef HAVE_GETCLOCK - (void) getclock(TIMEOFDAY, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; -#else /* not HAVE_GETCLOCK */ - GETTIMEOFDAY(&tv, (struct timezone *)NULL); -#endif /* not HAVE_GETCLOCK */ - day = tv.tv_sec / 86400 + MJD_1970; - sec = tv.tv_sec % 86400; - msec = tv.tv_usec / 1000; - filegen_setup(&rawstats, (u_long)(tv.tv_sec + JAN_1970)); + get_systime(&now); + filegen_setup(&rawstats, now.l_ui); + day = now.l_ui / 86400 + MJD_1900; + now.l_ui %= 86400; if (rawstats.fp != NULL) { - fprintf(rawstats.fp, "%lu %lu.%03lu %s %s %s %s %s %s\n", - day, sec, msec, ntoa(srcadr), ntoa(dstadr), + fprintf(rawstats.fp, "%lu %s %s %s %s %s %s %s\n", + day, ulfptoa(&now, 3), stoa(srcadr), stoa(dstadr), ulfptoa(t1, 9), ulfptoa(t2, 9), ulfptoa(t3, 9), ulfptoa(t4, 9)); fflush(rawstats.fp); } } + +/* + * record_sys_stats - write system statistics to file + * + * file format + * time (s past midnight) + * time since startup (hr) + * packets recieved + * packets processed + * current version + * previous version + * bad version + * access denied + * bad length or format + * bad authentication + * rate exceeded + */ +void +record_sys_stats(void) +{ + l_fp now; + u_long day; + + if (!stats_control) + return; + + get_systime(&now); + filegen_setup(&sysstats, now.l_ui); + day = now.l_ui / 86400 + MJD_1900; + now.l_ui %= 86400; + if (sysstats.fp != NULL) { + fprintf(sysstats.fp, + "%lu %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n", + day, ulfptoa(&now, 3), sys_stattime / 3600, + sys_received, sys_processed, sys_newversionpkt, + sys_oldversionpkt, sys_unknownversion, + sys_restricted, sys_badlength, sys_badauth, + sys_limitrejected); + fflush(sysstats.fp); + proto_clr_stats(); + } +} + + +#ifdef OPENSSL +/* + * record_crypto_stats - write crypto statistics to file + * + * file format: + * day (mjd) + * time (s past midnight) + * peer (ip address) + * text message + */ +void +record_crypto_stats( + struct sockaddr_storage *addr, + const char *text + ) +{ + l_fp now; + u_long day; + + if (!stats_control) + return; + + get_systime(&now); + filegen_setup(&cryptostats, now.l_ui); + day = now.l_ui / 86400 + MJD_1900; + now.l_ui %= 86400; + if (cryptostats.fp != NULL) { + if (addr == NULL) + fprintf(cryptostats.fp, "%lu %s %s\n", + day, ulfptoa(&now, 3), text); + else + fprintf(cryptostats.fp, "%lu %s %s %s\n", + day, ulfptoa(&now, 3), stoa(addr), text); + fflush(cryptostats.fp); + } +} +#endif /* OPENSSL */ + + /* * getauthkeys - read the authentication keys from the specified file */ @@ -646,3 +749,51 @@ rereadkeys(void) if (key_file_name != 0) authreadkeys(key_file_name); } + +/* + * sock_hash - hash an sockaddr_storage structure + */ +int +sock_hash( + struct sockaddr_storage *addr + ) +{ + int hashVal; + int i; + int len; + char *ch; + + hashVal = 0; + len = 0; + /* + * We can't just hash the whole thing because there are hidden + * fields in sockaddr_in6 that might be filled in by recvfrom(), + * so just use the family, port and address. + */ + ch = (char *)&addr->ss_family; + hashVal = 37 * hashVal + (int)*ch; + if (sizeof(addr->ss_family) > 1) { + ch++; + hashVal = 37 * hashVal + (int)*ch; + } + switch(addr->ss_family) { + case AF_INET: + ch = (char *)&((struct sockaddr_in *)addr)->sin_addr; + len = sizeof(struct in_addr); + break; + case AF_INET6: + ch = (char *)&((struct sockaddr_in6 *)addr)->sin6_addr; + len = sizeof(struct in6_addr); + break; + } + + for (i = 0; i < len ; i++) + hashVal = 37 * hashVal + (int)*(ch + i); + + hashVal = hashVal % 128; /* % MON_HASH_SIZE hardcoded */ + + if (hashVal < 0) + hashVal += 128; + + return hashVal; +} diff --git a/dist/ntp/ntpd/ntpd.c b/dist/ntp/ntpd/ntpd.c index 747d04e6dfc1..468dc2fe495f 100644 --- a/dist/ntp/ntpd/ntpd.c +++ b/dist/ntp/ntpd/ntpd.c @@ -1,13 +1,22 @@ -/* $NetBSD: ntpd.c,v 1.4 2003/02/08 11:45:54 jdolecek Exp $ */ +/* $NetBSD: ntpd.c,v 1.5 2003/12/04 16:23:37 drochner Exp $ */ /* * ntpd.c - main program for the fixed point NTP daemon */ + #ifdef HAVE_CONFIG_H # include #endif -#include +#include "ntp_machine.h" +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_stdlib.h" + +#ifdef SIM +#include "ntpsim.h" +#endif + #ifdef HAVE_UNISTD_H # include #endif @@ -17,13 +26,18 @@ #include #ifndef SYS_WINNT # if !defined(VMS) /*wjm*/ -# include +# ifdef HAVE_SYS_PARAM_H +# include +# endif # endif /* VMS */ -# include +# ifdef HAVE_SYS_SIGNAL_H +# include +# else +# include +# endif # ifdef HAVE_SYS_IOCTL_H # include # endif /* HAVE_SYS_IOCTL_H */ -# include # ifdef HAVE_SYS_RESOURCE_H # include # endif /* HAVE_SYS_RESOURCE_H */ @@ -32,6 +46,7 @@ # include # include # include "../libntp/log.h" +# include # include #endif /* SYS_WINNT */ #if defined(HAVE_RTPRIO) @@ -70,11 +85,8 @@ # include #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 @@ -95,14 +107,10 @@ #endif #ifdef HAVE_CLOCKCTL -#include -#include -#include -#endif - -#ifdef PUBKEY -#include "ntp_crypto.h" -#endif /* PUBKEY */ +# include +# include +# include +#endif /* * Signals we catch for debugging. If not debugging we ignore them. @@ -124,11 +132,13 @@ /* handles for various threads, process, and objects */ HANDLE ResolverThreadHandle = NULL; /* variables used to inform the Service Control Manager of our current state */ +BOOL NoWinService = FALSE; SERVICE_STATUS ssStatus; SERVICE_STATUS_HANDLE sshStatusHandle; -HANDLE WaitHandles[2] = { NULL, NULL }; +HANDLE WaitHandles[3] = { NULL, NULL, NULL }; char szMsgPath[255]; static BOOL WINAPI OnConsoleEvent(DWORD dwCtrlType); +BOOL init_randfile(); #endif /* SYS_WINNT */ /* @@ -136,11 +146,21 @@ static BOOL WINAPI OnConsoleEvent(DWORD dwCtrlType); */ #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 */ volatile int debug; +/* + * Set the processing not to be in the forground + */ +int forground_process = FALSE; + /* * No-fork flag. If set, we do not become a background daemon. */ @@ -152,9 +172,9 @@ char *group = NULL; /* group to switch to */ char *chrootdir = NULL; /* directory to chroot to */ int sw_uid; int sw_gid; -char *endp; +char *endp; struct group *gr; -struct passwd *pw; +struct passwd *pw; #endif /* HAVE_CLOCKCTL */ /* @@ -183,8 +203,10 @@ static RETSIGTYPE finish P((int)); #endif /* SIGDIE2 */ #ifdef DEBUG +#ifndef SYS_WINNT static RETSIGTYPE moredebug P((int)); static RETSIGTYPE lessdebug P((int)); +#endif #else /* not DEBUG */ static RETSIGTYPE no_debug P((int)); #endif /* not DEBUG */ @@ -192,7 +214,16 @@ static RETSIGTYPE no_debug P((int)); int ntpdmain P((int, char **)); static void set_process_priority P((void)); - +#ifdef SIM +int +main( + int argc, + char *argv[] + ) +{ + return ntpsim(argc, argv); +} +#else /* SIM */ #ifdef NO_MAIN_ALLOWED CALL(ntpd,"ntpd",ntpdmain); #else @@ -205,6 +236,7 @@ main( return ntpdmain(argc, argv); } #endif +#endif /* SIM */ #ifdef _AIX /* @@ -246,39 +278,23 @@ catch_danger(int signo) static void set_process_priority(void) { - int done = 0; + +#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 */ #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 - - if (!SetPriorityClass(GetCurrentProcess(), (DWORD) REALTIME_PRIORITY_CLASS)) - msyslog(LOG_ERR, "SetPriorityClass: %m"); - else - ++done; + priority_done += NT_set_process_priority(); #endif #if defined(HAVE_SCHED_SETSCHEDULER) - if (!done) { + if (!priority_done) { extern int config_priority_override, config_priority; int pmax, pmin; struct sched_param sched; @@ -297,12 +313,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) { + if (!priority_done) { struct rtprio srtp; srtp.type = RTP_PRIO_REALTIME; /* was: RTP_PRIO_NORMAL */ @@ -311,37 +327,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) { + 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) { + 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) { + 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) + if (!priority_done) msyslog(LOG_ERR, "set_process_priority: No way found to improve our priority"); } @@ -358,10 +374,6 @@ ntpdmain( { l_fp now; char *cp; - u_int n; -#ifdef AUTOKEY - char hostname[MAXFILENAME]; -#endif /* AUTOKEY */ struct recvbuf *rbuflist; struct recvbuf *rbuf; #ifdef _AIX /* HMS: ifdef SIGDANGER? */ @@ -374,7 +386,7 @@ ntpdmain( #ifdef HAVE_UMASK { - unsigned int uv; + mode_t uv; uv = umask(0); if(uv) @@ -384,7 +396,7 @@ ntpdmain( } #endif -#ifdef HAVE_GETUID +#if defined(HAVE_GETUID) && !defined(MPE) /* MPE lacks the concept of root */ { uid_t uid; @@ -407,9 +419,17 @@ ntpdmain( #endif getstartup(argc, argv); /* startup configuration, may set debug */ + if (debug) + printf("%s\n", Version); + /* * Initialize random generator and public key pair */ +#ifdef SYS_WINNT + /* Initialize random file before OpenSSL checks */ + if(!init_randfile()) + msyslog(LOG_ERR, "Unable to initialize .rnd file\n"); +#endif get_systime(&now); SRANDOM((int)(now.l_i * now.l_uf)); @@ -437,12 +457,12 @@ ntpdmain( int max_fd; #endif /* not F_CLOSEM */ +#if defined(F_CLOSEM) /* * From 'Writing Reliable AIX Daemons,' SG24-4946-00, * by Eric Agar (saves us from doing 32767 system * calls) */ -#if defined(F_CLOSEM) if (fcntl(0, F_CLOSEM, 0) == -1) msyslog(LOG_ERR, "ntpd: failed to close open files(): %m"); #else /* not F_CLOSEM */ @@ -507,16 +527,22 @@ ntpdmain( # else /* SYS_WINNT */ { - SERVICE_TABLE_ENTRY dispatchTable[] = { + if (NoWinService == FALSE) { + SERVICE_TABLE_ENTRY dispatchTable[] = { { TEXT("NetworkTimeProtocol"), (LPSERVICE_MAIN_FUNCTION)service_main }, { NULL, NULL } - }; + }; - /* daemonize */ - if (!StartServiceCtrlDispatcher(dispatchTable)) - { - msyslog(LOG_ERR, "StartServiceCtrlDispatcher: %m"); - ExitProcess(2); + /* daemonize */ + if (!StartServiceCtrlDispatcher(dispatchTable)) + { + msyslog(LOG_ERR, "StartServiceCtrlDispatcher: %m"); + ExitProcess(2); + } + } + else { + service_main(argc, argv); + return 0; } } # endif /* SYS_WINNT */ @@ -544,11 +570,12 @@ service_main( struct recvbuf *rbuflist; struct recvbuf *rbuf; - if(!debug) + if(!debug && NoWinService == FALSE) { /* register our service control handler */ - if (!(sshStatusHandle = RegisterServiceCtrlHandler( TEXT("NetworkTimeProtocol"), - (LPHANDLER_FUNCTION)service_ctrl))) + sshStatusHandle = RegisterServiceCtrlHandler( TEXT("NetworkTimeProtocol"), + (LPHANDLER_FUNCTION)service_ctrl); + if(sshStatusHandle == 0) { msyslog(LOG_ERR, "RegisterServiceCtrlHandler failed: %m"); return; @@ -587,7 +614,7 @@ service_main( debug = 0; /* will be immediately re-initialized 8-( */ getstartup(argc, argv); /* startup configuration, catch logfile this time */ -#if !defined(SYS_WINNT) && !defined(VMS) +#if !defined(VMS) # ifndef LOG_DAEMON openlog(cp, LOG_PID); @@ -644,18 +671,25 @@ service_main( #endif #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE) +# ifdef HAVE_SETRLIMIT /* - * Set the stack limit to something smaller so that we - * don't lock a lot of unused stack memory. + * Set the stack limit to something smaller, so that we don't lock a lot + * of unused stack memory. */ { - struct rlimit rl = { 8 * 4096, 8 * 4096 }; - if (setrlimit(RLIMIT_STACK, &rl) == -1) - { - msyslog(LOG_ERR, - "Cannot adjust stack limit for mlockall: %m"); - } + struct rlimit rl; + + if (getrlimit(RLIMIT_STACK, &rl) != -1 + && (rl.rlim_cur = 20 * 4096) < rl.rlim_max) + { + if (setrlimit(RLIMIT_STACK, &rl) == -1) + { + msyslog(LOG_ERR, + "Cannot adjust stack limit for mlockall: %m"); + } + } } +# endif /* HAVE_SETRLIMIT */ /* * lock the process into memory */ @@ -756,9 +790,6 @@ service_main( #ifdef REFCLOCK init_refclock(); #endif -#ifdef PUBKEY - crypto_init(); /* Call *before* going to high-priority */ -#endif /* PUBKEY */ set_process_priority(); init_proto(); /* Call at high priority */ init_io(); @@ -772,19 +803,13 @@ service_main( * 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); - for (n = strlen(hostname); n % 4 != 0; n++) - hostname[n] = 0; - sys_hostname = emalloc(n); - sys_hostnamelen = n; - memcpy(sys_hostname, hostname, n); -#ifdef PUBKEY - if (crypto_enable) - crypto_setup(); -#endif /* PUBKEY */ -#endif /* AUTOKEY */ +#ifdef OPENSSL + crypto_setup(); +#endif /* OPENSSL */ initializing = 0; #if defined(SYS_WINNT) && !defined(NODETACH) @@ -792,26 +817,29 @@ service_main( if(!debug) { # endif + if (NoWinService == FALSE) { /* report to the service control manager that the service is running */ - ssStatus.dwCurrentState = SERVICE_RUNNING; - ssStatus.dwWin32ExitCode = NO_ERROR; - if (!SetServiceStatus(sshStatusHandle, &ssStatus)) - { - msyslog(LOG_ERR, "SetServiceStatus: %m"); - if (ResolverThreadHandle != NULL) - CloseHandle(ResolverThreadHandle); - ssStatus.dwCurrentState = SERVICE_STOPPED; - SetServiceStatus(sshStatusHandle, &ssStatus); - return; + ssStatus.dwCurrentState = SERVICE_RUNNING; + ssStatus.dwWin32ExitCode = NO_ERROR; + if (!SetServiceStatus(sshStatusHandle, &ssStatus)) + { + msyslog(LOG_ERR, "SetServiceStatus: %m"); + if (ResolverThreadHandle != NULL) + CloseHandle(ResolverThreadHandle); + ssStatus.dwCurrentState = SERVICE_STOPPED; + SetServiceStatus(sshStatusHandle, &ssStatus); + return; + } } # if defined(DEBUG) } # endif #endif + #ifdef HAVE_CLOCKCTL /* - * Drop super-user privileges and chroot now on OSes that support - * non root users to set the clock. Currently only NetBSD. + * Drop super-user privileges and chroot now if the OS supports + * non root clock control (only NetBSD for now). */ if (user != NULL) { if (isdigit((unsigned char)*user)) { @@ -837,7 +865,7 @@ getuser: } else { getgroup: if ((gr = getgrnam(group)) != NULL) { - sw_gid = gr->gr_gid; + sw_gid = pw->pw_gid; } else { errno = 0; msyslog(LOG_ERR, "Cannot find group `%s'", group); @@ -889,9 +917,10 @@ getgroup: #if defined(HAVE_IO_COMPLETION_PORT) WaitHandles[0] = CreateEvent(NULL, FALSE, FALSE, NULL); /* exit reques */ WaitHandles[1] = get_timer_handle(); + WaitHandles[2] = get_io_event(); for (;;) { - DWORD Index = WaitForMultipleObjectsEx(sizeof(WaitHandles)/sizeof(WaitHandles[0]), WaitHandles, FALSE, 1000, MWMO_ALERTABLE); + DWORD Index = WaitForMultipleObjectsEx(sizeof(WaitHandles)/sizeof(WaitHandles[0]), WaitHandles, FALSE, 1000, TRUE); switch (Index) { case WAIT_OBJECT_0 + 0 : /* exit request */ exit(0); @@ -900,20 +929,26 @@ getgroup: case WAIT_OBJECT_0 + 1 : /* timer */ timer(); break; - case WAIT_OBJECT_0 + 2 : { /* Windows message */ - MSG msg; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if (msg.message == WM_QUIT) { - exit(0); - } - DispatchMessage(&msg); + + case WAIT_OBJECT_0 + 2 : /* Io event */ +# ifdef DEBUG + if ( debug > 3 ) + { + printf( "IoEvent occurred\n" ); } - } +# endif break; case WAIT_IO_COMPLETION : /* loop */ case WAIT_TIMEOUT : break; + case WAIT_FAILED: + msyslog(LOG_ERR, "ntpdc: WaitForMultipleObjectsEx Failed: Error: %m"); + break; + + /* For now do nothing if not expected */ + default: + break; } /* switch */ rbuflist = getrecvbufs(); /* get received buffers */ @@ -971,9 +1006,10 @@ getgroup: } else if (nfound == -1 && errno != EINTR) msyslog(LOG_ERR, "select() error: %m"); - else if (debug > 2) { +# ifdef DEBUG + else if (debug > 2) msyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound); - } +# endif /* DEBUG */ # else /* HAVE_SIGNALED_IO */ wait_for_signal(); @@ -1021,8 +1057,12 @@ getgroup: * Go around again */ } +#ifndef SYS_WINNT exit(1); /* unreachable */ +#endif +#ifndef SYS_WINNT return 1; /* DEC OSF cc braindamage */ +#endif } @@ -1055,6 +1095,7 @@ finish( #ifdef DEBUG +#ifndef SYS_WINNT /* * moredebug - increase debugging verbosity */ @@ -1090,8 +1131,9 @@ lessdebug( } errno = saved_errno; } +#endif #else /* not DEBUG */ -/* +#ifndef SYS_WINNT/* * no_debug - We don't do the debug here. */ static RETSIGTYPE @@ -1104,6 +1146,7 @@ no_debug( msyslog(LOG_DEBUG, "ntpd not compiled for debugging (signal %d)", sig); errno = saved_errno; } +#endif /* not SYS_WINNT */ #endif /* not DEBUG */ #ifdef SYS_WINNT diff --git a/dist/ntp/ntpd/ntpsim.c b/dist/ntp/ntpd/ntpsim.c index 9e3da97bd26c..81d996d1698d 100644 --- a/dist/ntp/ntpd/ntpsim.c +++ b/dist/ntp/ntpd/ntpsim.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntpsim.c,v 1.1.1.1 2003/12/04 16:05:31 drochner Exp $ */ +/* $NetBSD: ntpsim.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * NTP simulator engine - Harish Nair diff --git a/dist/ntp/ntpd/refclock_acts.c b/dist/ntp/ntpd/refclock_acts.c index eb1805904bb7..bbb18cc99b5d 100644 --- a/dist/ntp/ntpd/refclock_acts.c +++ b/dist/ntp/ntpd/refclock_acts.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_acts.c,v 1.1.1.3 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_acts.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_acts - clock driver for the NIST/PTB Automated Computer Time diff --git a/dist/ntp/ntpd/refclock_arbiter.c b/dist/ntp/ntpd/refclock_arbiter.c index 18f6ba73e7a9..bd9241edf489 100644 --- a/dist/ntp/ntpd/refclock_arbiter.c +++ b/dist/ntp/ntpd/refclock_arbiter.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_arbiter.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_arbiter.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_arbiter - clock driver for Arbiter 1088A/B Satellite diff --git a/dist/ntp/ntpd/refclock_arc.c b/dist/ntp/ntpd/refclock_arc.c index ecc0bb141be8..921b58232e3e 100644 --- a/dist/ntp/ntpd/refclock_arc.c +++ b/dist/ntp/ntpd/refclock_arc.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_arc.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_arc.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_arc - clock driver for ARCRON MSF/DCF/WWVB receivers diff --git a/dist/ntp/ntpd/refclock_as2201.c b/dist/ntp/ntpd/refclock_as2201.c index 55d10508c804..7b275c65f4ad 100644 --- a/dist/ntp/ntpd/refclock_as2201.c +++ b/dist/ntp/ntpd/refclock_as2201.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_as2201.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_as2201.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_as2201 - clock driver for the Austron 2201A GPS diff --git a/dist/ntp/ntpd/refclock_atom.c b/dist/ntp/ntpd/refclock_atom.c index 631c9c97c42d..c1507f2468e0 100644 --- a/dist/ntp/ntpd/refclock_atom.c +++ b/dist/ntp/ntpd/refclock_atom.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_atom.c,v 1.1.1.3 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_atom.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* diff --git a/dist/ntp/ntpd/refclock_bancomm.c b/dist/ntp/ntpd/refclock_bancomm.c index 9e2674a1caf2..67f24c2bab4c 100644 --- a/dist/ntp/ntpd/refclock_bancomm.c +++ b/dist/ntp/ntpd/refclock_bancomm.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_bancomm.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_bancomm.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* refclock_bancomm.c - clock driver for the Datum/Bancomm bc635VME * Time and Frequency Processor. It requires the BANCOMM bc635VME/ diff --git a/dist/ntp/ntpd/refclock_chronolog.c b/dist/ntp/ntpd/refclock_chronolog.c index 0feb399b8175..9f50562ff997 100644 --- a/dist/ntp/ntpd/refclock_chronolog.c +++ b/dist/ntp/ntpd/refclock_chronolog.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_chronolog.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_chronolog.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_chronolog - clock driver for Chronolog K-series WWVB receiver. diff --git a/dist/ntp/ntpd/refclock_chu.c b/dist/ntp/ntpd/refclock_chu.c index 16fb17cb1879..04c49048dd75 100644 --- a/dist/ntp/ntpd/refclock_chu.c +++ b/dist/ntp/ntpd/refclock_chu.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_chu.c,v 1.2 2003/03/29 22:48:37 wiz Exp $ */ +/* $NetBSD: refclock_chu.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_chu - clock driver for Canadian CHU time/frequency station @@ -9,20 +9,19 @@ #if defined(REFCLOCK) && defined(CLOCK_CHU) -#include -#include -#include -#include -#include - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_calendar.h" #include "ntp_stdlib.h" -#ifdef AUDIO_CHU + +#include +#include +#include + +#ifdef HAVE_AUDIO #include "audio.h" -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ #define ICOM 1 /* undefine to suppress ICOM code */ @@ -43,10 +42,10 @@ * change throughout the day and night. * * The driver receives, demodulates and decodes the radio signals when - * connected to the audio codec of a Sun workstation running SunOS or - * Solaris, and with a little help, other workstations with similar - * codecs or sound cards. In this implementation, only one audio driver - * and codec can be supported on a single machine. + * connected to the audio codec of a suported workstation hardware and + * operating system. These include Solaris, SunOS, FreeBSD, NetBSD and + * Linux. In this implementation, only one audio driver and codec can be + * supported on a single machine. * * The driver can be compiled to use a Bell 103 compatible modem or * modem chip to receive the radio signal and demodulate the data. @@ -108,8 +107,8 @@ * * The timecode format used for debugging and data recording includes * data helpful in diagnosing problems with the radio signal and serial - * connections. With debugging enabled (-d -d -d on the ntpd command - * line), the driver produces one line for each burst in two formats + * connections. With debugging enabled (-d on the ntpd command line), + * the driver produces one line for each burst in two formats * corresponding to format A and B. Following is format A: * * n b f s m code @@ -164,21 +163,29 @@ * * For accuracies better than the low millisceconds, fudge time1 can be * set to the radio propagation delay from CHU to the receiver. This can - * be done conviently using the minimuf program. When the modem driver - * is compiled, fudge flag3 enables the ppsclock line discipline. Fudge - * flag4 causes the dubugging output described above to be recorded in - * the clockstats file. + * be done conviently using the minimuf program. * - * When the audio driver is compiled, fudge flag2 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. - * Fudge flag3 enables audio monitoring of the input signal. For this - * purpose, the speaker volume must be set before the driver is started. + * Fudge flag4 causes the dubugging output described above to be + * recorded in the clockstats file. When the audio driver is compiled, + * fudge flag2 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. Fudge flag3 enables audio + * monitoring of the input signal. For this purpose, the monitor gain is + * set to a default value. * - * 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 + * always 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 @@ -186,13 +193,16 @@ #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 TUNE .001 /* offset for narrow filter (kHz) */ +#define DWELL 5 /* minutes in a probe cycle */ #define NCHAN 3 /* number of channels */ +#define ISTAGE 3 /* number of integrator stages */ #endif /* ICOM */ -#ifdef AUDIO_CHU -#define DESCRIPTION "CHU Modem Receiver" /* WRU */ +#ifdef HAVE_AUDIO /* * Audio demodulator definitions */ @@ -201,14 +211,16 @@ #define OFFSET 128 /* companded sample offset */ #define SIZE 256 /* decompanding table size */ #define MAXSIG 6000. /* maximum signal level */ +#define MAXCLP 100 /* max clips above reference per s */ #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 */ +#define AUDIO_BUFSIZ 240 /* audio buffer size (30 ms) */ #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 @@ -218,16 +230,19 @@ #define BURST 11 /* max characters per burst */ #define MINCHAR 9 /* min characters per burst */ #define MINDIST 28 /* min burst distance (of 40) */ +#define MINBURST 4 /* min bursts in minute */ #define MINSYNC 8 /* min sync distance (of 16) */ #define MINSTAMP 20 /* min timestamps (of 60) */ -#define PANIC (4 * 1440) /* panic restart */ +#define METRIC 50. /* min channel metric */ +#define PANIC 1440 /* panic timeout (m) */ +#define HOLD 30 /* reach hold (m) */ /* * Hex extension codes (>= 16) */ -#define HEX_MISS 16 /* miss */ -#define HEX_SOFT 17 /* soft error */ -#define HEX_HARD 18 /* hard error */ +#define HEX_MISS 16 /* miss _ */ +#define HEX_SOFT 17 /* soft error * */ +#define HEX_HARD 18 /* hard error = */ /* * Status bits (status) @@ -240,8 +255,9 @@ #define AFORMAT 0x0020 /* invalid format A data */ #define DECODE 0x0040 /* invalid data decode */ #define STAMP 0x0080 /* too few timestamps */ -#define INYEAR 0x0100 /* valid B frame */ -#define INSYNC 0x0200 /* clock synchronized */ +#define AVALID 0x0100 /* valid A frame */ +#define BVALID 0x0200 /* valid B frame */ +#define INSYNC 0x0400 /* clock synchronized */ /* * Alarm status bits (alarm) @@ -257,14 +273,31 @@ #define DECERR 0x04 /* data decoding error */ #define TSPERR 0x08 /* insufficient data */ -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO +/* + * Maximum likelihood UART structure. There are eight of these + * corresponding to the number of phases. + */ 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 */ + +#ifdef ICOM +/* + * CHU station structure. There are three of these corresponding to the + * three frequencies. + */ +struct xmtr { + double integ[ISTAGE]; /* circular integrator */ + double metric; /* integrator sum */ + int iptr; /* integrator pointer */ + int probe; /* dwells since last probe */ +}; +#endif /* ICOM */ /* * CHU unit control structure @@ -278,12 +311,13 @@ struct chuunit { l_fp charstamp; /* character time as a l_fp */ int errflg; /* error flags */ int status; /* status bits */ - int bufptr; /* buffer index pointer */ - char ident[10]; /* transmitter frequency */ + char ident[5]; /* station ID and channel */ #ifdef ICOM - int chan; /* frequency identifier */ - int dwell; /* dwell minutes at current frequency */ int fd_icom; /* ICOM file descriptor */ + int chan; /* data channel */ + int achan; /* active channel */ + int dwell; /* dwell cycle */ + struct xmtr xmtr[NCHAN]; /* station metric */ #endif /* ICOM */ /* @@ -294,7 +328,6 @@ struct chuunit { int ndx; /* buffer start index */ int prevsec; /* previous burst second */ int burdist; /* burst distance */ - int mindist; /* minimum distance */ int syndist; /* sync distance */ int burstcnt; /* format A bursts this minute */ @@ -306,14 +339,15 @@ 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 */ - int bufcnt; /* samples in buffer */ + int mongain; /* codec monitor gain */ int clipcnt; /* sample clip count */ int seccnt; /* second interval counter */ @@ -335,7 +369,7 @@ struct chuunit { struct surv surv[8]; /* UART survivor structures */ int decptr; /* decode pointer */ int dbrk; /* holdoff counter */ -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ }; /* @@ -355,19 +389,30 @@ static void chu_clear P((struct peer *)); 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 +static double chu_major P((struct peer *)); +#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 */ +#ifdef ICOM +static int chu_newchan P((struct peer *, double)); +#endif /* ICOM */ +static void chu_serial_receive P((struct recvbuf *rbufp)); /* * Global variables */ -static char hexchar[] = "0123456789abcdef_-="; +static char hexchar[] = "0123456789abcdef_*="; + #ifdef ICOM -static double qsy[NCHAN] = {3.33, 7.335, 14.67}; /* frequencies (MHz) */ +/* + * Note the tuned frequencies are 1 kHz higher than the carrier. CHU + * transmits on USB with carrier so we can use AM and the narrow SSB + * filter. + */ +static double qsy[NCHAN] = {3.330, 7.335, 14.670}; /* freq (MHz) */ #endif /* ICOM */ /* @@ -395,43 +440,51 @@ 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, AUDIO_BUFSIZ, unit); #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)); @@ -442,7 +495,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,15 +505,18 @@ chu_start( */ peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; - memcpy((char *)&pp->refid, REFID, 4); + strcpy(up->ident, "CHU"); + memcpy(&peer->refid, up->ident, 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.; @@ -472,8 +528,7 @@ chu_start( step *= 2.; } DTOLFP(1. / SECOND, &up->tick); -#endif /* AUDIO_CHU */ - strcpy(up->ident, "X"); +#endif /* HAVE_AUDIO */ #ifdef ICOM temp = 0; #ifdef DEBUG @@ -489,22 +544,17 @@ chu_start( temp); } if (up->fd_icom > 0) { - if (icom_freq(up->fd_icom, peer->ttl & 0x7f, - qsy[up->chan]) < 0) { + if (chu_newchan(peer, 0) != 0) { NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) - msyslog(LOG_ERR, - "ICOM bus error; autotune disabled"); + msyslog(LOG_NOTICE, + "icom: radio not found"); up->errflg = CEVNT_FAULT; close(up->fd_icom); up->fd_icom = 0; } else { - sprintf(up->ident, "%.1f", qsy[up->chan]); - sprintf(tbuf, "chu: QSY to %s MHz", up->ident); - record_clock_stats(&peer->srcadr, tbuf); -#ifdef DEBUG - if (debug) - printf("%s\n", tbuf); -#endif + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, + "icom: autotune enabled"); } } #endif /* ICOM */ @@ -526,21 +576,61 @@ chu_shutdown( pp = peer->procptr; up = (struct chuunit *)pp->unitptr; + if (up == NULL) + return; + io_closeclock(&pp->io); +#ifdef ICOM if (up->fd_icom > 0) close(up->fd_icom); +#endif /* 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; @@ -548,10 +638,8 @@ chu_receive( double sample; /* codec sample */ u_char *dpt; /* buffer pointer */ + int bufcnt; /* buffer counter */ l_fp ltemp; /* l_fp temp */ - int isneg; /* parity flag */ - double dtemp; - int i, j; peer = (struct peer *)rbufp->recv_srcclock; pp = peer->procptr; @@ -561,13 +649,12 @@ chu_receive( * Main loop - read until there ain't no more. Note codec * samples are bit-inverted. */ + DTOLFP((double)rbufp->recv_length / SECOND, <emp); + L_SUB(&rbufp->recv_time, <emp); up->timestamp = rbufp->recv_time; - up->bufcnt = rbufp->recv_length; - DTOLFP(up->bufcnt * 1. / SECOND, <emp); - L_SUB(&up->timestamp, <emp); - dpt = (u_char *)&rbufp->recv_space; - for (up->bufptr = 0; up->bufptr < up->bufcnt; up->bufptr++) { - sample = up->comp[~*dpt & 0xff]; + dpt = rbufp->recv_buffer; + for (bufcnt = 0; bufcnt < rbufp->recv_length; bufcnt++) { + sample = up->comp[~*dpt++ & 0xff]; /* * Clip noise spikes greater than MAXSIG. If no clips, @@ -581,56 +668,30 @@ chu_receive( sample = -MAXSIG; up->clipcnt++; } - up->seccnt = (up->seccnt + 1) % SECOND; - if (up->seccnt == 0) { - if (pp->sloppyclockflag & CLK_FLAG2) - up->port = 2; - else - up->port = 1; - chu_gain(peer); - } chu_rf(peer, sample); + L_ADD(&up->timestamp, &up->tick); /* - * During development, it is handy to have an audio - * monitor that can be switched to various signals. This - * code converts the linear signal left in up->monitor - * to codec format. If we can get the grass out of this - * thing and improve modem performance, this expensive - * code will be permanently nixed. + * Once each second ride gain. */ - isneg = 0; - dtemp = up->monitor; - if (sample < 0) { - isneg = 1; - dtemp-= dtemp; + up->seccnt = (up->seccnt + 1) % SECOND; + if (up->seccnt == 0) { + pp->second = (pp->second + 1) % 60; + chu_gain(peer); } - i = 0; - j = OFFSET >> 1; - while (j != 0) { - if (dtemp > up->comp[i]) - i += j; - else if (dtemp < up->comp[i]) - i -= j; - else - break; - j >>= 1; - } - if (isneg) - *dpt = ~(i + OFFSET); - else - *dpt = ~i; - dpt++; - L_ADD(&up->timestamp, &up->tick); } - + /* - * Squawk to the monitor speaker if enabled. + * Set the input port and monitor gain for the next buffer. */ + if (pp->sloppyclockflag & CLK_FLAG2) + up->port = 2; + else + up->port = 1; if (pp->sloppyclockflag & CLK_FLAG3) - if (write(pp->io.fd, (u_char *)&rbufp->recv_space, - (u_int)up->bufcnt) < 0) - perror("chu:"); + up->mongain = MONGAIN; + else + up->mongain = 0; } @@ -714,9 +775,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. @@ -851,14 +912,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 */ ) { @@ -879,11 +940,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( @@ -1013,13 +1073,13 @@ chu_b( * In a format B burst, a character is considered valid only if * the first occurrence matches the last occurrence. The burst * is considered valid only if all characters are valid; that - * is, only if the distance is 40. + * is, only if the distance is 40. Note that once a valid frame + * has been found errors are ignored. */ sprintf(tbuf, "chuB %04x %2d %2d ", up->status, nchar, -up->burdist); for (i = 0; i < nchar; i++) - sprintf(&tbuf[strlen(tbuf)], "%02x", - up->cbuf[i]); + sprintf(&tbuf[strlen(tbuf)], "%02x", up->cbuf[i]); if (pp->sloppyclockflag & CLK_FLAG4) record_clock_stats(&peer->srcadr, tbuf); #ifdef DEBUG @@ -1030,7 +1090,7 @@ chu_b( up->status |= BFRAME; return; } - up->status |= INYEAR; + up->status |= BVALID; /* * Convert the burst data to internal format. If this succeeds, @@ -1110,14 +1170,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]); @@ -1140,6 +1206,7 @@ chu_a( * the previous burst to the current one. */ if (temp != 0) { + pp->second = 30 + temp; offset.l_ui = 30 + temp; offset.l_f = 0; i = 0; @@ -1175,6 +1242,7 @@ chu_a( up->decode[i][(up->cbuf[j] >> 4) & 0xf]++; i++; } + up->status |= AVALID; up->burstcnt++; } @@ -1190,54 +1258,48 @@ chu_poll( { struct refclockproc *pp; struct chuunit *up; + l_fp offset; char synchar, qual, leapchar; - int minset; - int temp; -#ifdef ICOM - char tbuf[80]; /* trace buffer */ -#endif /* ICOM */ + int minset, i; + double dtemp; + pp = peer->procptr; up = (struct chuunit *)pp->unitptr; if (pp->coderecv == pp->codeproc) up->errflg = CEVNT_TIMEOUT; else pp->polls++; + + /* + * If once in sync and the radio has not been heard for awhile + * (30 m), it is no longer reachable. If not heard in a long + * while (one day), turn out the lights and start from scratch. + */ minset = ((current_time - peer->update) + 30) / 60; if (up->status & INSYNC) { if (minset > PANIC) up->status = 0; - else + else if (minset <= HOLD) peer->reach |= 1; } /* * Process the last burst, if still in the burst buffer. - * Don't mess with anything if nothing has been heard. + * Don't mess with anything if nothing has been heard. If the + * minute contains a valid A frame and valid B frame, assume + * synchronized; however, believe the time only if within metric + * threshold. Note the quality indicator is only for + * diagnostics; the data are used only if in sync and above + * metric threshold. */ chu_burst(peer); + if (up->burstcnt == 0) { #ifdef ICOM - if (up->burstcnt > 2) { - up->dwell = 0; - } else if (up->dwell < DWELL) { - up->dwell++; - } 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]); - sprintf(up->ident, "%.3f", qsy[up->chan]); - sprintf(tbuf, "chu: QSY to %s MHz", up->ident); - record_clock_stats(&peer->srcadr, tbuf); -#ifdef DEBUG - if (debug) - printf("%s\n", tbuf); -#endif - } + chu_newchan(peer, 0); #endif /* ICOM */ - if (up->burstcnt == 0) return; - temp = chu_major(peer); - if (up->status & INYEAR) - up->status |= INSYNC; + } + dtemp = chu_major(peer); qual = 0; if (up->status & (BFRAME | AFRAME)) qual |= SYNERR; @@ -1247,6 +1309,8 @@ chu_poll( qual |= DECERR; if (up->status & STAMP) qual |= TSPERR; + if (up->status & AVALID && up->status & BVALID) + up->status |= INSYNC; synchar = leapchar = ' '; if (!(up->status & INSYNC)) { pp->leap = LEAP_NOTINSYNC; @@ -1254,31 +1318,54 @@ chu_poll( } else if (up->leap & 0x2) { pp->leap = LEAP_ADDSECOND; leapchar = 'L'; + } else if (up->leap & 0x4) { + pp->leap = LEAP_DELSECOND; + leapchar = 'l'; } 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 %04d %3d %02d:%02d:%02d %c%x %+d %d %d %s %.0f %d", + synchar, qual, pp->year, pp->day, pp->hour, + pp->minute, pp->second, leapchar, up->dst, up->dut, + minset, up->gain, up->ident, dtemp, up->ntstamp); + else + sprintf(pp->a_lastcode, + "%c%1X %04d %3d %02d:%02d:%02d %c%x %+d %d %s %.0f %d", + synchar, qual, pp->year, pp->day, pp->hour, + pp->minute, pp->second, leapchar, up->dst, up->dut, + minset, up->ident, dtemp, up->ntstamp); #else sprintf(pp->a_lastcode, - "%c%1X %4d %3d %02d:%02d:%02d.000 %c%x %+d %d %s %d %d %d %d", + "%c%1X %04d %3d %02d:%02d:%02d %c%x %+d %d %s %.0f %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 */ + pp->second, leapchar, up->dst, up->dut, minset, up->ident, + dtemp, up->ntstamp); +#endif /* HAVE_AUDIO */ pp->lencode = strlen(pp->a_lastcode); /* - * If timestamps have been stuffed, the timecode is ipso fatso - * correct and can be selected to discipline the clock. + * If in sync and the signal metric is above threshold, the + * timecode is ipso fatso valid and can be selected to + * discipline the clock. Be sure not to leave stray timestamps + * around if signals are too weak or the clock time is invalid. */ - if (temp > 0) { + if (up->status & INSYNC && dtemp > METRIC) { + if (!clocktime(pp->day, pp->hour, pp->minute, 0, GMT, + up->tstamp[0].l_ui, &pp->yearstart, &offset.l_ui)) { + up->errflg = CEVNT_BADTIME; + } else { + offset.l_uf = 0; + for (i = 0; i < up->ntstamp; i++) + refclock_process_offset(pp, offset, + up->tstamp[i], FUDGE + + pp->fudgetime1); + pp->lastref = up->timestamp; + refclock_receive(peer); + } record_clock_stats(&peer->srcadr, pp->a_lastcode); - refclock_receive(peer); } else if (pp->sloppyclockflag & CLK_FLAG4) { record_clock_stats(&peer->srcadr, pp->a_lastcode); } @@ -1287,6 +1374,9 @@ chu_poll( printf("chu: timecode %d %s\n", pp->lencode, pp->a_lastcode); #endif +#ifdef ICOM + chu_newchan(peer, dtemp); +#endif /* ICOM */ chu_clear(peer); if (up->errflg) refclock_report(peer, up->errflg); @@ -1297,7 +1387,7 @@ chu_poll( /* * chu_major - majority decoder */ -static int +static double chu_major( struct peer *peer /* peer structure pointer */ ) @@ -1306,10 +1396,9 @@ chu_major( struct chuunit *up; u_char code[11]; /* decoded timecode */ - l_fp toffset, offset; /* l_fp temps */ + int mindist; /* minimum distance */ int val1, val2; /* maximum distance */ int synchar; /* stray cat */ - double dtemp; int temp; int i, j, k; @@ -1321,18 +1410,18 @@ chu_major( * digit position in the timecode. Each row of the decoding * matrix encodes the number of occurrences of each digit found * at the corresponding position. The maximum over all - * occurrences at each position is the distance for this position - * and the corresponding digit is the maximumn likelihood - * candidate. If the distance is zero, assume a miss '_'; if the - * distance is not more than half the total number of - * occurrences, assume a soft error '-'; if two different digits - * with the same distance are found, assume a hard error '='. - * These will later cause a format error when the timecode is - * interpreted. The decoding distance is defined as the minimum - * distance over the first nine digits. The tenth digit varies - * over the seconds, so we don't count it. + * occurrences at each position is the distance for this + * position and the corresponding digit is the maximum + * likelihood candidate. If the distance is zero, assume a miss + * '_'; if the distance is not more than half the total number + * of occurrences, assume a soft error '*'; if two different + * digits with the same distance are found, assume a hard error + * '='. These will later cause a format error when the timecode + * is interpreted. The decoding distance is defined as the + * minimum distance over the first nine digits. The tenth digit + * varies over the seconds, so we don't count it. */ - up->mindist = 16; + mindist = 16; for (i = 0; i < 9; i++) { val1 = val2 = 0; k = 0; @@ -1352,19 +1441,18 @@ chu_major( code[i] = HEX_SOFT; else code[i] = k; - if (val1 < up->mindist) - up->mindist = val1; + if (val1 < mindist) + mindist = val1; code[i] = hexchar[code[i]]; } code[i] = 0; /* - * A valid timecode requires at least three bursts and a - * decoding distance greater than half the total number of - * occurrences. A valid timecode also requires at least 20 valid - * timestamps. + * A valid timecode requires a minimum distance at least half + * the total number of occurrences. A valid timecode also + * requires at least 20 valid timestamps. */ - if (up->burstcnt < 3 || up->mindist <= up->burstcnt) + if (up->burstcnt < MINBURST || mindist < up->burstcnt) up->status |= DECODE; if (up->ntstamp < MINSTAMP) up->status |= STAMP; @@ -1385,21 +1473,7 @@ chu_major( up->errflg = CEVNT_BADREPLY; return (0); } - L_CLR(&offset); - if (!clocktime(pp->day, pp->hour, pp->minute, 0, GMT, - up->tstamp[0].l_ui, &pp->yearstart, &offset.l_ui)) { - up->errflg = CEVNT_BADTIME; - return (0); - } - pp->lastref = offset; - pp->variance = 0; - for (i = 0; i < up->ntstamp; i++) { - toffset = offset; - L_SUB(&toffset, &up->tstamp[i]); - LFPTOD(&toffset, dtemp); - SAMPLE(dtemp + FUDGE + pp->fudgetime1); - } - return (i); + return (mindist * 100. / (2. * up->burstcnt)); } @@ -1422,15 +1496,120 @@ chu_clear( * Clear stuff for the minute. */ up->ndx = up->prevsec = 0; - up->burstcnt = up->mindist = up->ntstamp = 0; - up->status &= INSYNC | INYEAR; - up->burstcnt = 0; + up->burstcnt = up->ntstamp = 0; + up->status &= INSYNC; for (i = 0; i < 20; i++) { for (j = 0; j < 16; j++) up->decode[i][j] = 0; } } +#ifdef ICOM +/* + * chu_newchan - called once per minute to find the best channel; + * returns zero on success, nonzero if ICOM error. + */ +static int +chu_newchan( + struct peer *peer, + double met + ) +{ + struct chuunit *up; + struct refclockproc *pp; + struct xmtr *sp; + char tbuf[80]; /* trace buffer */ + int rval; + double metric; + int i, j; + + pp = peer->procptr; + up = (struct chuunit *)pp->unitptr; + + /* + * The radio can be tuned to three channels: 0 (3330 kHz), 1 + * (7335 kHz) and 2 (14670 kHz). There are five one-minute + * dwells in each cycle. During the first dwell the radio is + * tuned to one of three probe channels; during the remaining + * four dwells the radio is tuned to the data channel. The probe + * channel is selects as the least recently used. At the end of + * each dwell the channel metrics are measured and the highest + * one is selected as the data channel. + */ + if (up->fd_icom <= 0) + return (0); + + sp = &up->xmtr[up->achan]; + sp->metric -= sp->integ[sp->iptr]; + sp->integ[sp->iptr] = met; + sp->metric += sp->integ[sp->iptr]; + sp->iptr = (sp->iptr + 1) % ISTAGE; + metric = 0; + j = 0; + for (i = 0; i < NCHAN; i++) { + up->xmtr[i].probe++; + if (i == up->achan) + up->xmtr[i].probe = 0; + if (up->xmtr[i].metric < metric) + continue; + metric = up->xmtr[i].metric; + j = i; + } + if (j != up->chan && metric > 0) { + up->chan = j; + sprintf(tbuf, "chu: QSY to %.3f MHz metric %.0f", + qsy[up->chan], metric); + if (pp->sloppyclockflag & CLK_FLAG4) + record_clock_stats(&peer->srcadr, tbuf); +#ifdef DEBUG + if (debug) + printf("%s\n", tbuf); +#endif + } + + /* + * Start the next dwell. We speed up the initial sync a little. + * If not in sync and no bursts were heard the previous dwell, + * restart the probe. + */ + rval = 0; + if (up->burstcnt == 0 && !(up->status & INSYNC)) + up->dwell = 0; +#ifdef DEBUG + if (debug) + printf( + "chu: at %ld dwell %d achan %d metric %.0f chan %d\n", + current_time, up->dwell, up->achan, sp->metric, + up->chan); +#endif + if (up->dwell == 0) { + rval = 0; + for (i = 0; i < NCHAN; i++) { + if (up->xmtr[i].probe < rval) + continue; + rval = up->xmtr[i].probe; + up->achan = i; + } + rval = icom_freq(up->fd_icom, peer->ttl & 0x7f, + qsy[up->achan] + TUNE); +#ifdef DEBUG + if (debug) + printf("chu: at %ld probe channel %d\n", + current_time, up->achan); +#endif + } else { + if (up->achan != up->chan) { + rval = icom_freq(up->fd_icom, peer->ttl & 0x7f, + qsy[up->chan] + TUNE); + up->achan = up->chan; + } + } + sprintf(up->ident, "CHU%d", up->achan); + memcpy(&peer->refid, up->ident, 4); + up->dwell = (up->dwell + 1) % DWELL; + return (rval); +} +#endif /* ICOM */ /* * chu_dist - determine the distance of two octet arguments @@ -1464,7 +1643,7 @@ chu_dist( } -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO /* * chu_gain - adjust codec gain * @@ -1492,17 +1671,17 @@ chu_gain( */ if (up->clipcnt == 0) { up->gain += 4; - if (up->gain > 255) - up->gain = 255; - } else if (up->clipcnt > SECOND / 100) { + if (up->gain > MAXGAIN) + up->gain = MAXGAIN; + } else if (up->clipcnt > MAXCLP) { up->gain -= 4; if (up->gain < 0) up->gain = 0; } - audio_gain(up->gain, up->port); + audio_gain(up->gain, up->mongain, up->port); up->clipcnt = 0; } -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ #else diff --git a/dist/ntp/ntpd/refclock_conf.c b/dist/ntp/ntpd/refclock_conf.c index 06d4624e903b..06ef23d96f8c 100644 --- a/dist/ntp/ntpd/refclock_conf.c +++ b/dist/ntp/ntpd/refclock_conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_conf.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_conf.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_conf.c - reference clock configuration diff --git a/dist/ntp/ntpd/refclock_datum.c b/dist/ntp/ntpd/refclock_datum.c index 0ac7224a8232..9364a73606c6 100644 --- a/dist/ntp/ntpd/refclock_datum.c +++ b/dist/ntp/ntpd/refclock_datum.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_datum.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_datum.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* ** refclock_datum - clock driver for the Datum Programmable Time Server diff --git a/dist/ntp/ntpd/refclock_dumbclock.c b/dist/ntp/ntpd/refclock_dumbclock.c index 9ef3057bf643..ce7dbb34c6a1 100644 --- a/dist/ntp/ntpd/refclock_dumbclock.c +++ b/dist/ntp/ntpd/refclock_dumbclock.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_dumbclock.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_dumbclock.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_dumbclock - clock driver for a unknown time distribution system diff --git a/dist/ntp/ntpd/refclock_fg.c b/dist/ntp/ntpd/refclock_fg.c index 134ef33448b0..5106584a705b 100644 --- a/dist/ntp/ntpd/refclock_fg.c +++ b/dist/ntp/ntpd/refclock_fg.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_fg.c,v 1.2 2001/12/04 17:56:31 wiz Exp $ */ +/* $NetBSD: refclock_fg.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_fg - clock driver for the Forum Graphic GPS datating station @@ -10,8 +10,6 @@ #if defined(REFCLOCK) && defined(CLOCK_FG) -#include - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" @@ -303,14 +301,14 @@ fg_receive( { pp->minute = BP1(7)*10 + BP2(7); pp->second = BP1(8)*10 + BP2(8); - pp->msec = BP1(9)*10 + BP2(9); - pp->usec = BP1(10); + pp->nsec = (BP1(9)*10 + BP2(9)) * 1000000; + pp->nsec += BP1(10) * 1000; } else { pp->hour = BP1(5)*10 + BP2(5); pp->minute = BP1(6)*10 + BP2(6); pp->second = BP1(7)*10 + BP2(7); - pp->msec = BP1(8)*10 + BP2(8); - pp->usec = BP1(9); + pp->nsec = (BP1(8)*10 + BP2(8)) * 1000000; + pp->nsec += BP1(9) * 1000; } if((pp->hour == 10) && (pp->minute == 10)) @@ -341,7 +339,7 @@ fg_receive( if (!refclock_process(pp)) refclock_report(peer, CEVNT_BADTIME); - + pp->lastref = pp->lastrec; refclock_receive(peer); return; } diff --git a/dist/ntp/ntpd/refclock_gpsvme.c b/dist/ntp/ntpd/refclock_gpsvme.c index bfe5eb942062..8b793a690efa 100644 --- a/dist/ntp/ntpd/refclock_gpsvme.c +++ b/dist/ntp/ntpd/refclock_gpsvme.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_gpsvme.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_gpsvme.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_gpsvme.c NTP clock driver for the TrueTime GPS-VME diff --git a/dist/ntp/ntpd/refclock_heath.c b/dist/ntp/ntpd/refclock_heath.c index b9ac3d48a47e..2e97bf8dadc9 100644 --- a/dist/ntp/ntpd/refclock_heath.c +++ b/dist/ntp/ntpd/refclock_heath.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_heath.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_heath.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_heath - clock driver for Heath GC-1000 and and GC-1000 II diff --git a/dist/ntp/ntpd/refclock_hopfpci.c b/dist/ntp/ntpd/refclock_hopfpci.c index 818d75205e16..4962c8213efc 100644 --- a/dist/ntp/ntpd/refclock_hopfpci.c +++ b/dist/ntp/ntpd/refclock_hopfpci.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_hopfpci.c,v 1.1.1.1 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_hopfpci.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_hopfpci.c diff --git a/dist/ntp/ntpd/refclock_hopfser.c b/dist/ntp/ntpd/refclock_hopfser.c index 1618eddae119..d264c418f71c 100644 --- a/dist/ntp/ntpd/refclock_hopfser.c +++ b/dist/ntp/ntpd/refclock_hopfser.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_hopfser.c,v 1.1.1.1 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_hopfser.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * diff --git a/dist/ntp/ntpd/refclock_hpgps.c b/dist/ntp/ntpd/refclock_hpgps.c index 2fcb21a7b1fd..ee8b2908f450 100644 --- a/dist/ntp/ntpd/refclock_hpgps.c +++ b/dist/ntp/ntpd/refclock_hpgps.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_hpgps.c,v 1.1.1.2 2003/12/04 16:05:27 drochner Exp $ */ +/* $NetBSD: refclock_hpgps.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_hpgps - clock driver for HP 58503A GPS receiver diff --git a/dist/ntp/ntpd/refclock_irig.c b/dist/ntp/ntpd/refclock_irig.c index 8c63046612ad..1add4b44ce65 100644 --- a/dist/ntp/ntpd/refclock_irig.c +++ b/dist/ntp/ntpd/refclock_irig.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_irig.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_irig.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_irig - audio IRIG-B/E demodulator/decoder diff --git a/dist/ntp/ntpd/refclock_jjy.c b/dist/ntp/ntpd/refclock_jjy.c index a242cf2d1052..ef6c628bc0a6 100644 --- a/dist/ntp/ntpd/refclock_jjy.c +++ b/dist/ntp/ntpd/refclock_jjy.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_jjy.c,v 1.1.1.1 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_jjy.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_jjy - clock driver for JJY receivers diff --git a/dist/ntp/ntpd/refclock_jupiter.c b/dist/ntp/ntpd/refclock_jupiter.c index 450215a588ef..33945f4d2e75 100644 --- a/dist/ntp/ntpd/refclock_jupiter.c +++ b/dist/ntp/ntpd/refclock_jupiter.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_jupiter.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_jupiter.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * Copyright (c) 1997, 1998, 2003 diff --git a/dist/ntp/ntpd/refclock_leitch.c b/dist/ntp/ntpd/refclock_leitch.c index f12d1f4de712..424de2c67966 100644 --- a/dist/ntp/ntpd/refclock_leitch.c +++ b/dist/ntp/ntpd/refclock_leitch.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_leitch.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_leitch.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_leitch - clock driver for the Leitch CSD-5300 Master Clock diff --git a/dist/ntp/ntpd/refclock_local.c b/dist/ntp/ntpd/refclock_local.c index df9c756eb985..41db45d3a487 100644 --- a/dist/ntp/ntpd/refclock_local.c +++ b/dist/ntp/ntpd/refclock_local.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_local.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_local.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* diff --git a/dist/ntp/ntpd/refclock_msfees.c b/dist/ntp/ntpd/refclock_msfees.c index 60806262161a..6643b64e9ff8 100644 --- a/dist/ntp/ntpd/refclock_msfees.c +++ b/dist/ntp/ntpd/refclock_msfees.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_msfees.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_msfees.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* refclock_ees - clock driver for the EES M201 receiver */ diff --git a/dist/ntp/ntpd/refclock_mx4200.c b/dist/ntp/ntpd/refclock_mx4200.c index 2050ed40d552..de731c6ec323 100644 --- a/dist/ntp/ntpd/refclock_mx4200.c +++ b/dist/ntp/ntpd/refclock_mx4200.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_mx4200.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_mx4200.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * This software was developed by the Computer Systems Engineering group diff --git a/dist/ntp/ntpd/refclock_neoclock4x.c b/dist/ntp/ntpd/refclock_neoclock4x.c index d3b861569dba..3879ec2bd08f 100644 --- a/dist/ntp/ntpd/refclock_neoclock4x.c +++ b/dist/ntp/ntpd/refclock_neoclock4x.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_neoclock4x.c,v 1.1.1.1 2003/12/04 16:05:30 drochner Exp $ */ +/* $NetBSD: refclock_neoclock4x.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * diff --git a/dist/ntp/ntpd/refclock_nmea.c b/dist/ntp/ntpd/refclock_nmea.c index abbe2ab5b8a0..ddfbeb01ecc9 100644 --- a/dist/ntp/ntpd/refclock_nmea.c +++ b/dist/ntp/ntpd/refclock_nmea.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_nmea.c,v 1.1.1.2 2003/12/04 16:05:28 drochner Exp $ */ +/* $NetBSD: refclock_nmea.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_nmea.c - clock driver for an NMEA GPS CLOCK diff --git a/dist/ntp/ntpd/refclock_oncore.c b/dist/ntp/ntpd/refclock_oncore.c index 5c7a7217e2fe..d61ff8589076 100644 --- a/dist/ntp/ntpd/refclock_oncore.c +++ b/dist/ntp/ntpd/refclock_oncore.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_oncore.c,v 1.2 2000/04/22 15:49:33 simonb Exp $ */ +/* $NetBSD: refclock_oncore.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * ---------------------------------------------------------------------------- @@ -11,12 +11,16 @@ * 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, M12+T + * The receivers with TRAIM (VP, UT, UT+, M12+T), will be more accurate + * than the others. + * The receivers without position hold (GT, GT+) will be less accurate. * * Tested with: * * (UT) (VP) * COPYRIGHT 1991-1997 MOTOROLA INC. COPYRIGHT 1991-1996 MOTOROLA INC. - * SFTW P/N # 98-P36848P SFTW P/N # 98-P36830P + * SFTW P/N # 98-P36848P SFTW P/N # 98-P36830P * SOFTWARE VER # 2 SOFTWARE VER # 8 * SOFTWARE REV # 2 SOFTWARE REV # 8 * SOFTWARE DATE APR 24 1998 SOFTWARE DATE 06 Aug 1996 @@ -26,14 +30,26 @@ * MANUFACTUR DATE 6H07 MANUFACTUR DATE 7E02 * OPTIONS LIST IB * + * (Basic) (M12) + * COPYRIGHT 1991-1994 MOTOROLA INC. COPYRIGHT 1991-2000 MOTOROLA INC. + * SFTW P/N # 98-P39949M SFTW P/N # 61-G10002A + * SOFTWARE VER # 5 SOFTWARE VER # 1 + * SOFTWARE REV # 0 SOFTWARE REV # 3 + * SOFTWARE DATE 20 JAN 1994 SOFTWARE DATE Mar 13 2000 + * MODEL # A11121P116 MODEL # P143T12NR1 + * HDWR P/N # _ HWDR P/N # 1 + * SERIAL # SSG0049809 SERIAL # P003UD + * MANUFACTUR DATE 417AMA199 MANUFACTUR DATE 0C27 + * OPTIONS LIST AB + * * -------------------------------------------------------------------------- * 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 Sep98. * Original code written for FreeBSD. @@ -60,7 +76,7 @@ /* * 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. @@ -70,12 +86,16 @@ #include #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 #include -#include -#include #include #ifdef ONCORE_SHMEM_STATUS # ifdef HAVE_SYS_MMAN_H @@ -87,11 +107,11 @@ #endif /* ONCORE_SHMEM_STATUS */ #ifdef HAVE_PPSAPI -# ifdef HAVE_TIMEPPS_H -# include +# ifdef HAVE_TIMEPPS_H +# include # else # ifdef HAVE_SYS_TIMEPPS_H -# include +# include # endif # endif #endif @@ -100,14 +120,8 @@ # include #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 +# include #endif #ifdef HAVE_SYS_PPSCLOCK_H @@ -116,7 +130,7 @@ #ifndef HAVE_STRUCT_PPSCLOCKEV struct ppsclockev { -# ifdef HAVE_TIMESPEC +# ifdef HAVE_STRUCT_TIMESPEC struct timespec tv; # else struct timeval tv; @@ -127,102 +141,220 @@ struct ppsclockev { enum receive_state { ONCORE_NO_IDEA, + ONCORE_CHECK_ID, + ONCORE_CHECK_CHAN, + ONCORE_HAVE_CHAN, 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 }; +enum antenna_state { + ONCORE_ANTENNA_UNKNOWN = -1, + ONCORE_ANTENNA_OK = 0, + ONCORE_ANTENNA_OC = 1, + ONCORE_ANTENNA_UC = 2, + ONCORE_ANTENNA_NV = 3 +}; + +/* 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 */ + int shmemfd; /* Status shm descriptor */ #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; + enum antenna_state ant_state; /* antenna state */ int Bj_day; - long delay; /* ns */ + u_long delay; /* ns */ long offset; /* ns */ u_char *shmem; - u_int shmem_Cb; - u_int shmem_Ea; + char *shmem_fname; + u_int shmem_Cb; + u_int shmem_Ba; + u_int shmem_Ea; + u_int shmem_Ha; + u_char shmem_reset; + u_char shmem_Posn; + u_char shmem_bad_Ea; + u_char almanac_from_shmem; 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; - int pollcnt; - u_int ev_serial; + 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, M12+T, -1 unknown, 0 no, +1 yes */ + + /* the following 7 are all timing counters */ + u_char traim_delay; /* seconds counter, waiting for reply */ + u_char count; /* cycles thru Ea before starting */ + u_char count1; /* cycles thru Ea after SS_TESTING, waiting for SS_HW */ + u_char count2; /* cycles thru Ea after count, to check for @@Ea */ + u_char count3; /* cycles thru Ea checking for # channels */ + u_char count4; /* cycles thru leap after Gj to issue Bj */ + u_char pollcnt; + u_char timeout; /* count to retry Cj after Fa self-test */ + + struct RSM rsm; /* bits extracted from Receiver Status Msg in @@Ea */ + u_char printed; + u_char polled; + u_long ev_serial; int Rcvptr; u_char Rcvbuf[500]; - u_char Ea[77]; - u_char En[70]; + u_char BEHa[160]; /* Ba, Ea or Ha */ + u_char BEHn[80]; /* Bn , En , or Hn */ u_char Cj[300]; - u_char shmem_first; - u_char shmem_reset; - u_char shmem_Posn; - u_char As; - u_char Ay; - u_char Az; + u_char Ag; /* Satellite mask angle */ + u_char saw_At; + u_char saw_Ay; + u_char saw_Az; + s_char saw_Gj; + 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; + s_char chan_in; /* chan number from INPUT, will always use it */ + u_char chan_id; /* chan number determined from part number */ + u_char chan_ck; /* chan number determined by sending commands to hardware */ + s_char traim_in; /* TRAIM from INPUT, will always use it */ + s_char traim_id; /* TRAIM determined from part number */ + u_char traim_ck; /* TRAIM determined by sending commands to hardware */ + u_char once; /* one pass code at top of BaEaHa */ + s_char assert; + u_char hardpps; }; #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 int oncore_start P((int, struct peer *)); +static void oncore_control P((int, struct refclockstat *, struct refclockstat *, struct peer *)); +static void oncore_poll P((int, struct peer *)); +static void oncore_shutdown P((int, struct peer *)); +static void oncore_consume P((struct instance *)); +static void oncore_read_config P((struct instance *)); +static void oncore_receive P((struct recvbuf *)); +static int oncore_ppsapi P((struct instance *)); +static void oncore_get_timestamp P((struct instance *, long, long)); +static void oncore_init_shmem P((struct instance *)); -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_antenna_report P((struct instance *, enum antenna_state)); +static void oncore_chan_test P((struct instance *)); +static void oncore_check_almanac P((struct instance *)); +static void oncore_check_antenna P((struct instance *)); +static void oncore_check_leap_sec P((struct instance *)); +static int oncore_checksum_ok P((u_char *, int)); +static void oncore_compute_dH P((struct instance *)); +static void oncore_load_almanac P((struct instance *)); +static void oncore_print_Cb P((struct instance *, u_char *)); +/* static void oncore_print_array P((u_char *, int)); */ +static void oncore_print_posn P((struct instance *)); +static void oncore_sendmsg P((int, u_char *, size_t)); +static void oncore_set_posn P((struct instance *)); +static void oncore_set_traim P((struct instance *)); +static void oncore_shmem_get_3D P((struct instance *)); +static void oncore_ss P((struct instance *)); +static int oncore_wait_almanac P((struct instance *)); + +static void oncore_msg_any P((struct instance *, u_char *, size_t, int)); +static void oncore_msg_Adef P((struct instance *, u_char *, size_t)); +static void oncore_msg_Ag P((struct instance *, u_char *, size_t)); +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_Bd P((struct instance *, u_char *, size_t)); +static void oncore_msg_Bj P((struct instance *, u_char *, size_t)); +static void oncore_msg_BnEnHn 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_Ga P((struct instance *, u_char *, size_t)); +static void oncore_msg_Gb P((struct instance *, u_char *, size_t)); +static void oncore_msg_Gd 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 */ oncore_shutdown, /* shut down driver */ oncore_poll, /* transmit poll message */ - noentry, /* not used */ + oncore_control, /* fudge (flag) control messages */ noentry, /* not used */ noentry, /* not used */ NOFLAGS /* not used */ @@ -230,146 +362,134 @@ 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, "" }, - { "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, "" }, - { "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" }, + { "Bn", 59, oncore_msg_BnEnHn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffC" }, + { "En", 69, oncore_msg_BnEnHn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffsffffsffffC" }, + { "Hn", 78, oncore_msg_BnEnHn, "" }, + { "Ab", 10, 0, "" }, + { "Ac", 11, 0, "" }, + { "Ad", 11, oncore_msg_Adef, "" }, + { "Ae", 11, oncore_msg_Adef, "" }, + { "Af", 15, oncore_msg_Adef, "" }, + { "Ag", 8, oncore_msg_Ag, "" }, /* Satellite mask angle */ + { "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, "" }, + { "Bd", 23, oncore_msg_Bd, "" }, + { "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, "" }, + { "Ga", 20, oncore_msg_Ga, "" }, + { "Gb", 17, oncore_msg_Gb, "" }, + { "Gc", 8, 0, "" }, + { "Gd", 8, oncore_msg_Gd, "" }, + { "Ge", 8, 0, "" }, + { "Gj", 21, oncore_msg_Gj, "" }, + { "Ia", 10, oncore_msg_CaFaIa, "" }, + { "Sz", 8, oncore_msg_Sz, "" }, + { {0}, 7, 0, "" } }; -/* - * 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 }; -/* - * Position-Hold Mode - * Start automatic site survey - */ -static u_char oncore_cmd_At[] = { 'A', 't', 2 }; +static u_char oncore_cmd_Aa[] = { 'A', 'a', 0, 0, 0 }; /* 6/8 Time of Day */ +static u_char oncore_cmd_Ab[] = { 'A', 'b', 0, 0, 0 }; /* 6/8 GMT Correction */ +static u_char oncore_cmd_AB[] = { 'A', 'B', 4 }; /* VP Application Type: Static */ +static u_char oncore_cmd_Ac[] = { 'A', 'c', 0, 0, 0, 0 }; /* 6/8 Date */ +static u_char oncore_cmd_Ad[] = { 'A', 'd', 0,0,0,0 }; /* 6/8 Latitude */ +static u_char oncore_cmd_Ae[] = { 'A', 'e', 0,0,0,0 }; /* 6/8 Longitude */ +static u_char oncore_cmd_Af[] = { 'A', 'f', 0,0,0,0, 0 }; /* 6/8 Height */ +static u_char oncore_cmd_Ag[] = { 'A', 'g', 0 }; /* 6/8/12 Satellite Mask Angle */ +static u_char oncore_cmd_Agx[] = { 'A', 'g', 0xff }; /* 6/8/12 Satellite Mask Angle: read */ +static u_char oncore_cmd_As[] = { 'A', 's', 0,0,0,0, 0,0,0,0, 0,0,0,0, 0 }; /* 6/8/12 Posn Hold Parameters */ +static u_char oncore_cmd_Asx[] = { 'A', 's', 0x7f,0xff,0xff,0xff, /* 6/8/12 Posn Hold Readback */ + 0x7f,0xff,0xff,0xff, /* on UT+ this doesnt work with 0xff */ + 0x7f,0xff,0xff,0xff, 0xff }; /* but does work with 0x7f (sigh). */ +static u_char oncore_cmd_At0[] = { 'A', 't', 0 }; /* 6/8 Posn Hold: off */ +static u_char oncore_cmd_At1[] = { 'A', 't', 1 }; /* 6/8 Posn Hold: on */ +static u_char oncore_cmd_At2[] = { 'A', 't', 2 }; /* 6/8 Posn Hold: Start Site Survey */ +static u_char oncore_cmd_Atx[] = { 'A', 't', 0xff }; /* 6/8 Posn Hold: Read Back */ +static u_char oncore_cmd_Au[] = { 'A', 'u', 0,0,0,0, 0 }; /* GT/M12 Altitude Hold Ht. */ +static u_char oncore_cmd_Av0[] = { 'A', 'v', 0 }; /* VP/GT Altitude Hold: off */ +static u_char oncore_cmd_Av1[] = { 'A', 'v', 1 }; /* VP/GT Altitude Hold: on */ +static u_char oncore_cmd_Aw[] = { 'A', 'w', 1 }; /* 6/8/12 UTC/GPS time selection */ +static u_char oncore_cmd_Ay[] = { 'A', 'y', 0, 0, 0, 0 }; /* Timing 1PPS time offset: set */ +static u_char oncore_cmd_Ayx[] = { 'A', 'y', 0xff, 0xff, 0xff, 0xff }; /* Timing 1PPS time offset: Read */ +static u_char oncore_cmd_Az[] = { 'A', 'z', 0, 0, 0, 0 }; /* 6/8UT/12 1PPS Cable Delay: set */ +static u_char oncore_cmd_Azx[] = { 'A', 'z', 0xff, 0xff, 0xff, 0xff }; /* 6/8UT/12 1PPS Cable Delay: Read */ +static u_char oncore_cmd_Ba0[] = { 'B', 'a', 0 }; /* 6 Position/Data/Status: off */ +static u_char oncore_cmd_Ba[] = { 'B', 'a', 1 }; /* 6 Position/Data/Status: on */ +static u_char oncore_cmd_Bb[] = { 'B', 'b', 1 }; /* 6/8/12 Visible Satellites */ +static u_char oncore_cmd_Bd[] = { 'B', 'd', 1 }; /* 6/8/12? Almanac Status Msg. */ +static u_char oncore_cmd_Be[] = { 'B', 'e', 1 }; /* 6/8/12 Request Almanac Data */ +static u_char oncore_cmd_Bj[] = { 'B', 'j', 0 }; /* 6/8 Leap Second Pending */ +static u_char oncore_cmd_Bn0[] = { 'B', 'n', 0, 1, 0,10, 2, 0,0,0, 0,0,0,0,0,0,0 }; /* 6 TRAIM setup/status: msg off, traim on */ +static u_char oncore_cmd_Bn[] = { 'B', 'n', 1, 1, 0,10, 2, 0,0,0, 0,0,0,0,0,0,0 }; /* 6 TRAIM setup/status: msg on traim on */ +static u_char oncore_cmd_Bnx[] = { 'B', 'n', 1, 0, 0,10, 2, 0,0,0, 0,0,0,0,0,0,0 }; /* 6 TRAIM setup/status: msg on traim off */ +static u_char oncore_cmd_Ca[] = { 'C', 'a' }; /* 6 Self Test */ +static u_char oncore_cmd_Cf[] = { 'C', 'f' }; /* 6/8/12 Set to Defaults */ +static u_char oncore_cmd_Cg[] = { 'C', 'g', 1 }; /* VP Posn Fix/Idle Mode */ +static u_char oncore_cmd_Cj[] = { 'C', 'j' }; /* 6/8/12 Receiver ID */ +static u_char oncore_cmd_Ea0[] = { 'E', 'a', 0 }; /* 8 Position/Data/Status: off */ +static u_char oncore_cmd_Ea[] = { 'E', 'a', 1 }; /* 8 Position/Data/Status: on */ +static u_char oncore_cmd_Ek[] = { 'E', 'k', 0 }; /* just turn off */ /* 8 Posn/Status/Data - extension */ +static u_char oncore_cmd_En0[] = { 'E', 'n', 0, 1, 0,10, 2, 0,0,0, 0,0,0,0,0,0,0 }; /* 8/GT TRAIM setup/status: msg off, traim on */ +static u_char oncore_cmd_En[] = { 'E', 'n', 1, 1, 0,10, 2, 0,0,0, 0,0,0,0,0,0,0 }; /* 8/GT TRAIM setup/status: msg on traim on */ +static u_char oncore_cmd_Enx[] = { 'E', 'n', 1, 0, 0,10, 2, 0,0,0, 0,0,0,0,0,0,0 }; /* 8/GT TRAIM setup/status: msg on traim off */ +static u_char oncore_cmd_Fa[] = { 'F', 'a' }; /* 8 Self Test */ +static u_char oncore_cmd_Ga[] = { 'G', 'a', 0,0,0,0, 0,0,0,0, 0,0,0,0, 0 }; /* 12 Position Set */ +static u_char oncore_cmd_Gax[] = { 'G', 'a', 0xff, 0xff, 0xff, 0xff, /* 12 Position Set: Read */ + 0xff, 0xff, 0xff, 0xff, /* */ + 0xff, 0xff, 0xff, 0xff, 0xff }; /* */ +static u_char oncore_cmd_Gb[] = { 'G', 'b', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* 12 set Date/Time */ +static u_char oncore_cmd_Gc[] = { 'G', 'c', 1 }; /* 12 PPS Control: On Cont */ +static u_char oncore_cmd_Gd0[] = { 'G', 'd', 0 }; /* 12 Position Control: 3D (no hold) */ +static u_char oncore_cmd_Gd1[] = { 'G', 'd', 1 }; /* 12 Position Control: 0D (3D hold) */ +static u_char oncore_cmd_Gd2[] = { 'G', 'd', 2 }; /* 12 Position Control: 2D (Alt Hold) */ +static u_char oncore_cmd_Gd3[] = { 'G', 'd', 3 }; /* 12 Position Coltrol: Start Site Survey */ +static u_char oncore_cmd_Ge0[] = { 'G', 'e', 0 }; /* M12+T TRAIM: off */ +static u_char oncore_cmd_Ge[] = { 'G', 'e', 1 }; /* M12+T TRAIM: on */ +static u_char oncore_cmd_Gj[] = { 'G', 'j' }; /* 8?/12 Leap Second Pending */ +static u_char oncore_cmd_Ha0[] = { 'H', 'a', 0 }; /* 12 Position/Data/Status: off */ +static u_char oncore_cmd_Ha[] = { 'H', 'a', 1 }; /* 12 Position/Data/Status: on */ +static u_char oncore_cmd_Hn0[] = { 'H', 'n', 0 }; /* 12 TRAIM Status: off */ +static u_char oncore_cmd_Hn[] = { 'H', 'n', 1 }; /* 12 TRAIM Status: on */ +static u_char oncore_cmd_Ia[] = { 'I', 'a' }; /* 12 Self Test */ -/* - * 0D/2D Position and Set. +/* it appears that as of 1997/1998, the UT had As,At, but not Au,Av + * the GT had Au,Av, but not As,At + * This was as of v2.0 of both firmware sets. possibly 1.3 for UT. + * Bj in UT at v1.3 + * dont see Bd in UT/GT thru 1999 + * Gj in UT as of 3.0, 1999 , Bj as of 1.3 */ -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_Av[] = { 'A', 'v', 0 }; - -/* - * Set to UTC time (not GPS). - */ -u_char oncore_cmd_Aw[] = { 'A', 'w', 1 }; - -/* - * Output Almanac when it changes - */ -u_char oncore_cmd_Be[] = { 'B', 'e', 1 }; - -/* - * Read back PPS Offset for Output - */ -u_char oncore_cmd_Ay[] = { 'A', 'y', 0, 0, 0, 0 }; -u_char oncore_cmd_Ayx[] = { 'A', 'y', 0xff, 0xff, 0xff, 0xff }; - -/* - * Read back Cable Delay for Output - */ -u_char oncore_cmd_Az[] = { 'A', 'z', 0, 0, 0, 0 }; -u_char oncore_cmd_Azx[] = { 'A', 'z', 0xff, 0xff, 0xff, 0xff }; - -/* - * Application type = static. - */ -u_char oncore_cmd_AB[] = { 'A', 'B', 4 }; - -/* - * Visible Satellite Status Msg. - */ -u_char oncore_cmd_Bb[] = { 'B', 'b', 1 }; - -/* - * Leap Second Pending Message - * Request message once - */ -u_char oncore_cmd_Bj[] = { 'B', 'j', 0 }; - -/* - * Set to Defaults - */ -static u_char oncore_cmd_Cf[] = { 'C', 'f' }; - -/* - * Set to Position Fix mode (only needed on VP). - */ -u_char oncore_cmd_Cg[] = { 'C', 'g', 1 }; - -/* - * Receiver Id - */ -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 }; - -/* - * Position/Status Extension Msg - */ -u_char oncore_cmd_Ek[] = { 'E', 'k', 0 }; /* just turn off */ - -/* - * Time Raim Setup & Status Message - * Send once per second - * Time-RAIM on - * 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 }; - -/* - * Self-test - */ -static u_char oncore_cmd_Fa[] = { 'F', 'a' }; +static char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jly", + "Aug", "Sep", "Oct", "Nov", "Dec" }; #define DEVICE1 "/dev/oncore.serial.%d" /* name of serial device */ #define DEVICE2 "/dev/oncore.pps.%d" /* name of pps device */ @@ -383,7 +503,7 @@ static u_char oncore_cmd_Fa[] = { 'F', 'a' }; */ /* to buffer, int w, u_char *buf */ -#define w32_buf(buf,w) { u_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; \ @@ -399,13 +519,11 @@ static u_char oncore_cmd_Fa[] = { 'F', 'a' }; /* from buffer, char *buf, result to an int */ #define buf_w32(buf) (((buf)[0]&0200) ? (-(~w32(buf)+1)) : w32(buf)) -extern int pps_assert; -extern int pps_hardpps; - /* * oncore_start - initialize data for processing */ + static int oncore_start( int unit, @@ -414,7 +532,7 @@ oncore_start( { register struct instance *instance; struct refclockproc *pp; - int fd1, fd2, mode; + int fd1, fd2; char device1[30], device2[30]; const char *cp; struct stat stat1, stat2; @@ -443,6 +561,14 @@ oncore_start( exit(1); } + /* create instance structure for this unit */ + + if (!(instance = (struct instance *) malloc(sizeof *instance))) { + perror("malloc"); + return (0); + } + memset((char *) instance, 0, sizeof *instance); + if ((stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino)) { /* same device here */ if (!(fd1 = refclock_open(device1, SPEED, LDISC_RAW @@ -454,7 +580,7 @@ oncore_start( exit(1); } fd2 = fd1; - } else { /* different devices here */ + } else { /* different devices here */ if (!(fd1=refclock_open(device1, SPEED, LDISC_RAW))) { perror("ONCORE: fd1"); exit(1); @@ -465,24 +591,43 @@ oncore_start( } } - /* Devices now open, initialize instance structure */ + /* initialize miscellaneous variables */ - if (!(instance = (struct instance *)emalloc(sizeof *instance))) { - perror("malloc"); - close(fd1); - return (0); - } - memset((char *) instance, 0, sizeof *instance); 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; + instance->assert = 1; + instance->once = 1; + + cp = "ONCORE DRIVER -- CONFIGURING"; + record_clock_stats(&(instance->peer->srcadr), cp); + + 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->traim_in = -1; + instance->chan_in = -1; + instance->model = ONCORE_UNKNOWN; + instance->mode = MODE_UNKNOWN; + instance->site_survey = ONCORE_SS_UNKNOWN; + instance->Ag = 0xff; /* Satellite mask angle, unset by user */ + instance->ant_state = ONCORE_ANTENNA_UNKNOWN; - /* go read any input data in /etc/ntp.oncoreX */ + 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 or /etc/ntp/oncore.X */ oncore_read_config(instance); @@ -492,82 +637,20 @@ oncore_start( return(0); } - if (time_pps_getcap(instance->pps_h, &mode) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_getcap failed: %m"); - return (0); - } - - if (time_pps_getparams(instance->pps_h, &instance->pps_p) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: 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! - */ - - 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; - } else { - instance->pps_p.mode = PPS_CAPTURECLEAR | PPS_OFFSETCLEAR; - instance->pps_p.clear_offset.tv_sec = 0; - 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 */ - - if (time_pps_setparams(instance->pps_h, &instance->pps_p) < 0) { - perror("time_pps_setparams"); - exit(1); - } - - if (pps_device) { - if (stat(pps_device, &stat1)) { - 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; - - 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) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_kcbind failed: %m"); - return (0); - } - } - } - } -#endif - - instance->pp = pp; - instance->peer = peer; - instance->o_state = ONCORE_NO_IDEA; - cp = "state = ONCORE_NO_IDEA"; + if (instance->assert) + cp = "Initializing timing to Assert."; + else + cp = "Initializing timing to Clear."; record_clock_stats(&(instance->peer->srcadr), cp); - /* - * Initialize miscellaneous variables - */ + if (instance->hardpps) { + cp = "HARDPPS Set."; + record_clock_stats(&(instance->peer->srcadr), cp); + } - peer->precision = -26; - peer->minpoll = 4; - peer->maxpoll = 4; - pp->clockdesc = "Motorola UT/VP Oncore GPS Receiver"; - memcpy((char *)&pp->refid, "GPS\0", 4); + if (!oncore_ppsapi(instance)) + return(0); +#endif pp->io.clock_recv = oncore_receive; pp->io.srcclock = (caddr_t)peer; @@ -579,134 +662,381 @@ oncore_start( free(instance); return (0); } - pp->unitptr = (caddr_t)instance; +#ifdef ONCORE_SHMEM_STATUS /* - * This will start the Oncore receiver. - * We send info from config to Oncore later. + * Before starting ONCORE, lets setup SHMEM + * This will include merging an old SHMEM into the new one if + * an old one is found. */ - 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_init_shmem(instance); +#endif + + /* + * This will return the Model of the Oncore receiver. + * and start the Initialization loop in oncore_msg_Cj. + */ + + instance->o_state = ONCORE_CHECK_ID; + cp = "state = ONCORE_CHECK_ID"; + record_clock_stats(&(instance->peer->srcadr), cp); + + instance->timeout = 4; + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cg, sizeof(oncore_cmd_Cg)); /* Set Posn Fix mode (not Idle (VP)) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof(oncore_cmd_Cj)); instance->pollcnt = 2; return (1); } +/* + * Fudge control (get Flag2 and Flag3, not available at oncore_start time. + */ static void -oncore_init_shmem(struct instance *instance, char *filename) +oncore_control( + int unit, /* unit (not used) */ + struct refclockstat *in, /* input parameters (not used) */ + struct refclockstat *out, /* output parameters (not used) */ + struct peer *peer /* peer structure pointer */ + ) { -#ifdef ONCORE_SHMEM_STATUS - int i, l, n; - char *buf; - struct msg_desc *mp; - u_int oncore_shmem_length; + char *cp; + struct refclockproc *pp; + struct instance *instance; - if (instance->shmem_first) + pp = peer->procptr; + instance = (struct instance *) pp->unitptr; + + instance->assert = !(pp->sloppyclockflag & CLK_FLAG2); + instance->hardpps = pp->sloppyclockflag & CLK_FLAG3; + + if (instance->assert) + cp = "Resetting timing to Assert."; + else + cp = "Resetting timing to Clear."; + record_clock_stats(&(instance->peer->srcadr), cp); + + if (instance->hardpps) { + cp = "HARDPPS Set."; + record_clock_stats(&(instance->peer->srcadr), cp); + } + + (void) oncore_ppsapi(instance); +} + + + +/* + * oncore_shutdown - shut down the clock + */ + +static void +oncore_shutdown( + int unit, + struct peer *peer + ) +{ + register struct instance *instance; + struct refclockproc *pp; + + pp = peer->procptr; + instance = (struct instance *) pp->unitptr; + + io_closeclock(&pp->io); + + close(instance->ttyfd); + close(instance->ppsfd); + if (instance->shmemfd) + close(instance->shmemfd); + free(instance); +} + + + +/* + * oncore_poll - called by the transmit procedure + */ + +static void +oncore_poll( + int unit, + struct peer *peer + ) +{ + struct instance *instance; + + instance = (struct instance *) peer->procptr->unitptr; + if (instance->timeout) { + char *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; + } + + if (!instance->pollcnt) + refclock_report(peer, CEVNT_TIMEOUT); + else + instance->pollcnt--; + peer->procptr->polls++; + instance->polled = 1; +} + + + +/* + * Initialize PPSAPI + */ + +#ifdef HAVE_PPSAPI +static int +oncore_ppsapi( + struct instance *instance + ) +{ + int mode; + + if (time_pps_getcap(instance->pps_h, &mode) < 0) { + msyslog(LOG_ERR, "refclock_ioctl: time_pps_getcap failed: %m"); + return (0); + } + + if (time_pps_getparams(instance->pps_h, &instance->pps_p) < 0) { + msyslog(LOG_ERR, "refclock_ioctl: 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! + */ + + 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; + } else { + instance->pps_p.mode = PPS_CAPTURECLEAR | PPS_OFFSETCLEAR; + instance->pps_p.clear_offset.tv_sec = 0; + instance->pps_p.clear_offset.tv_nsec = 0; + } + instance->pps_p.mode |= PPS_TSFMT_TSPEC; + 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"); + exit(1); + } + + /* If HARDPPS is on, we tell kernel */ + + if (instance->hardpps) { + 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) { + msyslog(LOG_ERR, "refclock_ioctl: time_pps_kcbind failed: %m"); + return (0); + } + pps_enable = 1; + } + } + return(1); +} +#endif + + + +#ifdef ONCORE_SHMEM_STATUS +static void +oncore_init_shmem( + struct instance *instance + ) +{ + int i, l, n, fd, shmem_old_size, n1; + char *buf, Msg[160]; + u_char *cp, *cp1, *shmem_old; + struct msg_desc *mp; + struct stat sbuf; + size_t shmem_length; + + /* + * The first thing we do is see if there is an instance->shmem_fname file (still) + * out there from a previous run. If so, we copy it in and use it to initialize + * shmem (so we won't lose our almanac if we need it). + */ + + shmem_old = 0; + if ((fd = open(instance->shmem_fname, O_RDONLY)) < 0) + perror("LOAD:SHMEM"); + else { + fstat(fd, &sbuf); + shmem_old_size = sbuf.st_size; + shmem_old = (u_char *) malloc((unsigned) sbuf.st_size); + if (shmem_old == NULL) { + perror("malloc"); + close(fd); + return; + } + + read(fd, shmem_old, shmem_old_size); + close(fd); + } + + /* OK, we now create the NEW SHMEM. */ + + if ((instance->shmemfd = open(instance->shmem_fname, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) { + perror(instance->shmem_fname); + return; + } + + /* see how big it needs to be */ - instance->shmem_first++; n = 1; - for (mp = oncore_messages; mp->flag[0]; mp++) { + for (mp=oncore_messages; mp->flag[0]; mp++) { mp->shmem = n; - /* Allocate space for multiplexed almanac */ + /* 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; } - n += mp->len + 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", oncore_shmem_length); + shmem_length = n + 2; + fprintf(stderr, "ONCORE: SHMEM length: %d bytes\n", (int) 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); + buf = malloc(shmem_length); if (buf == NULL) { perror("malloc"); - exit(4); + close(instance->shmemfd); + return; } - 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++) { + + memset(buf, 0, shmem_length); + + /* next build the new SHMEM buffer in memory */ + + 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, "Ea")) { + buf[l + 0] = mp->len >> 8; + buf[l + 1] = mp->len & 0xff; + buf[l + 2] = 0; + buf[l + 3] = '@'; + buf[l + 4] = '@'; + buf[l + 5] = mp->flag[0]; + buf[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]; + for (i=1; ilen+3) + 0] = mp->len >> 8; + buf[l + i * (mp->len+3) + 1] = mp->len & 0xff; + buf[l + i * (mp->len+3) + 2] = 0; + buf[l + i * (mp->len+3) + 3] = '@'; + buf[l + i * (mp->len+3) + 4] = '@'; + buf[l + i * (mp->len+3) + 5] = mp->flag[0]; + buf[l + i * (mp->len+3) + 6] = mp->flag[1]; } } } + + /* we now walk thru the two buffers (shmem_old and buf, soon to become shmem) + * copying the data in shmem_old to buf. When we are done we write it out + * and free both buffers. + * If the structures change (an addition or deletion) I will stop copying. + * The two will be the same unless we add/subtract from the oncore_messages list + * so this should work most of the time, and takes a lot less code than doing it right. + */ + + if (shmem_old) { + for (cp=buf+4, cp1=shmem_old+4; (n = 256*(*(cp-3)) + *(cp-2)); cp+=(n+3), cp1+=(n+3)) { + n1 = 256*(*(cp1-3)) + *(cp1-2); + if (n1 != n || strncmp(cp, cp1, 4)) + break; + + memcpy(cp, cp1, (size_t) n); + } + free(shmem_old); + } + + i = write(instance->shmemfd, buf, shmem_length); + free(buf); + + if (i != shmem_length) { + perror(instance->shmem_fname); + close(instance->shmemfd); + return; + } + + instance->shmem = (u_char *) mmap(0, shmem_length, + PROT_READ | PROT_WRITE, +#ifdef MAP_HASSEMAPHORE + MAP_HASSEMAPHORE | +#endif + MAP_SHARED, instance->shmemfd, (off_t)0); + + if (instance->shmem == (u_char *)MAP_FAILED) { + instance->shmem = 0; + close(instance->shmemfd); + return; + } + + sprintf(Msg, "SHMEM (size = %d) is CONFIGURED and available as %s", shmem_length, instance->shmem_fname); + record_clock_stats(&(instance->peer->srcadr), Msg); +} #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 @@ -731,7 +1061,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, HARDPPS, + * 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). * @@ -749,25 +1080,58 @@ 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 receiver 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. + * ASSERT/CLEAR can also be set with FLAG2 of the ntp.conf input. + * For Flag2, ASSERT=0, and hence is default. + * + * There is an optional line, with HARDPPS on it. Including this line causes + * the PPS signal to control the kernel PLL. + * HARDPPS can also be set with FLAG3 of the ntp.conf input. + * For Flag3, 0 is disabled, and the default. + * + * There are three options that have to do with using the shared memory option. + * First, to enable the option there must be a SHMEM line with a file name. + * The file name is the file associated with the shared memory. + * + * In shared memory, there is one 'record' for each returned variable. + * For the @@Ea data there are three 'records' containing position data. + * There will always be data in the record corresponding to the '0D' @@Ea record, + * and the user has a choice of filling the '3D' 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 existence of TRAIM. + * CHAN expects to be followed by in integer: 6, 8, or 12. TRAIM expects to be + * followed by YES or NO. + * + * There is an optional line with MASK on it followed by one integer field in the + * range 0 to 89. This sets the satellite mask angle and will determine the minimum + * elevation angle for satellites to be tracked by the receiver. The default value + * is 10 deg for the VP and 0 deg for all other receivers. * * So acceptable input would be * # these are my coordinates (RWC) @@ -778,25 +1142,29 @@ oncore_read_config( */ FILE *fd; - char *cp, *cc, *ca, line[100], units[2], device[20]; - int i, sign, lat_flg, long_flg, ht_flg, mode; + char *cp, *cc, *ca, line[100], units[2], device[20], Msg[160]; + int i, sign, lat_flg, long_flg, ht_flg, mode, mask; 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; + mode = mask = 0; lat_flg = long_flg = ht_flg = 0; while (fgets(line, 100, fd)) { /* 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]); @@ -813,18 +1181,22 @@ oncore_read_config( /* 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) || (*ca == '='))) - break; + if (isascii((int)*ca)) { + if (islower((int)*ca)) { + *ca = toupper(*ca); + } else if (isspace((int)*ca) || (*ca == '=')) + break; + } } - + /* 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); + 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; } @@ -833,7 +1205,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; @@ -843,7 +1215,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; @@ -853,13 +1225,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); @@ -867,7 +1233,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); @@ -881,8 +1247,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); @@ -896,20 +1266,37 @@ 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", 6)) { + } else if (!strncmp(cc, "HARDPPS", (size_t) 7)) { + instance->hardpps = 1; + } else if (!strncmp(cc, "POSN2D", (size_t) 6)) { instance->shmem_Posn = 2; - } else if (!strncmp(cc, "POSN3D", 6)) { + } 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_in = i; + } else if (!strncmp(cc, "TRAIM", (size_t) 5)) { + instance->traim_in = 1; /* so TRAIM alone is YES */ + if (!strcmp(ca, "NO") || !strcmp(ca, "OFF")) /* Yes/No, On/Off */ + instance->traim_in = 0; + } else if (!strncmp(cc, "MASK", (size_t) 4)) { + sscanf(ca, "%d", &mask); + if (mask > -1 && mask < 90) + instance->Ag = mask; /* Satellite mask angle */ } } fclose(fd); @@ -920,81 +1307,33 @@ oncore_read_config( */ instance->posn_set = 1; - if ((lat_flg || long_flg || ht_flg) && !(lat_flg * long_flg * ht_flg)) { + if (!( 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; - /* simplify SHMEM tests later */ - - if (!instance->shmem) - instance->shmem_Posn = 0; + sprintf(Msg, "Input mode = %d", mode); + record_clock_stats(&(instance->peer->srcadr), Msg); } /* - * oncore_shutdown - shut down the clock + * move data from NTP to buffer (toss the extra in the unlikely case it won't fit) */ -static void -oncore_shutdown( - int unit, - struct peer *peer - ) -{ - register struct instance *instance; - struct refclockproc *pp; - pp = peer->procptr; - instance = (struct instance *) pp->unitptr; - free(instance); -} - - - -/* - * oncore_poll - called by the transmit procedure - */ -static void -oncore_poll( - int unit, - struct peer *peer - ) -{ - struct instance *instance; - - instance = (struct instance *) peer->procptr->unitptr; - if (instance->timeout) { - 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); - return; - } - - if (!instance->pollcnt) - refclock_report(peer, CEVNT_TIMEOUT); - else - instance->pollcnt--; - peer->procptr->polls++; - instance->polled = 1; -} - - - -/* - * move dta 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; @@ -1030,12 +1369,13 @@ oncore_receive( /* * Deal with any complete messages */ + static void oncore_consume( struct instance *instance ) { - int i, j, m; + int i, m; unsigned l; while (rcvptr >= 7) { @@ -1045,502 +1385,87 @@ 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 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 */ + /* are we at the end of message? should be */ - 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, l); + if (rcvbuf[l-2] != '\r' || rcvbuf[l-1] != '\n') { + if (debug) + printf("ONCORE[%d]: NO at end of message\n", instance->unit); + } else { /* check the CheckSum */ + if (oncore_checksum_ok(rcvbuf, l)) { + 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!\n", instance->unit); + printf("ONCORE[%d]: @@%c%c ", instance->unit, rcvbuf[2], rcvbuf[3]); + for (i=4; i 3) { - GETTIMEOFDAY(&tv, 0); - printf("ONCORE: %ld.%06ld\n", (long) tv.tv_sec, (long) tv.tv_usec); - - if (!*fmt) { - printf(">>@@%c%c ", buf[2], buf[3]); - for(i=2; i < len && i < 2400 ; i++) - printf("%02x", buf[i]); - printf("\n"); - return; - } else { - printf("##"); - for (p = fmt; *p; p++) { - putchar(*p); - putchar('_'); - } - printf("\n%c%c", buf[2], buf[3]); - i = 4; - for (p = fmt; *p; p++) { - printf("%02x", buf[i++]); - } - printf("\n"); - } - } -} - - - -/* - * Demultiplex the almanac into shmem - */ -static void -oncore_msg_Cb( - struct instance *instance, - u_char *buf, - u_int len - ) -{ - int i; - - if (instance->shmem == NULL) - return; - - if (buf[4] == 5) - i = buf[5]; - else if (buf[4] == 4 && buf[5] <= 5) - i = buf[5] + 24; - else if (buf[4] == 4 && buf[5] <= 10) - i = buf[5] + 23; - else - i = 34; - i *= 36; - instance->shmem[instance->shmem_Cb + i + 2]++; - memcpy(instance->shmem + instance->shmem_Cb + i + 3, buf, 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); - } -} - - - -/* 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. - */ - -static void -oncore_msg_Fa( - struct instance *instance, - u_char *buf, - u_int 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); - } - - 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); - } -} - - - -/* - * preliminaries out of the way, this is the REAL start of initialization - */ -static void -oncore_msg_Cj( - struct instance *instance, - u_char *buf, - u_int len - ) -{ - char *cp, *cp1; - int mode; - - instance->timeout = 0; - if (instance->o_state != ONCORE_ID_SENT) - return; - - memcpy(instance->Cj, buf, len); - - /* Write Receiver ID to clockstats file */ - - instance->Cj[294] = '\0'; - for (cp=(char *)instance->Cj; cp< (char *) &instance->Cj[294]; ) { - cp1 = strchr(cp, '\r'); - if (!cp1) - cp1 = (char *)&instance->Cj[294]; - *cp1 = '\0'; - record_clock_stats(&(instance->peer->srcadr), cp); - *cp1 = '\r'; - cp = cp1+2; - } -#ifdef HAVE_PPSAPI - if (instance->assert) - cp = "Timing on Assert."; - else - cp = "Timing on Clear."; - 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 (debug) - printf("ONCORE: INIT mode = %d\n", mode); - - /* 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. - */ - - 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); - - w32_buf(&oncore_cmd_Au[2], (int) instance->ss_ht); - oncore_cmd_Au[6] = instance->ss_ht_type; - oncore_sendmsg(instance->ttyfd, oncore_cmd_Au, sizeof oncore_cmd_Au); - - 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); - } - 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); - - /* PPS offset in ns */ - w32_buf(&oncore_cmd_Ay[2], instance->offset); - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ay, sizeof oncore_cmd_Ay); - } - - /* 8chan - Position/Status/Data Output Message, 1/s */ - - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea, sizeof oncore_cmd_Ea); - - instance->o_state = ONCORE_ALMANAC; - cp = "state = ONCORE_ALMANAC"; - record_clock_stats(&(instance->peer->srcadr), cp); -} - - - -static void -oncore_msg_Ea( - struct instance *instance, - u_char *buf, - u_int len - ) -{ - const char *cp; - char Msg[160]; - - if (instance->o_state != ONCORE_ALMANAC && instance->o_state != ONCORE_RUN) - return; - - memcpy(instance->Ea, buf, len); - - if (instance->shmem) { - int i; - - i = 0; - if (instance->Ea[72]&0x8) /* 0D, Position Hold */ - i = 1; - else if (instance->Ea[72]&0x10) /* 2D, Altitude Hold */ - i = 2; - else if (instance->Ea[72]&0x20) /* 3D fix */ - i = 3; - if (i) { - i *= 79; - instance->shmem[instance->shmem_Ea + i + 2]++; - memcpy(instance->shmem + instance->shmem_Ea + i + 3, buf, len + 3); - } - } - - /* When we have an almanac, start the En messages */ - - if (instance->o_state == ONCORE_ALMANAC) { - if ((instance->Ea[72] & 0x1)) { - if (debug) - printf("ONCORE: waiting for almanac\n"); - return; - } else { - oncore_sendmsg(instance->ttyfd, oncore_cmd_En, sizeof oncore_cmd_En); - 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 */ - - 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"); - } - - 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); - /* 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); - /* Read back Cable Delay for Output */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Azx, sizeof oncore_cmd_Azx); - } - - /* Check the leap second status once per day */ - - /* - * 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 ((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); - } - } - 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]; - - /* every 15s, steal one 'tick' to get 2D or 3D posn if asked for */ - - if (instance->shmem_Posn && instance->site_survey != ONCORE_SS_SW) { /* dont screw up the HWSS by changing mode */ - if (instance->pp->second%15 == 3) { /* start the sequence */ - instance->shmem_reset = 1; - oncore_cmd_At[2] = 0; /* out of 0D mode, to 3D mode */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_At, sizeof oncore_cmd_At); - if (instance->shmem_Posn == 2) { - oncore_cmd_Av[2] = 1; /* into 2D mode */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Av, sizeof oncore_cmd_Av); - } - } else if (instance->shmem_reset || !(instance->Ea[72] & 0x8)) { - instance->shmem_reset = 0; - if (instance->Ea[72] & 0x10) { - oncore_cmd_Av[2] = 0; /* out of 2D mode */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Av, sizeof oncore_cmd_Av); - } - oncore_cmd_At[2] = 1; /* into 0D mode */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_At, sizeof oncore_cmd_At); - } - } - - if (instance->site_survey != ONCORE_SS_SW) - return; - - /* - * We have to average our own position for the Position Hold Mode - */ - - /* Not if poor geometry or less than 3 sats */ - - if (instance->Ea[72] & 0x52) - return; - - /* Only 3D fix */ - - if (!(instance->Ea[72] & 0x20)) - 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_count++; - - if (instance->ss_count != POS_HOLD_AVERAGE) - return; - - instance->ss_lat /= POS_HOLD_AVERAGE; - instance->ss_long /= POS_HOLD_AVERAGE; - instance->ss_ht /= POS_HOLD_AVERAGE; - - sprintf(Msg, "Surveyed posn: lat %.3f long %.3f ht %.3f", - 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); - - w32_buf(&oncore_cmd_Au[2], (int) instance->ss_ht); - oncore_cmd_Au[6] = 0; - oncore_sendmsg(instance->ttyfd, oncore_cmd_Au, sizeof oncore_cmd_Au); - - 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; -} - - - -static void -oncore_msg_En( - struct instance *instance, - u_char *buf, - u_int len - ) -{ - int j; + 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 */ @@ -1557,21 +1482,24 @@ oncore_msg_En( #endif #endif /* ! HAVE_PPS_API */ - if ((instance->site_survey == ONCORE_SS_DONE) && !(instance->Ea[72]&0x8)) - return; - if (instance->o_state != ONCORE_RUN) - return; +#if 1 + /* If we are in SiteSurvey mode, then we are in 3D mode, and we fall thru. + * If we have Finished the SiteSurvey, then we fall thru for the 14/15 + * times we get here in 0D mode (the 1/15 is in 3D for SHMEM). + * This gives good time, which gets better when the SS is done. + */ - memcpy(instance->En, buf, len); + if ((instance->site_survey == ONCORE_SS_DONE) && (instance->mode != MODE_0D)) +#else + /* old check, only fall thru for SS_DONE and 0D mode, 2h45m wait for ticks */ + + if ((instance->site_survey != ONCORE_SS_DONE) || (instance->mode != MODE_0D)) +#endif + return; /* Don't do anything without an almanac to define the GPS->UTC delta */ - if (instance->Ea[72] & 0x1) - 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 @@ -1587,26 +1515,40 @@ oncore_msg_En( if (instance->assert) { tsp = &pps_i.assert_timestamp; - if (debug > 2) - printf("ONCORE: serial/j (%lu, %d) %ld.%09ld\n", - (long)pps_i.assert_sequence, j, + 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 (%lu, %d) %ld.%09ld\n", - (long)pps_i.clear_sequence, j, - (long)tsp->tv_sec, (long)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; @@ -1641,11 +1583,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; @@ -1667,7 +1614,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. */ @@ -1675,26 +1622,55 @@ 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_setparams(instance->pps_h, &instance->pps_p)) + if (time_pps_getparams(instance->pps_h, ¤t_params) < 0) { + msyslog(LOG_ERR, "refclock_ioctl: time_pps_getparams failed: %m"); + return; + } + + /* 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 @@ -1702,33 +1678,65 @@ oncore_msg_En( ts.l_ui += JAN_1970; instance->pp->lastrec = ts; - instance->pp->msec = 0; + + /* print out information about this timestamp (long line) */ 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, + 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 */ - 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] - ); + Rsm = 0; + if (instance->chan == 6) + Rsm = instance->BEHa[64]; + else if (instance->chan == 8) + Rsm = instance->BEHa[72]; + else if (instance->chan == 12) + Rsm = ((instance->BEHa[129]<<8) | instance->BEHa[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 %2d 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->BEHa[35]+instance->BEHa[36]), + /*rsat dop */ + instance->BEHa[38], instance->BEHa[39], instance->BEHn[21], + /* nsat visible, nsat tracked, traim */ + instance->BEHn[23]*256+instance->BEHn[24], (s_char) instance->BEHn[25], + /* sigma neg-sawtooth */ + /*sat*/ instance->BEHa[41], instance->BEHa[45], instance->BEHa[49], instance->BEHa[53], + instance->BEHa[57], instance->BEHa[61], instance->BEHa[65], instance->BEHa[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 traim %d sigma %d neg-sawtooth %3d 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->BEHa[53]+instance->BEHa[54]), + /*rsat dop */ + instance->BEHa[55], instance->BEHa[56], instance->BEHn[6], + /* nsat visible, nsat tracked traim */ + instance->BEHn[12]*256+instance->BEHn[13], (s_char) instance->BEHn[14], + /* sigma neg-sawtooth */ + /*sat*/ instance->BEHa[58], instance->BEHa[64], instance->BEHa[70], instance->BEHa[76], + instance->BEHa[82], instance->BEHa[88], instance->BEHa[94], instance->BEHa[100], + instance->BEHa[106], instance->BEHa[112], instance->BEHa[118], instance->BEHa[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); } + /* and some things I dont understnd (magic ntp things) */ + if (!refclock_process(instance->pp)) { refclock_report(instance->peer, CEVNT_BADTIME); return; @@ -1742,46 +1750,533 @@ oncore_msg_En( /* instance->pp->dispersion = instance->pp->skew = 0; */ + instance->pp->lastref = instance->pp->lastrec; refclock_receive(instance->peer); } } +/*************** oncore_msg_XX routines start here *******************/ + + +/* + * print Oncore response message. + */ + +static void +oncore_msg_any( + struct instance *instance, + u_char *buf, + 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); +#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]); + for(i=2; i < len && i < 2400 ; i++) + printf("%02x", buf[i]); + printf("\n"); + return; + } else { + printf("##"); + for (p = fmt; *p; p++) { + putchar(*p); + putchar('_'); + } + printf("\n%c%c", buf[2], buf[3]); + i = 4; + for (p = fmt; *p; p++) { + printf("%02x", buf[i++]); + } + printf("\n"); + } + } +} + + + +/* Latitude, Longitude, Height */ + +static void +oncore_msg_Adef( + struct instance *instance, + u_char *buf, + size_t len + ) +{ +} + + + +/* Mask Angle */ + +static void +oncore_msg_Ag( + struct instance *instance, + u_char *buf, + size_t len + ) +{ char Msg[160], *cp; + + cp = "set to"; + if (instance->o_state == ONCORE_RUN) + cp = "is"; + + instance->Ag = buf[4]; + sprintf(Msg, "Satellite mask angle %s %d degrees", cp, (int) instance->Ag); + record_clock_stats(&(instance->peer->srcadr), Msg); +} + + + +/* + * get Position hold position + */ + +static void +oncore_msg_As( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + instance->ss_lat = buf_w32(&buf[4]); + instance->ss_long = buf_w32(&buf[8]); + instance->ss_ht = buf_w32(&buf[12]); + + /* Print out Position */ + oncore_print_posn(instance); +} + + /* * 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) + char *cp; + + 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"); + + cp = "SSstate = ONCORE_SS_HW"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->site_survey = ONCORE_SS_HW; + } + } +} + + + +/* + * 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, + size_t len + ) +{ + char Msg[120]; + + if (instance->saw_Ay) 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 + instance->saw_Ay = 1; + + instance->offset = buf_w32(&buf[4]); + + sprintf(Msg, "PPS Offset is set to %ld ns", instance->offset); + record_clock_stats(&(instance->peer->srcadr), Msg); +} + + + +/* + * get Cable Delay + */ + +static void +oncore_msg_Az( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char Msg[120]; + + if (instance->saw_Az) + return; + + instance->saw_Az = 1; + + instance->delay = buf_w32(&buf[4]); + + sprintf(Msg, "Cable delay is set to %ld ns", instance->delay); + record_clock_stats(&(instance->peer->srcadr), Msg); +} + + + +/* Ba, Ea and Ha come here, these contain Position */ + +static void +oncore_msg_BaEaHa( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + const char *cp; + char Msg[160]; + int mode; + + /* OK, we are close to the RUN state now. + * But we have a few more items to initialize first. + * + * At the beginning of this routine there are several 'timers'. + * We enter this routine 1/sec, and since the upper levels of NTP have usurped + * the use of timers, we use the 1/sec entry to do things that + * we would normally do with timers... + */ + + if (instance->o_state == ONCORE_CHECK_CHAN) { /* here while checking for the # chan */ + if (buf[2] == 'B') { /* 6chan */ + if (instance->chan_ck < 6) instance->chan_ck = 6; + } else if (buf[2] == 'E') { /* 8chan */ + if (instance->chan_ck < 8) instance->chan_ck = 8; + } else if (buf[2] == 'H') { /* 12chan */ + if (instance->chan_ck < 12) instance->chan_ck = 12; + } + + if (instance->count3++ < 5) + return; + + instance->count3 = 0; + + if (instance->chan_in != -1) /* set in Input */ + instance->chan = instance->chan_in; + else /* set from test */ + instance->chan = instance->chan_ck; + + sprintf(Msg, "Input says chan = %d", instance->chan_in); + record_clock_stats(&(instance->peer->srcadr), Msg); + sprintf(Msg, "Model # says chan = %d", instance->chan_id); + record_clock_stats(&(instance->peer->srcadr), Msg); + sprintf(Msg, "Testing says chan = %d", instance->chan_ck); + record_clock_stats(&(instance->peer->srcadr), Msg); + sprintf(Msg, "Using chan = %d", instance->chan); + record_clock_stats(&(instance->peer->srcadr), Msg); + + instance->o_state = ONCORE_HAVE_CHAN; + cp = "state = ONCORE_HAVE_CHAN"; + record_clock_stats(&(instance->peer->srcadr), cp); + + instance->timeout = 4; + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof(oncore_cmd_Cj)); + return; + } + + if (instance->o_state != ONCORE_ALMANAC && instance->o_state != ONCORE_RUN) + return; + + /* PAUSE 5sec */ + + if (instance->count) { + if (instance->count++ < 5) /* make sure results are stable, using position */ + return; + instance->count = 0; + } + + memcpy(instance->BEHa, buf, (size_t) (len+3)); /* Ba, Ea or Ha */ + + /* check the antenna and almanac for changes (did it get unplugged, is it ready?) */ + + oncore_check_almanac(instance); + oncore_check_antenna(instance); + + /* Almanac mode, waiting for Almanac, we can't do anything till we have it */ + /* When we have an almanac, we will start the Bn/En/@@Hn messages */ + + if (instance->o_state == ONCORE_ALMANAC) + if (oncore_wait_almanac(instance)) + return; + + /* do some things once when we get this far in BaEaHa */ + + if (instance->once) { + instance->once = 0; + instance->count2 = 1; + + /* Have we seen an @@At (position hold) command response */ + /* if not, message out */ + + if (instance->chan != 12 && !instance->saw_At) { + cp = "Not Good, no @@At command (no Position Hold), must be a GT/GT+"; + record_clock_stats(&(instance->peer->srcadr), cp); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av1, sizeof(oncore_cmd_Av1)); + } + + /* have an Almanac, can start the SiteSurvey + * (actually only need to get past the almanac_load where we diddle with At + * command,- we can't change it after we start the HW_SS below */ - 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; + mode = instance->init_type; + switch (mode) { + case 0: /* NO initialization, don't change anything */ + case 1: /* Use given Position */ + case 3: + instance->site_survey = ONCORE_SS_DONE; + cp = "SSstate = ONCORE_SS_DONE"; + record_clock_stats(&(instance->peer->srcadr), cp); + break; - 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); + case 2: + case 4: /* Site Survey */ + cp = "SSstate = ONCORE_SS_TESTING"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->site_survey = ONCORE_SS_TESTING; + instance->count1 = 1; + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd3, sizeof(oncore_cmd_Gd3)); /* M12+T */ + else + oncore_sendmsg(instance->ttyfd, oncore_cmd_At2, sizeof(oncore_cmd_At2)); /* not GT, arg not VP */ + break; + } + + /* Read back PPS Offset for Output */ + /* 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)); + + /* Read back Satellite Mask Angle for Output */ + + oncore_sendmsg(instance->ttyfd, oncore_cmd_Agx, sizeof(oncore_cmd_Agx)); } + + if (instance->count1) { + if (instance->count1++ > 5 || instance->site_survey == ONCORE_SS_HW) { + instance->count1 = 0; + if (instance->site_survey == ONCORE_SS_TESTING) { + /* + * For instance->site_survey to still be ONCORE_SS_TESTING, then after a 5sec + * wait after the @@At2/@@Gd3 command we have not changed the state to + * ONCORE_SS_HW. If the Hardware is capable of doing a Site Survey, then + * the variable would have been changed by now. + * There are three possibilities: + * 6/8chan + * (a) We did not get a response to the @@At0 or @@At2 commands, + * and it must be a GT/GT+/SL with no position hold mode. + * We will have to do it ourselves. + * (b) We saw the @@At0, @@At2 commands, but @@At2 failed, + * must be a VP or older UT which doesn't have Site Survey mode. + * We will have to do it ourselves. + * 12chan + * (c) We saw the @@Gd command, but @@Gd3 failed, + * 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); + + record_clock_stats(&(instance->peer->srcadr), "SSstate = ONCORE_SS_SW"); + instance->site_survey = ONCORE_SS_SW; + + instance->ss_lat = instance->ss_long = instance->ss_ht = 0; + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd0, sizeof(oncore_cmd_Gd0)); /* disable */ + else { + oncore_sendmsg(instance->ttyfd, oncore_cmd_At0, sizeof(oncore_cmd_At0)); /* disable */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av0, sizeof(oncore_cmd_Av0)); /* disable */ + } + } + } + } + + /* check the mode we are in 0/2/3D */ + + if (instance->chan == 6) { + if (instance->BEHa[64]&0x8) + instance->mode = MODE_0D; + else if (instance->BEHa[64]&0x10) + instance->mode = MODE_2D; + else if (instance->BEHa[64]&0x20) + instance->mode = MODE_3D; + } else if (instance->chan == 8) { + if (instance->BEHa[72]&0x8) + instance->mode = MODE_0D; + else if (instance->BEHa[72]&0x10) + instance->mode = MODE_2D; + else if (instance->BEHa[72]&0x20) + instance->mode = MODE_3D; + } else if (instance->chan == 12) { + int bits; + + bits = (instance->BEHa[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; + } + + /* copy the record to the (extra) location in SHMEM */ + + if (instance->shmem) { + int i; + u_char *smp; /* pointer to start of shared mem for Ba/Ea/Ha */ + + switch(instance->chan) { + case 6: smp = &instance->shmem[instance->shmem_Ba]; break; + case 8: smp = &instance->shmem[instance->shmem_Ea]; break; + case 12: smp = &instance->shmem[instance->shmem_Ha]; break; + default: smp = (u_char) 0; break; + } + + switch (instance->mode) { + case MODE_0D: i = 1; break; /* 0D, Position Hold */ + case MODE_2D: i = 2; break; /* 2D, Altitude Hold */ + case MODE_3D: i = 3; break; /* 3D fix */ + default: i = 0; break; + } + + if (i) { + i *= (len+6); + smp[i + 2]++; + memcpy(&smp[i+3], buf, (size_t) (len+3)); + } + } + + /* + * check if timer active + * if it hasn't been cleared, then @@Bn/@@En/@@Hn 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); + + oncore_set_traim(instance); + } else + return; + + } + + /* by now should have a @@Ba/@@Ea/@@Ha with good data in it */ + + if (!instance->have_dH && !instance->traim_delay) + oncore_compute_dH(instance); + + /* + * must be ONCORE_RUN if we are here. + * Have # chan and TRAIM by now. + */ + + 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]; + + /* + * Are we doing a Hardware or Software Site Survey? + */ + + if (instance->site_survey == ONCORE_SS_HW || instance->site_survey == ONCORE_SS_SW) + oncore_ss(instance); + + /* see if we ever saw a response from the @@Ayx above */ + + if (instance->count2) { + if (instance->count2++ > 5) { /* this delay to check on @@Ay command */ + instance->count2 = 0; + + /* Have we seen an Ay (1PPS time offset) command response */ + /* if not, and non-zero offset, zero the offset, and send message */ + + if (!instance->saw_Ay && instance->offset) { + cp = "No @@Ay command, PPS OFFSET ignored"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->offset = 0; + } + } + } + + /* + * Check the leap second status once per day. + */ + + oncore_check_leap_sec(instance); + + /* + * if SHMEM active, every 15s, steal one 'tick' to get 2D or 3D posn. + */ + + if (instance->shmem && !instance->shmem_bad_Ea && instance->shmem_Posn && (instance->site_survey == ONCORE_SS_DONE)) + oncore_shmem_get_3D(instance); + + if (!instance->traim) /* NO traim, no BnEnHn, go get tick */ + oncore_get_timestamp(instance, instance->offset, instance->offset); +} + + + +/* Almanac Status */ + +static void +oncore_msg_Bd( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char Msg[160]; + + sprintf(Msg, "Bd: Almanac %s, week = %d, t = %d, %d SVs: %x", + ((buf[4]) ? "LOADED" : "(NONE)"), buf[5], buf[6], buf[7], w32(&buf[8]) ); + record_clock_stats(&(instance->peer->srcadr), Msg); } @@ -1793,14 +2288,15 @@ oncore_msg_At( * It turns on the LEAP indicator when the data is set, and does not, * as documented, wait until the beginning of the month when the * leap second will occur. - * Until this firmware bug is fixed, @@Bj is only called in June/December. + * Since this firmware bug will never be fixed in all the outstanding Oncore receivers + * @@Bj is only called in June/December. */ static void oncore_msg_Bj( struct instance *instance, u_char *buf, - u_int len + size_t len ) { const char *cp; @@ -1825,39 +2321,1065 @@ oncore_msg_Bj( -/* - * get Position hold position - */ static void -oncore_msg_As( +oncore_msg_BnEnHn( struct instance *instance, u_char *buf, - u_int len + size_t len + ) +{ + long dt1, dt2; + char *cp; + + if (instance->o_state != ONCORE_RUN) + return; + + if (instance->traim_delay) { /* flag that @@Bn/@@En/Hn returned */ + instance->traim_ck = 1; + instance->traim_delay = 0; + cp = "ONCORE: Detected TRAIM, TRAIM = ON"; + record_clock_stats(&(instance->peer->srcadr), cp); + + oncore_set_traim(instance); + } + + memcpy(instance->BEHn, buf, (size_t) len); /* Bn or En or Hn */ + + /* If Time RAIM doesn't like it, don't trust it */ + + if (buf[2] == 'H') { + if (instance->BEHn[6]) /* bad TRAIM */ + return; + + dt1 = instance->saw_tooth + instance->offset; /* dt this time step */ + instance->saw_tooth = (s_char) instance->BEHn[10]; /* update for next time Hn[10] */ + dt2 = instance->saw_tooth + instance->offset; /* dt next time step */ + } else { + if (instance->BEHn[21]) /* bad TRAIM */ + return; + + dt1 = instance->saw_tooth + instance->offset; /* dt this time step */ + instance->saw_tooth = (s_char) instance->BEHn[25]; /* update for next time */ + dt2 = instance->saw_tooth + instance->offset; /* dt next time step */ + } + + oncore_get_timestamp(instance, dt1, dt2); +} + + + +/* Here for @@Ca, @@Fa and @@Ia messages */ + +/* These are Self test Commands for 6, 8, and 12 chan receivers. + * There are good reasons NOT to do a @@Ca, @@Fa or @@Ia command with the ONCORE. + * 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 wasteful, and may cause trouble for some OS's, repeating + * itimer, we set a flag, and test it at the next POLL. If it hasn't + * 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; + int i; + + if (instance->o_state == ONCORE_TEST_SENT) { + enum antenna_state 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) >> 6; + buf[4] &= ~0xc0; + + i = buf[4] || buf[5]; + if (buf[2] == 'I') i = i || buf[6]; + if (i) { + if (buf[2] == 'I') { + msyslog(LOG_ERR, "ONCORE[%d]: self test failed: result %02x %02x %02x", + instance->unit, buf[4], buf[5], buf[6]); + } else { + msyslog(LOG_ERR, "ONCORE[%d]: self test failed: result %02x %02x", + instance->unit, buf[4], buf[5]); + } + cp = "ONCORE: self test failed, shutting down driver"; + record_clock_stats(&instance->peer->srcadr, cp); + + refclock_report(instance->peer, CEVNT_FAULT); + oncore_shutdown(instance->unit, instance->peer); + return; + } + + /* report the current antenna state */ + + oncore_antenna_report(instance, antenna); + + instance->o_state = ONCORE_INIT; + cp = "state = ONCORE_INIT"; + record_clock_stats(&(instance->peer->srcadr), cp); + + instance->timeout = 4; + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof(oncore_cmd_Cj)); + } +} + + + +/* + * Demultiplex the almanac into shmem + */ + +static void +oncore_msg_Cb( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + int i; + + if (instance->shmem == NULL) + return; + + if (buf[4] == 5 && buf[5] > 0 && buf[5] < 26) + i = buf[5]; + else if (buf[4] == 4 && buf[5] <= 5) + i = buf[5] + 24; + else if (buf[4] == 4 && buf[5] <= 10) + i = buf[5] + 23; + else if (buf[4] == 4 && buf[5] == 25) + i = 34; + else { + char *cp; + + cp = "Cb: Response is NO ALMANAC"; + record_clock_stats(&(instance->peer->srcadr), cp); + return; + } + + i *= 36; + instance->shmem[instance->shmem_Cb + i + 2]++; + memcpy(instance->shmem + instance->shmem_Cb + i + 3, buf, (size_t) (len + 3)); + +#if 1 + { + char Msg[160]; + sprintf(Msg, "See Cb [%d,%d]", buf[4], buf[5]); + record_clock_stats(&(instance->peer->srcadr), Msg); + } +#endif +} + + + +/* + * 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) { + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cg, sizeof(oncore_cmd_Cg)); /* Return to Posn Fix mode */ + /* Reset set VP to IDLE */ + 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)); + } +} + + + +/* + * This is the Grand Central Station for the Preliminary Initialization. + * Once done here we move on to oncore_msg_BaEaHa for final Initialization and Running. + * + * We do an @@Cj whenever we need a safe command for all Oncores. + * The @@Cj gets us back here where we can switch to the next phase of setup. + * + * o Once at the very beginning (in start) to get the Model number. + * This info is printed, but no longer used. + * o Again after we have determined the number of Channels in the receiver. + * 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. + */ + +static void +oncore_msg_Cj( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + int mode; + char *cp; + + memcpy(instance->Cj, buf, len); + + instance->timeout = 0; + if (instance->o_state == ONCORE_CHECK_ID) { + oncore_msg_Cj_id(instance, buf, len); + oncore_chan_test(instance); + } else if (instance->o_state == ONCORE_HAVE_CHAN) { + mode = instance->init_type; + if (mode == 3 || mode == 4) { /* Cf will return here to check for TEST */ + instance->o_state = ONCORE_RESET_SENT; + cp = "state = ONCORE_RESET_SENT"; + record_clock_stats(&(instance->peer->srcadr), cp); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cf, sizeof(oncore_cmd_Cf)); + } else { + instance->o_state = ONCORE_TEST_SENT; + cp = "state = ONCORE_TEST_SENT"; + record_clock_stats(&(instance->peer->srcadr), cp); + } + } + + if (instance->o_state == ONCORE_TEST_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)); + } else if (instance->o_state == ONCORE_INIT) + oncore_msg_Cj_init(instance, buf, len); +} + + + +/* The information on determining a Oncore 'Model', viz VP, UT, etc, from + * the Model Number comes from "Richard M. Hambly" + * and from Motorola. Until recently Rick was the only source of + * this information as Motorola didn't give the information out. + * + * Determine the Type from the Model #, this determines #chan and if TRAIM is + * available. + * + * The Information from this routine is NO LONGER USED. + * The RESULTS are PRINTED, BUT NOT USED, and the routine COULD BE DELETED + */ + +static void +oncore_msg_Cj_id( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char *cp, *cp1, *cp2, Model[21], Msg[160]; + + /* Write Receiver ID message to clockstats file */ + + instance->Cj[294] = '\0'; + for (cp=(char *)instance->Cj; cp< (char *) &instance->Cj[294]; ) { + cp1 = strchr(cp, '\r'); + if (!cp1) + cp1 = (char *)&instance->Cj[294]; + *cp1 = '\0'; + record_clock_stats(&(instance->peer->srcadr), cp); + *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 (Model[0] == 'P') { + cp = "M12"; + instance->model = ONCORE_M12; + } else if (Model[0] == 'R' || Model[0] == 'D' || Model[0] == 'S') { + 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; + } + + /* use MODEL to set CHAN and TRAIM and possibly zero SHMEM */ + + 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); + + instance->chan_id = 8; /* default */ + if (instance->model == ONCORE_BASIC || instance->model == ONCORE_PVT6) + instance->chan_id = 6; + else if (instance->model == ONCORE_VP || instance->model == ONCORE_UT || instance->model == ONCORE_UTPLUS) + instance->chan_id = 8; + else if (instance->model == ONCORE_M12) + instance->chan_id = 12; + + instance->traim_id = 0; /* default */ + if (instance->model == ONCORE_BASIC || instance->model == ONCORE_PVT6) + instance->traim_id = 0; + else if (instance->model == ONCORE_VP || instance->model == ONCORE_UT || instance->model == ONCORE_UTPLUS) + instance->traim_id = 1; + else if (instance->model == ONCORE_M12) + instance->traim_id = -1; + + sprintf(Msg, "Channels = %d, TRAIM = %s", instance->chan_id, + ((instance->traim_id < 0) ? "UNKNOWN" : ((instance->traim_id > 0) ? "ON" : "OFF"))); + record_clock_stats(&(instance->peer->srcadr), Msg); +} + + + +/* OK, know type of Oncore, have possibly reset it, and have tested it. + * We know the number of channels. + * We will determine whether we have TRAIM before we actually start. + * Now initialize. + */ + +static void +oncore_msg_Cj_init( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char *cp, Cmd[20], Msg[160]; + int mode; + + + /* The M12 with 1.3 or 2.0 Firmware, loses track of all Satellites and has to + * start again if we go from 0D -> 3D, then loses them again when we + * go from 3D -> 0D. We do this to get a @@Ea message for SHMEM. + * For NOW we will turn this aspect of filling SHMEM off for the M12 + */ + + if (instance->chan == 12) { + instance->shmem_bad_Ea = 1; + sprintf(Msg, "*** SHMEM partially enabled for ONCORE M12 s/w v%d.%d ***", instance->version, instance->revision); + record_clock_stats(&(instance->peer->srcadr), Msg); + } + + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cg, sizeof(oncore_cmd_Cg)); /* Return to Posn Fix mode */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bb, sizeof(oncore_cmd_Bb)); /* turn on for shmem (6/8/12) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ek, sizeof(oncore_cmd_Ek)); /* turn off (VP) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Aw, sizeof(oncore_cmd_Aw)); /* UTC time (6/8/12) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_AB, sizeof(oncore_cmd_AB)); /* Appl type static (VP) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Be, sizeof(oncore_cmd_Be)); /* Tell us the Almanac for shmem (6/8/12) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bd, sizeof(oncore_cmd_Bd)); /* Tell us when Almanac changes */ + + mode = instance->init_type; + + /* 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 do Site Survey. + */ + + if (instance->posn_set) { + record_clock_stats(&(instance->peer->srcadr), "Setting Posn from input data"); + oncore_set_posn(instance); /* this should print posn indirectly thru the As cmd */ + } else /* must issue an @@At here to check on 6/8 Position Hold, set_posn would have */ + if (instance->chan != 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Atx, sizeof(oncore_cmd_Atx)); + + if (mode != 0) { + /* cable delay in ns */ + memcpy(Cmd, oncore_cmd_Az, (size_t) sizeof(oncore_cmd_Az)); + w32_buf(&Cmd[-2+4], instance->delay); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Az)); /* 6,8,12 */ + + /* PPS offset in ns */ + if (instance->offset) { + memcpy(Cmd, oncore_cmd_Ay, (size_t) sizeof(oncore_cmd_Ay)); /* some have it, some don't */ + w32_buf(&Cmd[-2+4], instance->offset); /* will check for hw response */ + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ay)); + } + + /* Satellite mask angle */ + + if (instance->Ag != 0xff) { /* will have 0xff in it if not set by user */ + memcpy(Cmd, oncore_cmd_Ag, (size_t) sizeof(oncore_cmd_Ag)); + Cmd[-2+4] = instance->Ag; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ag)); + } + } + + /* 6, 8 12 chan - Position/Status/Data Output Message, 1/s + * now we're really running + * these were ALL started in the chan test, + * However, if we had mode=3,4 then commands got turned off, so we turn + * them on again here just in case + */ + + if (instance->chan == 6) { /* start 6chan, kill 8,12chan commands, possibly testing VP in 6chan mode */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea0, sizeof(oncore_cmd_Ea0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_En0, sizeof(oncore_cmd_En0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ha0, sizeof(oncore_cmd_Ha0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Hn0, sizeof(oncore_cmd_Hn0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ba, sizeof(oncore_cmd_Ba )); + } else if (instance->chan == 8) { /* start 8chan, kill 6,12chan commands */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ba0, sizeof(oncore_cmd_Ba0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bn0, sizeof(oncore_cmd_Bn0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ha0, sizeof(oncore_cmd_Ha0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Hn0, sizeof(oncore_cmd_Hn0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea, sizeof(oncore_cmd_Ea )); + } else if (instance->chan == 12){ /* start 12chan, kill 6,12chan commands */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ba0, sizeof(oncore_cmd_Ba0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bn0, sizeof(oncore_cmd_Bn0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea0, sizeof(oncore_cmd_Ea0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_En0, sizeof(oncore_cmd_En0)); + 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); +} + + + +/* 12chan position */ + +static void +oncore_msg_Ga( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char Msg[160]; + long lat, lon, ht; + double Lat, Lon, Ht; + + + lat = buf_w32(&buf[4]); + lon = buf_w32(&buf[8]); + ht = buf_w32(&buf[12]); /* GPS ellipsoid */ + + Lat = lat; + Lon = lon; + Ht = ht; + + Lat /= 3600000; + Lon /= 3600000; + Ht /= 100; + + + sprintf(Msg, "Ga Posn Lat = %.7f, Lon = %.7f, Ht = %.2f", Lat, Lon, Ht); + record_clock_stats(&(instance->peer->srcadr), Msg); + + instance->ss_lat = lat; + instance->ss_long = lon; + instance->ss_ht = ht; + + oncore_print_posn(instance); +} + + + +/* 12 chan time/date */ + +static void +oncore_msg_Gb( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char Msg[160], *gmts; + int mo, d, y, h, m, s, gmth, gmtm; + + mo = buf[4]; + d = buf[5]; + y = 256*buf[6]+buf[7]; + + h = buf[8]; + m = buf[9]; + s = buf[10]; + + gmts = ((buf[11] == 0) ? "+" : "-"); + gmth = buf[12]; + gmtm = buf[13]; + + sprintf(Msg, "Date/Time set to: %d%s%d %2d:%02d:%02d GMT (GMT offset is %s%02d:%02d)", + d, Month[mo+1], y, h, m, s, gmts, gmth, gmtm); + record_clock_stats(&(instance->peer->srcadr), Msg); +} + + + +/* + * Try to use Oncore M12+Timing Auto Survey Feature + * If its not there (M12), set flag to do it ourselves. + */ + +static void +oncore_msg_Gd( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char *cp; + + if (instance->site_survey == ONCORE_SS_TESTING) { + if (buf[4] == 3) { + record_clock_stats(&(instance->peer->srcadr), + "Initiating hardware 3D site survey"); + + cp = "SSstate = ONCORE_SS_HW"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->site_survey = ONCORE_SS_HW; + } + } +} + + + +/* Leap Second for M12, gives all info from satellite message */ +/* also in UT v3.0 */ + +static void +oncore_msg_Gj( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + int dt; + char Msg[160], *cp; + + instance->saw_Gj = 1; /* flag, saw_Gj, dont need to try Bj in check_leap */ + + /* 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->BEHa[6] && buf[7] == instance->BEHa[7] && /* year */ + buf[8] == instance->BEHa[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); +} + + + +/* Power on failure */ + +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); + } +} + +/************** Small Subroutines ***************/ + + +static void +oncore_antenna_report( + struct instance *instance, + enum antenna_state new_state) +{ + char *cp; + + if (instance->ant_state == new_state) + return; + + switch (new_state) { + case ONCORE_ANTENNA_OK: cp = "GPS antenna: OK"; break; + case ONCORE_ANTENNA_OC: cp = "GPS antenna: short (overcurrent)"; break; + case ONCORE_ANTENNA_UC: cp = "GPS antenna: open (not connected)"; break; + case ONCORE_ANTENNA_NV: cp = "GPS antenna: short (no voltage)"; break; + default: cp = "GPS antenna: ?"; break; + } + + instance->ant_state = new_state; + record_clock_stats(&instance->peer->srcadr, cp); +} + + + +static void +oncore_chan_test( + struct instance *instance + ) +{ + char *cp; + + /* subroutine oncore_Cj_id has determined the number of channels from the + * model number of the attached oncore. This is not always correct since + * the oncore could have non-standard firmware. Here we check (independently) by + * trying a 6, 8, and 12 chan command, and see which responds. + * Caution: more than one CAN respond. + * + * This #chan is used by the code rather than that calculated from the model number. + */ + + instance->o_state = ONCORE_CHECK_CHAN; + cp = "state = ONCORE_CHECK_CHAN"; + record_clock_stats(&(instance->peer->srcadr), cp); + + instance->count3 = 1; + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ba, sizeof(oncore_cmd_Ba)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea, sizeof(oncore_cmd_Ea)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ha, sizeof(oncore_cmd_Ha)); +} + + + +/* check for a GOOD Almanac, have we got one yet? */ + +static void +oncore_check_almanac( + struct instance *instance + ) +{ + if (instance->chan == 6) { + instance->rsm.bad_almanac = instance->BEHa[64]&0x1; + instance->rsm.bad_fix = instance->BEHa[64]&0x52; + } else if (instance->chan == 8) { + instance->rsm.bad_almanac = instance->BEHa[72]&0x1; + instance->rsm.bad_fix = instance->BEHa[72]&0x52; + } else if (instance->chan == 12) { + int bits1, bits2; + + bits1 = (instance->BEHa[129]>>5) & 0x7; /* actually Ha */ + bits2 = instance->BEHa[130]; + instance->rsm.bad_almanac = (bits2 & 0x80); + instance->rsm.bad_fix = (bits2 & 0x8) || (bits1 == 0x2); + /* too few sat Bad Geom */ +#if 0 + fprintf(stderr, "ONCORE[%d]: DEBUG BITS: (%x %x), (%x %x), %x %x %x %x %x\n", + instance->unit, + instance->BEHa[129], instance->BEHa[130], bits1, bits2, instance->mode == MODE_0D, + instance->mode == MODE_2D, instance->mode == MODE_3D, + instance->rsm.bad_almanac, instance->rsm.bad_fix); +#endif + } +} + + + +/* check the antenna for changes (did it get unplugged?) */ + +static void +oncore_check_antenna( + struct instance *instance + ) +{ + enum antenna_state antenna; /* antenna state */ + + antenna = instance->ant_state; + if (instance->chan == 12) + antenna = (instance->BEHa[130] & 0x6 ) >> 1; + else + antenna = (instance->BEHa[37] & 0xc0) >> 6; /* prob unset 6, set GT, UT unset VP */ + + oncore_antenna_report (instance, antenna); +} + + + +/* + * Check the leap second status once per day. + * + * Note that the ONCORE firmware for the Bj command is wrong at + * least in the VP. + * It starts advertising a LEAP SECOND as soon as the GPS satellite + * data message (page 18, subframe 4) is updated to a date in the + * future, and does not wait for the month that it will occur. + * The event will usually be advertised several months in advance. + * Since there is a one bit flag, there is no way to tell if it is + * this month, or when... + * + * As such, we have the workaround below, of only checking for leap + * seconds with the Bj command in June/December. + * + * The Gj command gives more information, and we can tell in which + * month to apply the correction. + * + * Note that with the VP we COULD read the raw data message, and + * interpret it ourselves, but since this is specific to this receiver + * only, and the above workaround is adequate, we don't bother. + */ + +static void +oncore_check_leap_sec( + struct instance *instance + ) +{ + if (instance->Bj_day != instance->BEHa[5]) { /* do this 1/day */ + instance->Bj_day = instance->BEHa[5]; + + if (instance->saw_Gj < 0) { /* -1 DONT have Gj use Bj */ + if ((instance->BEHa[4] == 6) || (instance->BEHa[4] == 12)) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bj, sizeof(oncore_cmd_Bj)); + return; + } + + if (instance->saw_Gj == 0) /* 0 is dont know if we have Gj */ + instance->count4 = 1; + + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gj, sizeof(oncore_cmd_Gj)); + return; + } + + /* Gj works for some 6/8 chan UT and the M12 */ + /* if no response from Gj in 5 sec, we try Bj */ + /* which isnt implemented in all the GT/UT either */ + + if (instance->count4) { /* delay, waiting for Gj response */ + if (instance->saw_Gj == 1) + instance->count4 = 0; + else if (instance->count4++ > 5) { /* delay, waiting for Gj response */ + instance->saw_Gj = -1; /* didnt see it, will use Bj */ + instance->count4 = 0; + if ((instance->BEHa[4] == 6) || (instance->BEHa[4] == 12)) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bj, sizeof(oncore_cmd_Bj)); + } + } +} + + + +/* check the message checksum, + * buf points to START of message ( @@ ) + * len is length WITH CR/LF. + */ + +static int +oncore_checksum_ok( + u_char *buf, + int len + ) +{ + int i, j; + + j = 0; + for (i = 2; i < len-3; i++) + j ^= buf[i]; + + return(j == buf[len-3]); +} + + + +static void +oncore_compute_dH( + struct instance *instance + ) +{ + int GPS, MSL; + char Msg[160]; + + /* Here calculate dH = GPS - MSL for output message */ + /* also set Altitude Hold mode if GT */ + + instance->have_dH = 1; + if (instance->chan == 12) { + GPS = buf_w32(&instance->BEHa[39]); + MSL = buf_w32(&instance->BEHa[43]); + } else { + GPS = buf_w32(&instance->BEHa[23]); + MSL = buf_w32(&instance->BEHa[27]); + } + instance->dH = GPS - MSL; + instance->dH /= 100.; + + /* if MSL is not set, the calculation is meaningless */ + + if (MSL) { /* not set ! */ + sprintf(Msg, "dH = (GPS - MSL) = %.2fm", instance->dH); + record_clock_stats(&(instance->peer->srcadr), Msg); + } +} + + + +/* + * try loading Almanac from shmem (where it was copied from shmem_old + */ + +static void +oncore_load_almanac( + struct instance *instance + ) +{ + u_char *cp, Cmd[20]; + int n; + struct timeval tv; + struct tm *tm; + + if (!instance->shmem) + return; + +#if 1 + for (cp=instance->shmem+4; (n = 256*(*(cp-3)) + *(cp-2)); cp+=(n+3)) { + if (!strncmp(cp, "@@Cb", 4) && + oncore_checksum_ok(cp, 33) && + (*(cp+4) == 4 || *(cp+4) == 5)) { + write(instance->ttyfd, cp, n); +#if 1 + oncore_print_Cb(instance, cp); +#endif + } + } +#else +/************DEBUG************/ + for (cp=instance->shmem+4; (n = 256*(*(cp-3)) + *(cp-2)); cp+=(n+3)) { + char Msg[160]; + + sprintf(Msg, "See %c%c%c%c %d", *(cp), *(cp+1), *(cp+2), *(cp+3), *(cp+4)); + record_clock_stats(&(instance->peer->srcadr), Msg); + + if (!strncmp(cp, "@@Cb", 4)) { + oncore_print_Cb(instance, cp); + if (oncore_checksum_ok(cp, 33)) { + if (*(cp+4) == 4 || *(cp+4) == 5) { + record_clock_stats(&(instance->peer->srcadr), "GOOD SF"); + write(instance->ttyfd, cp, n); + } else + record_clock_stats(&(instance->peer->srcadr), "BAD SF"); + } else + record_clock_stats(&(instance->peer->srcadr), "BAD CHECKSUM"); + } + } +/************DEBUG************/ +#endif + + /* Must load position and time or the Almanac doesn't do us any good */ + + if (!instance->posn_set) { /* if we input a posn use it, else from SHMEM */ + record_clock_stats(&(instance->peer->srcadr), "Loading Posn from SHMEM"); + for (cp=instance->shmem+4; (n = 256*(*(cp-3)) + *(cp-2)); cp+=(n+3)) { + if ((instance->chan == 6 && (!strncmp(cp, "@@Ba", 4) && oncore_checksum_ok(cp, 68))) || + (instance->chan == 8 && (!strncmp(cp, "@@Ea", 4) && oncore_checksum_ok(cp, 76))) || + (instance->chan == 12 && (!strncmp(cp, "@@Ha", 4) && oncore_checksum_ok(cp, 154)))) { + int ii, jj, kk; + + instance->posn_set = 1; + ii = buf_w32(cp + 15); + jj = buf_w32(cp + 19); + kk = buf_w32(cp + 23); +{ +char Msg[160]; +sprintf(Msg, "SHMEM posn = %d (%d, %d, %d)", cp-instance->shmem, ii, jj, kk); +record_clock_stats(&(instance->peer->srcadr), Msg); +} + if (ii != 0 || jj != 0 || kk != 0) { /* phk asked for this test */ + instance->ss_lat = ii; + instance->ss_long = jj; + instance->ss_ht = kk; + } + } + } + } + oncore_set_posn(instance); + + /* and set time to time from Computer clock */ + + gettimeofday(&tv, 0); + tm = gmtime((const time_t *) &tv.tv_sec); +#if 1 + { + char Msg[160]; + sprintf(Msg, "DATE %d %d %d, %d %d %d", 1900+tm->tm_year, tm->tm_mon, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + record_clock_stats(&(instance->peer->srcadr), Msg); + } +#endif + if (instance->chan == 12) { + memcpy(Cmd, oncore_cmd_Gb, (size_t) sizeof(oncore_cmd_Gb)); + Cmd[-2+4] = tm->tm_mon; + Cmd[-2+5] = tm->tm_mday; + Cmd[-2+6] = (1900+tm->tm_year)/256; + Cmd[-2+7] = (1900+tm->tm_year)%256; + Cmd[-2+8] = tm->tm_hour; + Cmd[-2+9] = tm->tm_min; + Cmd[-2+10] = tm->tm_sec; + Cmd[-2+11] = 0; + Cmd[-2+12] = 0; + Cmd[-2+13] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Gb)); + } else { + /* First set GMT offset to zero */ + + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ab, sizeof(oncore_cmd_Ab)); + + memcpy(Cmd, oncore_cmd_Ac, (size_t) sizeof(oncore_cmd_Ac)); + Cmd[-2+4] = tm->tm_mon; + Cmd[-2+5] = tm->tm_mday; + Cmd[-2+6] = (1900+tm->tm_year)/256; + Cmd[-2+7] = (1900+tm->tm_year)%256; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ac)); + + memcpy(Cmd, oncore_cmd_Aa, (size_t) sizeof(oncore_cmd_Aa)); + Cmd[-2+4] = tm->tm_hour; + Cmd[-2+5] = tm->tm_min; + Cmd[-2+6] = tm->tm_sec; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Aa)); + } + + record_clock_stats(&(instance->peer->srcadr), "Setting Posn and Time after Loading Almanac"); +} + + + +/* Almanac data input */ + +static void +oncore_print_Cb( + struct instance *instance, + u_char *cp + ) +{ +#if 0 + int ii; + char Msg[160]; + + printf("DEBUG: See: %c%c%c%c\n", *(cp), *(cp+1), *(cp+2), *(cp+3)); + printf("DEBUG: Cb: [%d,%d]", *(cp+4), *(cp+5)); + for(ii=0; ii<33; ii++) + printf(" %d", *(cp+ii)); + printf("\n"); + + sprintf(Msg, "Debug: Cb: [%d,%d]", *(cp+4), *(cp+5)); + record_clock_stats(&(instance->peer->srcadr), Msg); +#endif +} + + +#if 0 +static void +oncore_print_array( + u_char *cp, + int n + ) +{ + int jj, i, j, nn; + + nn = 0; + printf("\nTOP\n"); + jj = n/16; + for (j=0; jprinted || instance->As) - return; - - instance->As = 1; - - lat = buf_w32(&buf[4]); - instance->ss_lat = lat; - - lon = buf_w32(&buf[8]); - instance->ss_long = lon; - - ht = buf_w32(&buf[12]); - instance->ss_ht = ht; - - instance->ss_ht_type = buf[16]; - - /* Print out Position */ + long lat, lon; record_clock_stats(&(instance->peer->srcadr), "Posn:"); ew = 'E'; @@ -1876,11 +3398,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; @@ -1889,7 +3410,8 @@ 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; @@ -1898,60 +3420,306 @@ 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); } /* - * get PPS Offset - * Nb. @@Ay is not supported for early UT (no plus) model + * write message to Oncore. */ + static void -oncore_msg_Ay( - struct instance *instance, - u_char *buf, - u_int len +oncore_sendmsg( + int fd, + u_char *ptr, + size_t len ) { - char Msg[120]; + u_char cs = 0; - if (!instance->printed || instance->Ay) - return; + if (debug > 4) + 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, (size_t) 1); + write(fd, "\r\n", (size_t) 2); +} - instance->Ay = 1; - instance->offset = buf_w32(&buf[4]); - sprintf(Msg, "PPS Offset is set to %ld ns", instance->offset); +static void +oncore_set_posn( + struct instance *instance + ) +{ + int mode; + char Cmd[20]; + + /* 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)); /* (12) */ + else { + oncore_sendmsg(instance->ttyfd, oncore_cmd_At0, sizeof(oncore_cmd_At0)); /* (6/8) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av0, sizeof(oncore_cmd_Av0)); /* (6/8) */ + } + + mode = instance->init_type; + + if (mode != 0) { /* first set posn hold position */ + memcpy(Cmd, oncore_cmd_As, (size_t) sizeof(oncore_cmd_As)); /* don't modify static variables */ + w32_buf(&Cmd[-2+4], (int) instance->ss_lat); + w32_buf(&Cmd[-2+8], (int) instance->ss_long); + w32_buf(&Cmd[-2+12], (int) instance->ss_ht); + Cmd[-2+16] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_As)); /* posn hold 3D posn (6/8/12) */ + + memcpy(Cmd, oncore_cmd_Au, (size_t) sizeof(oncore_cmd_Au)); + w32_buf(&Cmd[-2+4], (int) instance->ss_ht); + Cmd[-2+8] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Au)); /* altitude hold (6/8/12 not UT, M12T) */ + + /* next set current position */ + + if (instance->chan == 12) { + memcpy(Cmd, oncore_cmd_Ga, (size_t) sizeof(oncore_cmd_Ga)); + w32_buf(&Cmd[-2+4], (int) instance->ss_lat); + w32_buf(&Cmd[-2+8], (int) instance->ss_long); + w32_buf(&Cmd[-2+12],(int) instance->ss_ht); + Cmd[-2+16] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ga)); /* 3d posn (12) */ + } else { + memcpy(Cmd, oncore_cmd_Ad, (size_t) sizeof(oncore_cmd_Ad)); + w32_buf(&Cmd[-2+4], (int) instance->ss_lat); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ad)); /* lat (6/8) */ + + memcpy(Cmd, oncore_cmd_Ae, (size_t) sizeof(oncore_cmd_Ae)); + w32_buf(&Cmd[-2+4], (int) instance->ss_long); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ae)); /* long (6/8) */ + + memcpy(Cmd, oncore_cmd_Af, (size_t) sizeof(oncore_cmd_Af)); + w32_buf(&Cmd[-2+4], (int) instance->ss_ht); + Cmd[-2+8] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Af)); /* ht (6/8) */ + } + + /* Finally, turn on position hold */ + + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd1, sizeof(oncore_cmd_Gd1)); + else + oncore_sendmsg(instance->ttyfd, oncore_cmd_At1, sizeof(oncore_cmd_At1)); + } +} + + + +static void +oncore_set_traim( + struct instance *instance + ) +{ + char Msg[160]; + + if (instance->traim_in != -1) /* set in Input */ + instance->traim = instance->traim_in; + else + instance->traim = instance->traim_ck; + + sprintf(Msg, "Input says TRAIM = %d", instance->traim_in); record_clock_stats(&(instance->peer->srcadr), Msg); + sprintf(Msg, "Model # says TRAIM = %d", instance->traim_id); + record_clock_stats(&(instance->peer->srcadr), Msg); + sprintf(Msg, "Testing says TRAIM = %d", instance->traim_ck); + record_clock_stats(&(instance->peer->srcadr), Msg); + sprintf(Msg, "Using TRAIM = %d", instance->traim); + record_clock_stats(&(instance->peer->srcadr), Msg); + + if (instance->traim_ck == 1 && instance->traim == 0) { + /* if it should be off, and I turned it on during testing, + then turn it off again */ + if (instance->chan == 6) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bnx, sizeof(oncore_cmd_Bnx)); + else if (instance->chan == 8) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Enx, sizeof(oncore_cmd_Enx)); + else /* chan == 12 */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ge0, sizeof(oncore_cmd_Ge0)); + } } /* - * get Cable Delay + * if SHMEM active, every 15s, steal one 'tick' to get 2D or 3D posn. */ + static void -oncore_msg_Az( - struct instance *instance, - u_char *buf, - u_int len +oncore_shmem_get_3D( + struct instance *instance ) { - char Msg[120]; - - if (!instance->printed || instance->Az) - return; - - instance->Az = 1; - - instance->delay = buf_w32(&buf[4]); - - sprintf(Msg, "Cable delay is set to %ld ns", instance->delay); - record_clock_stats(&(instance->peer->srcadr), Msg); + if (instance->pp->second%15 == 3) { /* start the sequence */ /* by changing mode */ + 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) { /* out of 0D -> 3D mode */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_At0, sizeof(oncore_cmd_At0)); + if (instance->shmem_Posn == 2) /* 3D -> 2D mode */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av1, sizeof(oncore_cmd_Av1)); + } 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) /* 2D -> 3D or 0D mode */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av0, sizeof(oncore_cmd_Av0)); + 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)); + } + } } + + + +/* + * Here we do the Software SiteSurvey. + * We have to average our own position for the Position Hold Mode + * We use Heights from the GPS ellipsoid. + * We check for the END of either HW or SW SiteSurvey. + */ + +static void +oncore_ss( + struct instance *instance + ) +{ + char *cp, Msg[160]; + double lat, lon, ht; + + + if (instance->site_survey == ONCORE_SS_HW) { + + /* + * Check to see if Hardware SiteSurvey has Finished. + */ + + if ((instance->chan == 8 && !(instance->BEHa[37] & 0x20)) || + (instance->chan == 12 && !(instance->BEHa[130] & 0x10))) { + record_clock_stats(&(instance->peer->srcadr), "Now in 0D mode"); + + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gax, sizeof(oncore_cmd_Gax)); + else + oncore_sendmsg(instance->ttyfd, oncore_cmd_Asx, sizeof(oncore_cmd_Asx)); + + cp = "SSstate = ONCORE_SS_DONE"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->site_survey = ONCORE_SS_DONE; + } + } else { + /* + * Must be a Software Site Survey. + */ + + if (instance->rsm.bad_fix) /* Not if poor geometry or less than 3 sats */ + return; + + if (instance->mode != MODE_3D) /* Use only 3D Fixes */ + return; + + instance->ss_lat += buf_w32(&instance->BEHa[15]); + instance->ss_long += buf_w32(&instance->BEHa[19]); + instance->ss_ht += buf_w32(&instance->BEHa[23]); /* GPS ellipsoid */ + instance->ss_count++; + + if (instance->ss_count != POS_HOLD_AVERAGE) + return; + + instance->ss_lat /= POS_HOLD_AVERAGE; + instance->ss_long /= POS_HOLD_AVERAGE; + instance->ss_ht /= POS_HOLD_AVERAGE; + + sprintf(Msg, "Surveyed posn: lat %.3f (mas) long %.3f (mas) ht %.3f (cm)", + instance->ss_lat, instance->ss_long, instance->ss_ht); + record_clock_stats(&(instance->peer->srcadr), Msg); + lat = instance->ss_lat/3600000.; + lon = instance->ss_long/3600000.; + ht = instance->ss_ht/100; + sprintf(Msg, "Surveyed posn: lat %.7f (deg) long %.7f (deg) ht %.2f (m)", + lat, lon, ht); + record_clock_stats(&(instance->peer->srcadr), Msg); + + oncore_set_posn(instance); + + record_clock_stats(&(instance->peer->srcadr), "Now in 0D mode"); + + cp = "SSstate = ONCORE_SS_DONE"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->site_survey = ONCORE_SS_DONE; + } +} + + + +static int +oncore_wait_almanac( + struct instance *instance + ) +{ + if (instance->rsm.bad_almanac) { + if (debug) + printf("ONCORE[%d]: waiting for almanac\n", instance->unit); + + /* + * If we get here (first time) then we don't have an almanac in memory. + * Check if we have a SHMEM, and if so try to load whatever is there. + */ + + if (!instance->almanac_from_shmem) { + instance->almanac_from_shmem = 1; + oncore_load_almanac(instance); + } + return(1); + } else { /* Here we have the Almanac, we will be starting the @@Bn/@@En/@@Hn + commands, and can finally check for TRAIM. Again, we set a delay + (5sec) and wait for things to settle down */ + + 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)); + else if (instance->chan == 12) { + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gc, sizeof(oncore_cmd_Gc)); /* 1PPS on, continuous */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ge, sizeof(oncore_cmd_Ge)); /* TRAIM on */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Hn, sizeof(oncore_cmd_Hn)); /* TRAIM status 1/s */ + } + instance->traim_delay = 1; + + record_clock_stats(&(instance->peer->srcadr), "Have now loaded an ALMANAC"); + + instance->o_state = ONCORE_RUN; + record_clock_stats(&(instance->peer->srcadr), "state = ONCORE_RUN"); + } + return(0); +} + + + #else int refclock_oncore_bs; #endif /* REFCLOCK */ diff --git a/dist/ntp/ntpd/refclock_palisade.c b/dist/ntp/ntpd/refclock_palisade.c index 8fa33b30a4f9..ae8fe415e3d2 100644 --- a/dist/ntp/ntpd/refclock_palisade.c +++ b/dist/ntp/ntpd/refclock_palisade.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_palisade.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_palisade.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * This software was developed by the Software and Component Technologies diff --git a/dist/ntp/ntpd/refclock_palisade.h b/dist/ntp/ntpd/refclock_palisade.h index 3c58308e1d6f..27ca6e047a77 100644 --- a/dist/ntp/ntpd/refclock_palisade.h +++ b/dist/ntp/ntpd/refclock_palisade.h @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_palisade.h,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_palisade.h,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * This software was developed by the Software and Component Technologies diff --git a/dist/ntp/ntpd/refclock_parse.c b/dist/ntp/ntpd/refclock_parse.c index 18d9360a7610..c46483ad0f52 100644 --- a/dist/ntp/ntpd/refclock_parse.c +++ b/dist/ntp/ntpd/refclock_parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.2 2002/12/06 15:09:38 thorpej Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * /src/NTP/ntp-4/ntpd/refclock_parse.c,v 4.36 1999/11/28 17:18:20 kardel RELEASE_19991128_A @@ -769,8 +769,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 */ @@ -806,7 +804,7 @@ static struct parse_clockinfo const char *cl_description; /* device name */ const char *cl_format; /* fixed format */ u_char cl_type; /* clock type (ntp control) */ - u_long cl_maxunsync; /* time to trust oscillator after loosing synch */ + u_long cl_maxunsync; /* time to trust oscillator after losing synch */ u_long cl_speed; /* terminal input & output baudrate */ u_long cl_cflag; /* terminal control flags */ u_long cl_iflag; /* terminal input flags */ @@ -1171,21 +1169,21 @@ 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 */ + (1*60*60), /* time to trust oscillator after losing synch */ B9600, /* terminal input & output baudrate */ (CS8|CREAD|PARENB|CLOCAL|HUPCL),/* terminal control flags */ 0, /* terminal input flags */ @@ -3099,7 +3097,7 @@ parse_event( NLOG(NLOG_CLOCKEVENT) /* conditional if clause for conditional syslog */ ERR(ERR_BADEVENT) msyslog(LOG_ERR, - "clock %s fault '%s' (0x%02x)", refnumtoa(parse->peer->srcadr.sin_addr.s_addr), ceventstr(event), + "clock %s fault '%s' (0x%02x)", refnumtoa(&parse->peer->srcadr), ceventstr(event), (u_int)event); } else @@ -3107,7 +3105,7 @@ parse_event( NLOG(NLOG_CLOCKEVENT) /* conditional if clause for conditional syslog */ if (event == CEVNT_NOMINAL || list_err(parse, ERR_BADEVENT)) msyslog(LOG_INFO, - "clock %s event '%s' (0x%02x)", refnumtoa(parse->peer->srcadr.sin_addr.s_addr), ceventstr(event), + "clock %s event '%s' (0x%02x)", refnumtoa(&parse->peer->srcadr), ceventstr(event), (u_int)event); } @@ -3732,11 +3730,11 @@ gps16x_message( case GPS_ANT_INFO: { ANT_INFO antinfo; - char buffer[512]; - char *p; + u_char buffer[512]; + u_char *p; get_mbg_antinfo(&bufp, &antinfo); - sprintf((char *)buffer, "meinberg_antenna_status=\""); + sprintf(buffer, "meinberg_antenna_status=\""); p = buffer + strlen(buffer); switch (antinfo.status) @@ -3754,20 +3752,20 @@ gps16x_message( CLK_UNIT(parse->peer), p); p += strlen(p); - mbg_tm_str((void *)&p, &antinfo.tm_disconn); + mbg_tm_str(&p, &antinfo.tm_disconn); *p = '\0'; break; case ANT_RECONN: strcat(p, "RECONNECTED on "); p += strlen(p); - mbg_tm_str((void *)&p, &antinfo.tm_reconn); + mbg_tm_str(&p, &antinfo.tm_reconn); sprintf(p, ", reconnect clockoffset %c%ld.%07ld s, disconnect time ", (antinfo.delta_t < 0) ? '-' : '+', ABS(antinfo.delta_t) / 10000, ABS(antinfo.delta_t) % 10000); p += strlen(p); - mbg_tm_str((void *)&p, &antinfo.tm_disconn); + mbg_tm_str(&p, &antinfo.tm_disconn); *p = '\0'; break; @@ -3790,8 +3788,8 @@ gps16x_message( case GPS_CFGH: { CFGH cfgh; - char buffer[512]; - char *p; + u_char buffer[512]; + u_char *p; get_mbg_cfgh(&bufp, &cfgh); if (cfgh.valid) @@ -3801,7 +3799,7 @@ gps16x_message( p = buffer; strcpy(buffer, "gps_tot_51=\""); p += strlen(p); - mbg_tgps_str((void *)&p, &cfgh.tot_51); + mbg_tgps_str(&p, &cfgh.tot_51); *p++ = '"'; *p = '\0'; set_var(&parse->kv, buffer, sizeof(buffer), RO); @@ -3809,7 +3807,7 @@ gps16x_message( p = buffer; strcpy(buffer, "gps_tot_63=\""); p += strlen(p); - mbg_tgps_str((void *)&p, &cfgh.tot_63); + mbg_tgps_str(&p, &cfgh.tot_63); *p++ = '"'; *p = '\0'; set_var(&parse->kv, buffer, sizeof(buffer), RO); @@ -3817,7 +3815,7 @@ gps16x_message( p = buffer; strcpy(buffer, "gps_t0a=\""); p += strlen(p); - mbg_tgps_str((void *)&p, &cfgh.t0a); + mbg_tgps_str(&p, &cfgh.t0a); *p++ = '"'; *p = '\0'; set_var(&parse->kv, buffer, sizeof(buffer), RO); @@ -5152,16 +5150,24 @@ rawdcf_init_1( struct parseunit *parse ) { + /* fixed 2000 for using with Linux by Wolfram Pienkoss */ /* * 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) @@ -5172,7 +5178,7 @@ rawdcf_init_1( } #else static int -rawdcfdtr_init( +rawdcfdtr_init_1( struct parseunit *parse ) { @@ -5191,16 +5197,24 @@ rawdcf_init_2( struct parseunit *parse ) { + /* fixed 2000 for using with Linux by Wolfram Pienkoss */ /* * 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/dist/ntp/ntpd/refclock_pcf.c b/dist/ntp/ntpd/refclock_pcf.c index e8859d9c495d..d2dc55e5f49f 100644 --- a/dist/ntp/ntpd/refclock_pcf.c +++ b/dist/ntp/ntpd/refclock_pcf.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_pcf.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_pcf.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_pcf - clock driver for the Conrad parallel port radio clock diff --git a/dist/ntp/ntpd/refclock_pst.c b/dist/ntp/ntpd/refclock_pst.c index a7f8b768da29..5c646e1b3347 100644 --- a/dist/ntp/ntpd/refclock_pst.c +++ b/dist/ntp/ntpd/refclock_pst.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_pst.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_pst.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_pst - clock driver for PSTI/Traconex WWV/WWVH receivers diff --git a/dist/ntp/ntpd/refclock_ptbacts.c b/dist/ntp/ntpd/refclock_ptbacts.c index 911d46169a5d..16ed0c593a63 100644 --- a/dist/ntp/ntpd/refclock_ptbacts.c +++ b/dist/ntp/ntpd/refclock_ptbacts.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_ptbacts.c,v 1.1.1.1 2000/03/29 12:38:54 simonb Exp $ */ +/* $NetBSD: refclock_ptbacts.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * crude hack to avoid hard links in distribution diff --git a/dist/ntp/ntpd/refclock_ripencc.c b/dist/ntp/ntpd/refclock_ripencc.c index 95b4c3f30b4e..1df1f65fd8b4 100644 --- a/dist/ntp/ntpd/refclock_ripencc.c +++ b/dist/ntp/ntpd/refclock_ripencc.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_ripencc.c,v 1.1.1.1 2003/12/04 16:05:30 drochner Exp $ */ +/* $NetBSD: refclock_ripencc.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * Id: refclock_ripencc.c,v 1.13 2002/06/18 14:20:55 marks Exp marks diff --git a/dist/ntp/ntpd/refclock_shm.c b/dist/ntp/ntpd/refclock_shm.c index 1d57e04bdaef..94e18a0825e1 100644 --- a/dist/ntp/ntpd/refclock_shm.c +++ b/dist/ntp/ntpd/refclock_shm.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_shm.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_shm.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_shm - clock driver for utc via shared memory diff --git a/dist/ntp/ntpd/refclock_tpro.c b/dist/ntp/ntpd/refclock_tpro.c index a5ce7d8876e2..19ef384f6800 100644 --- a/dist/ntp/ntpd/refclock_tpro.c +++ b/dist/ntp/ntpd/refclock_tpro.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_tpro.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_tpro.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_tpro - clock driver for the KSI/Odetics TPRO-S IRIG-B reader diff --git a/dist/ntp/ntpd/refclock_trak.c b/dist/ntp/ntpd/refclock_trak.c index ef5324ede916..e86d90931463 100644 --- a/dist/ntp/ntpd/refclock_trak.c +++ b/dist/ntp/ntpd/refclock_trak.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_trak.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_trak.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_trak - clock driver for the TRAK 8810 GPS Station Clock diff --git a/dist/ntp/ntpd/refclock_true.c b/dist/ntp/ntpd/refclock_true.c index 07b8e474664d..a4b606e58967 100644 --- a/dist/ntp/ntpd/refclock_true.c +++ b/dist/ntp/ntpd/refclock_true.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_true.c,v 1.3 2001/09/24 13:22:28 wiz Exp $ */ +/* $NetBSD: refclock_true.c,v 1.4 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_true - clock driver for the Kinemetrics Truetime receivers @@ -14,16 +14,15 @@ #if defined(REFCLOCK) && defined(CLOCK_TRUETIME) -#include -#include -#include - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include +#include + /* 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 @@ -64,11 +63,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 @@ -111,6 +111,7 @@ * flag4 - use the PCL-720 (BSD/OS only) */ + /* * Definitions */ @@ -174,9 +175,6 @@ static void true_receive P((struct recvbuf *)); static void true_poll P((int, struct peer *)); static void true_send P((struct peer *, const char *)); static void true_doevent P((struct peer *, enum true_event)); -static void true_debug P((struct peer *peer, const char *fmt, ...)) - __attribute__((__format__(__printf__, 2, 3))); - #ifdef CLOCK_PPS720 static u_long true_sample720 P((void)); @@ -207,6 +205,7 @@ true_debug(struct peer *peer, const char *fmt, ...) struct refclockproc *pp; struct true_unit *up; + va_start(ap, fmt); pp = peer->procptr; up = (struct true_unit *)pp->unitptr; @@ -215,11 +214,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); @@ -234,10 +234,8 @@ true_debug(struct peer *peer, const char *fmt, ...) } if (up->debug) { - va_start(ap, fmt); fprintf(up->debug, "true%d: ", up->unit); vfprintf(up->debug, fmt, ap); - va_end(ap); } } #endif /*STDC*/ @@ -253,13 +251,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); @@ -331,6 +329,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. @@ -342,14 +344,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 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; @@ -366,7 +371,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; } @@ -406,7 +412,7 @@ true_receive( } } else { - refclock_report(peer, CEVNT_BADREPLY); + /*refclock_report(peer, CEVNT_BADREPLY);*/ label = "UNKNOWN"; } true_debug(peer, "GOES: station %s\n", label); @@ -434,13 +440,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; } @@ -473,9 +480,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); @@ -495,6 +505,7 @@ true_receive( refclock_report(peer, CEVNT_BADTIME); return; } + off.l_uf = 0; #endif pp->usec = true_sample720(); @@ -533,7 +544,13 @@ 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 + */ + pp->lastref = pp->lastrec; refclock_receive(peer); + refclock_report(peer, CEVNT_NOMINAL); /* * We have succedded in answering the poll. diff --git a/dist/ntp/ntpd/refclock_tt560.c b/dist/ntp/ntpd/refclock_tt560.c index a3762b2d7705..3e7cf72161e3 100644 --- a/dist/ntp/ntpd/refclock_tt560.c +++ b/dist/ntp/ntpd/refclock_tt560.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_tt560.c,v 1.1.1.1 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_tt560.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_tt560 - clock driver for the TrueTime 560 IRIG-B decoder diff --git a/dist/ntp/ntpd/refclock_ulink.c b/dist/ntp/ntpd/refclock_ulink.c index 5d1861fba1a9..5b7177a56ec2 100644 --- a/dist/ntp/ntpd/refclock_ulink.c +++ b/dist/ntp/ntpd/refclock_ulink.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_ulink.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_ulink.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_ulink - clock driver for Ultralink WWVB receiver diff --git a/dist/ntp/ntpd/refclock_usno.c b/dist/ntp/ntpd/refclock_usno.c index ce8559296d8e..61a59fc3fa60 100644 --- a/dist/ntp/ntpd/refclock_usno.c +++ b/dist/ntp/ntpd/refclock_usno.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_usno.c,v 1.1.1.2 2003/12/04 16:05:29 drochner Exp $ */ +/* $NetBSD: refclock_usno.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_usno - clock driver for the Naval Observatory dialup diff --git a/dist/ntp/ntpd/refclock_wwv.c b/dist/ntp/ntpd/refclock_wwv.c index 256df8952720..1a599b368323 100644 --- a/dist/ntp/ntpd/refclock_wwv.c +++ b/dist/ntp/ntpd/refclock_wwv.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_wwv.c,v 1.2 2001/09/16 16:34:24 wiz Exp $ */ +/* $NetBSD: refclock_wwv.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */ /* * refclock_wwv - clock driver for NIST WWV/H time/frequency station @@ -9,14 +9,6 @@ #if defined(REFCLOCK) && defined(CLOCK_WWV) -#include -#include -#include -#include -#ifdef HAVE_SYS_IOCTL_H -#include -#endif /* HAVE_SYS_IOCTL_H */ - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" @@ -24,7 +16,14 @@ #include "ntp_stdlib.h" #include "audio.h" -#define ICOM 1 /* undefine to suppress ICOM code */ +#include +#include +#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif /* HAVE_SYS_IOCTL_H */ + +#define ICOM 1 #ifdef ICOM #include "icom.h" @@ -35,7 +34,7 @@ * * This driver synchronizes the computer time using data encoded in * radio transmissions from NIST time/frequency stations WWV in Boulder, - * CO, and WWVH in Kauai, HI. Transmikssions are made continuously on + * CO, and WWVH in Kauai, HI. Transmissions are made continuously on * 2.5, 5, 10, 15 and 20 MHz in 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 using this @@ -43,16 +42,16 @@ * night. * * The driver receives, demodulates and decodes the radio signals when - * connected to the audio codec of a Sun workstation running SunOS or - * Solaris, and with a little help, other workstations with similar - * codecs or sound cards. In this implementation, only one audio driver - * and codec can be supported on a single machine. + * connected to the audio codec of a workstation running Solaris, SunOS + * FreeBSD or Linux, and with a little help, other workstations with + * similar codecs or sound cards. In this implementation, only one audio + * driver and codec can be supported on a single machine. * * The demodulation and decoding algorithms used in this driver are * based on those developed for the TAPR DSP93 development board and the * TI 320C25 digital signal processor 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 + * Report 97-8-1, University of Delaware, August 1997, 25 pp., available * from www.eecis.udel.edu/~mills/reports.htm. The algorithms described * in this report have been modified somewhat to improve performance * under weak signal conditions and to provide an automatic station @@ -66,66 +65,70 @@ /* * Interface definitions */ +#define DEVICE_AUDIO "/dev/audio" /* audio device name */ +#define AUDIO_BUFSIZ 320 /* audio buffer size (50 ms) */ #define PRECISION (-10) /* precision assumed (about 1 ms) */ -#define REFID "NONE" /* reference ID */ #define DESCRIPTION "WWV/H Audio Demodulator/Decoder" /* WRU */ #define SECOND 8000 /* second epoch (sample rate) (Hz) */ #define MINUTE (SECOND * 60) /* minute epoch */ #define OFFSET 128 /* companded sample offset */ #define SIZE 256 /* decompanding table size */ -#define MAXSIG 6000. /* maximum signal level reference */ +#define MAXSIG 6000. /* max signal level reference */ +#define MAXCLP 100 /* max clips above reference per s */ #define MAXSNR 30. /* max SNR reference */ #define DGAIN 20. /* data channel gain reference */ #define SGAIN 10. /* sync channel gain reference */ -#define MAXFREQ (125e-6 * SECOND) /* freq tolerance (.0125%) */ +#define MAXFREQ 1. /* max frequency tolerance (125 PPM) */ #define PI 3.1415926535 /* the real thing */ #define DATSIZ (170 * MS) /* data matched filter size */ #define SYNSIZ (800 * MS) /* minute sync matched filter size */ -#define UTCYEAR 72 /* the first UTC year */ #define MAXERR 30 /* max data bit errors in minute */ -#define NCHAN 5 /* number of channels */ - -/* - * Macroni - */ -#define MOD(x, y) ((x) < 0 ? -(-(x) % (y)) : (x) % (y)) +#define NCHAN 5 /* number of radio channels */ +#define AUDIO_PHI 5e-6 /* dispersion growth factor */ +#ifdef IRIG_SUCKS +#define WIGGLE 11 /* wiggle filter length */ +#endif /* IRIG_SUCKS */ /* * General purpose status bits (status) * - * Notes: SELV and/or SELH are set when the minute sync pulse from - * either or both WWV and/or WWVH stations has been heard. MSYNC is set - * when the minute sync pulse has been acquired and never reset. SSYNC - * is set when the second sync pulse has been acquired and cleared by - * watchdog or signal loss. DSYNC is set when the minutes unit digit has - * reached the threshold and INSYNC is set when if all nine digits have - * reached the threshold and never cleared. + * SELV and/or SELH are set when WWV or WWVH has been heard and cleared + * on signal loss. SSYNC is set when the second sync pulse has been + * acquired and cleared by signal loss. MSYNC is set when the minute + * sync pulse has been acquired. DSYNC is set when a digit reaches the + * threshold and INSYNC is set when all nine digits have reached the + * threshold. The MSYNC, DSYNC and INSYNC bits are cleared only by + * timeout, upon which the driver starts over from scratch. * - * DGATE is set if a data bit is invalid, BGATE is set if a BCD digit + * DGATE is set if a data bit is invalid and BGATE is set if a BCD digit * bit is invalid. SFLAG is set when during seconds 59, 0 and 1 while - * probing for alternate frequencies. LEPSEC is set when the SECWAR of - * the timecode is set on the last second of 30 June or 31 December. At - * the end of this minute both the receiver and transmitter insert - * second 60 in the minute and the minute sync slips a second. + * probing alternate frequencies. LEPDAY is set when SECWAR of the + * timecode is set on 30 June or 31 December. LEPSEC is set during the + * last minute of the day when LEPDAY is set. At the end of this minute + * the driver inserts second 60 in the seconds state machine and the + * minute sync slips a second. The SLOSS and SJITR bits are for monitor + * only. */ #define MSYNC 0x0001 /* minute epoch sync */ #define SSYNC 0x0002 /* second epoch sync */ #define DSYNC 0x0004 /* minute units sync */ #define INSYNC 0x0008 /* clock synchronized */ -#define DGATE 0x0010 /* data bit error */ -#define BGATE 0x0020 /* BCD digit bit error */ +#define FGATE 0x0010 /* frequency gate */ +#define DGATE 0x0020 /* data bit error */ +#define BGATE 0x0040 /* BCD digit bit error */ #define SFLAG 0x1000 /* probe flag */ -#define LEPSEC 0x2000 /* leap second in progress */ +#define LEPDAY 0x2000 /* leap second day */ +#define LEPSEC 0x4000 /* leap second minute */ /* - * Station scoreboard bits (select) + * Station scoreboard bits * * These are used to establish the signal quality for each of the five * frequencies and two stations. */ -#define JITRNG 0x0001 /* jitter above threshold */ -#define SYNCNG 0x0002 /* sync below threshold or SNR */ -#define DATANG 0x0004 /* data below threshold or SNR */ +#define SYNCNG 0x0001 /* sync or SNR below threshold */ +#define DATANG 0x0002 /* data or SNR below threshold */ +#define ERRRNG 0x0004 /* data error */ #define SELV 0x0100 /* WWV station select */ #define SELH 0x0200 /* WWVH station select */ @@ -133,75 +136,72 @@ * Alarm status bits (alarm) * * These bits indicate various alarm conditions, which are decoded to - * form the quality character included in the timecode. There are four - * four-bit nibble fields in the word, each corresponding to a specific - * alarm condition. At the end of each second, the word is shifted left - * one position and the least significant bit of each nibble cleared. - * This bit can be set during the next minute if the associated alarm - * condition is raised. This provides a way to remember alarm conditions - * up to four minutes. - * - * If not tracking both minute sync and second sync, the SYNERR alarm is - * raised. The data error counter is incremented for each invalid data - * bit. If too many data bit errors are encountered in one minute, the - * MODERR alarm is raised. The DECERR alarm is raised if a maximum - * likelihood digit fails to compare with the current clock digit. If - * the probability of any miscellaneous bit or any digit falls below the - * threshold, the SYMERR alarm is raised. + * form the quality character included in the timecode. If not tracking + * second sync, the SYNERR alarm is raised. The data error counter is + * incremented for each invalid data bit. If too many data bit errors + * are encountered in one minute, the MODERR alarm is raised. The DECERR + * alarm is raised if a maximum likelihood digit fails to compare with + * the current clock digit. If the probability of any miscellaneous bit + * or any digit falls below the threshold, the SYMERR alarm is raised. */ -#define DECERR 0 /* BCD digit compare error */ -#define SYMERR 4 /* low bit or digit probability */ -#define MODERR 8 /* too many data bit errors */ -#define SYNERR 12 /* not synchronized to station */ +#define DECERR 1 /* BCD digit compare error */ +#define SYMERR 2 /* low bit or digit probability */ +#define MODERR 4 /* too many data bit errors */ +#define SYNERR 8 /* not synchronized to station */ /* - * Watchdog timeouts (watch) + * Watchcat timeouts (watch) * * If these timeouts expire, the status bits are mashed to zero and the * driver starts from scratch. Suitably more refined procedures may be * developed in future. All these are in minutes. */ -#define ACQSN 5 /* acquisition timeout */ -#define HSPEC 15 /* second sync timeout */ +#define ACQSN 5 /* station acquisition timeout */ #define DIGIT 30 /* minute unit digit timeout */ -#define PANIC (4 * 1440) /* panic timeout */ +#define HOLD 30 /* reachable timeout */ +#define PANIC (2 * 1440) /* panic timeout */ /* * Thresholds. These establish the minimum signal level, minimum SNR and * maximum jitter thresholds which establish the error and false alarm - * rates of the receiver. The values defined here may be on the + * rates of the driver. The values defined here may be on the * adventurous side in the interest of the highest sensitivity. */ -#define ATHR 2000 /* acquisition amplitude threshold */ -#define ASNR 6.0 /* acquisition SNR threshold (dB) */ -#define AWND 50 /* acquisition window threshold (ms) */ -#define AMIN 3 /* acquisition min compare count */ -#define AMAX 6 /* max compare count */ -#define QTHR 2000 /* QSY amplitude threshold */ -#define QSNR 20.0 /* QSY SNR threshold (dB) */ +#define MTHR 13. /* acquisition signal gate (percent) */ +#define TTHR 50. /* tracking signal gate (percent) */ +#define ATHR 2000. /* acquisition amplitude threshold */ +#define ASNR 6. /* acquisition SNR threshold (dB) */ +#define AWND 20. /* acquisition jitter threshold (ms) */ +#define AMIN 3 /* min bit count */ +#define AMAX 6 /* max bit count */ +#define QTHR 2000 /* QSY sync threshold */ +#define QSNR 20. /* QSY sync SNR threshold (dB) */ +#define XTHR 1000. /* QSY data threshold */ +#define XSNR 10. /* QSY data SNR threshold (dB) */ #define STHR 500 /* second sync amplitude threshold */ +#define SSNR 10. /* second sync SNR threshold */ #define SCMP 10 /* second sync compare threshold */ #define DTHR 1000 /* bit amplitude threshold */ -#define DSNR 10.0 /* bit SNR threshold (dB) */ -#define BTHR 1000 /* digit probability threshold */ -#define BSNR 3.0 /* digit likelihood threshold (dB) */ -#define BCMP 5 /* digit compare threshold (dB) */ +#define DSNR 10. /* bit SNR threshold (dB) */ +#define BTHR 1000 /* digit amplitude threshold */ +#define BSNR 3. /* digit likelihood threshold (dB) */ +#define BCMP 5 /* digit compare threshold */ /* - * Tone frequency definitions. + * Tone frequency definitions. The increments are for 4.5-deg sine + * table. */ -#define MS 8 /* samples per millisecond */ -#define IN100 1 /* 100 Hz 4.5-deg sin table */ -#define IN1000 10 /* 1000 Hz 4.5-deg sin table */ -#define IN1200 12 /* 1200 Hz 4.5-deg sin table */ +#define MS (SECOND / 1000) /* samples per millisecond */ +#define IN100 ((100 * 80) / SECOND) /* 100 Hz increment */ +#define IN1000 ((1000 * 80) / SECOND) /* 1000 Hz increment */ +#define IN1200 ((1200 * 80) / SECOND) /* 1200 Hz increment */ /* * Acquisition and tracking time constants. Usually powers of 2. */ -#define MINAVG 8 /* min time constant (s) */ -#define MAXAVG 7 /* max time constant (log2 s) */ -#define TCONST 16 /* minute time constant (s) */ -#define SYNCTC (1024 / (1 << MAXAVG)) /* FLL constant (s) */ +#define MINAVG 8 /* min time constant */ +#define MAXAVG 1024 /* max time constant */ +#define TCONST 16 /* data bit/digit time constant */ /* * Miscellaneous status bits (misc) @@ -214,30 +214,20 @@ #define DUT2 0x02 /* 57 DUT .2 */ #define DUT4 0x04 /* 58 DUT .4 */ #define DUTS 0x08 /* 50 DUT sign */ -#define DST1 0x10 /* 55 DST1 DST in progress */ -#define DST2 0x20 /* 2 DST2 DST change warning */ +#define DST1 0x10 /* 55 DST1 leap warning */ +#define DST2 0x20 /* 2 DST2 DST1 delayed one day */ #define SECWAR 0x40 /* 3 leap second warning */ /* - * The total system delay with the DSP93 program is at 22.5 ms, - * including the propagation delay from Ft. Collins, CO, to Newark, DE - * (8.9 ms), the communications receiver delay and the delay of the - * DSP93 program itself. The DSP93 program delay is due mainly to the - * 400-Hz FIR bandpass filter (5 ms) and second sync matched filter (5 - * ms), leaving about 3.6 ms for the receiver delay and strays. - * - * The total system delay with this program is estimated at 27.1 ms by - * comparison with another PPS-synchronized NTP server over a 10-Mb/s - * Ethernet. The propagation and receiver delays are the same as with - * the DSP93 program. The program delay is due only to the 600-Hz - * IIR bandpass filter (1.1 ms), since other delays have been removed. - * Assuming 4.7 ms for the receiver, program and strays, this leaves - * 13.5 ms for the audio codec and operating system latencies for a - * total of 18.2 ms. as the systematic delay. The additional propagation - * delay specific to each receiver location can be programmed in the - * fudge time1 and time2 values for WWV and WWVH, respectively. + * The on-time synchronization point for the driver is the second epoch + * sync pulse produced by the FIR matched filters. As the 5-ms delay of + * these filters is compensated, the program delay is 1.1 ms due to the + * 600-Hz IIR bandpass filter. The measured receiver delay is 4.7 ms and + * the codec delay less than 0.2 ms. The additional propagation delay + * specific to each receiver location can be programmed in the fudge + * time1 and time2 values for WWV and WWVH, respectively. */ -#define PDELAY (.0036 + .0011 + .0135) /* net system delay (s) */ +#define PDELAY (.0011 + .0047 + .0002) /* net system delay (s) */ /* * Table of sine values at 4.5-degree increments. This is used by the @@ -282,20 +272,19 @@ struct progx { * Case switch numbers */ #define IDLE 0 /* no operation */ -#define COEF 1 /* BCD bit conditioned on DSYNC */ -#define COEF1 2 /* BCD bit */ -#define COEF2 3 /* BCD bit ignored */ -#define DECIM9 4 /* BCD digit 0-9 */ -#define DECIM6 5 /* BCD digit 0-6 */ -#define DECIM3 6 /* BCD digit 0-3 */ -#define DECIM2 7 /* BCD digit 0-2 */ -#define MSCBIT 8 /* miscellaneous bit */ -#define MSC20 9 /* miscellaneous bit */ -#define MSC21 10 /* QSY probe channel */ -#define MIN1 11 /* minute */ -#define MIN2 12 /* leap second */ -#define SYNC2 13 /* QSY data channel */ -#define SYNC3 14 /* QSY data channel */ +#define COEF 1 /* BCD bit */ +#define COEF2 2 /* BCD bit ignored */ +#define DECIM9 3 /* BCD digit 0-9 */ +#define DECIM6 4 /* BCD digit 0-6 */ +#define DECIM3 5 /* BCD digit 0-3 */ +#define DECIM2 6 /* BCD digit 0-2 */ +#define MSCBIT 7 /* miscellaneous bit */ +#define MSC20 8 /* miscellaneous bit */ +#define MSC21 9 /* QSY probe channel */ +#define MIN1 10 /* minute */ +#define MIN2 11 /* leap second */ +#define SYNC2 12 /* QSY data channel */ +#define SYNC3 13 /* QSY data channel */ /* * Offsets in decoding matrix @@ -316,10 +305,10 @@ struct progx progx[] = { {COEF, 3}, /* 7 8 */ {DECIM9, YR}, /* 8 */ {IDLE, 0}, /* 9 p1 */ - {COEF1, 0}, /* 10 1 minute units */ - {COEF1, 1}, /* 11 2 */ - {COEF1, 2}, /* 12 4 */ - {COEF1, 3}, /* 13 8 */ + {COEF, 0}, /* 10 1 minute units */ + {COEF, 1}, /* 11 2 */ + {COEF, 2}, /* 12 4 */ + {COEF, 3}, /* 13 8 */ {DECIM9, MN}, /* 14 */ {COEF, 0}, /* 15 10 minute tens */ {COEF, 1}, /* 16 20 */ @@ -444,8 +433,8 @@ double bcd2[][4] = { */ char dstcod[] = { 'S', /* 00 standard time */ - 'I', /* 01 daylight warning */ - 'O', /* 10 standard warning */ + 'I', /* 01 set clock ahead at 0200 local */ + 'O', /* 10 set clock back at 0200 local */ 'D' /* 11 daylight time */ }; @@ -474,32 +463,32 @@ struct decvec { * for WWVH. Other than frequency, the format is the same. */ struct sync { - double amp; /* sync amplitude (I, Q square) */ - double synamp; /* sync envelope at 800 ms */ - double synmax; /* sync envelope at 0 s */ - double synmin; /* avg sync envelope at 59 s, 1 s */ - double synsnr; /* sync signal SNR */ - double noise; /* max amplitude off pulse */ - double sigmax; /* max amplitude on pulse */ - double lastmax; /* last max amplitude on pulse */ - long pos; /* position at maximum amplitude */ - long lastpos; /* last position at maximum amplitude */ - long jitter; /* shake, wiggle and waggle */ + double epoch; /* accumulated epoch differences */ + double maxamp; /* sync max envelope (square) */ + double noiamp; /* sync noise envelope (square) */ + long pos; /* max amplitude position */ + long lastpos; /* last max position */ long mepoch; /* minute synch epoch */ - int count; /* compare counter */ + + double amp; /* sync amplitude (I, Q squares) */ + double synamp; /* sync max envelope at 800 ms */ + double synmax; /* sync envelope at 0 s */ + double synmin; /* sync envelope at 59, 1 s */ + double synsnr; /* sync signal SNR */ + int count; /* bit counter */ char refid[5]; /* reference identifier */ - char ident[4]; /* station identifier */ int select; /* select bits */ + int reach; /* reachability register */ }; /* - * The channel structure is used to mitigate between channels. At this - * point we have already decided which station to use. + * The channel structure is used to mitigate between channels. */ struct chan { int gain; /* audio gain */ - int errcnt; /* data bit error counter */ - double noiamp; /* I-channel average noise amplitude */ + double sigamp; /* data max envelope (square) */ + double noiamp; /* data noise envelope (square) */ + double datsnr; /* data signal SNR */ struct sync wwv; /* wwv station */ struct sync wwvh; /* wwvh station */ }; @@ -510,37 +499,42 @@ struct chan { struct wwvunit { l_fp timestamp; /* audio sample timestamp */ l_fp tick; /* audio sample increment */ - double comp[SIZE]; /* decompanding table */ double phase, freq; /* logical clock phase and frequency */ double monitor; /* audio monitor point */ int fd_icom; /* ICOM file descriptor */ int errflg; /* error flags */ - int bufcnt; /* samples in buffer */ - int bufptr; /* buffer index pointer */ + int watch; /* watchcat */ + + /* + * Audio codec variables + */ + double comp[SIZE]; /* decompanding table */ int port; /* codec port */ int gain; /* codec gain */ + int mongain; /* codec monitor gain */ int clipcnt; /* sample clipped count */ - int seccnt; /* second countdown */ - int minset; /* minutes since last clock set */ - int watch; /* watchcat */ - int swatch; /* second sync watchcat */ +#ifdef IRIG_SUCKS + l_fp wigwag; /* wiggle accumulator */ + int wp; /* wiggle filter pointer */ + l_fp wiggle[WIGGLE]; /* wiggle filter */ + l_fp wigbot[WIGGLE]; /* wiggle bottom fisher*/ +#endif /* IRIG_SUCKS */ /* * Variables used to establish basic system timing */ - int avgint; /* log2 master time constant (s) */ - int epoch; /* second epoch ramp */ - int repoch; /* receiver sync epoch */ - int yepoch; /* transmitter sync epoch */ + int avgint; /* master time constant */ + int tepoch; /* sync epoch median */ + int yepoch; /* sync epoch */ + int repoch; /* buffered sync epoch */ double epomax; /* second sync amplitude */ + double eposnr; /* second sync SNR */ double irig; /* data I channel amplitude */ double qrig; /* data Q channel amplitude */ int datapt; /* 100 Hz ramp */ double datpha; /* 100 Hz VFO control */ - int rphase; /* receiver sample counter */ - int rsec; /* receiver seconds counter */ + int rphase; /* second sample counter */ long mphase; /* minute sample counter */ - long nepoch; /* minute epoch index */ /* * Variables used to mitigate which channel to use @@ -555,19 +549,16 @@ struct wwvunit { * Variables used by the clock state machine */ struct decvec decvec[9]; /* decoding matrix */ - int cdelay; /* WWV propagation delay (samples) */ - int hdelay; /* WVVH propagation delay (samples) */ - int pdelay; /* propagation delay (samples) */ - int tphase; /* transmitter sample counter */ - int tsec; /* transmitter seconds counter */ + int rsec; /* seconds counter */ int digcnt; /* count of digits synchronized */ /* * Variables used to estimate signal levels and bit/digit * probabilities */ - double sigamp; /* I-channel peak signal amplitude */ - double noiamp; /* I-channel average noise amplitude */ + double sigsig; /* data max signal */ + double sigamp; /* data max envelope (square) */ + double noiamp; /* data noise envelope (square) */ double datsnr; /* data SNR (dB) */ /* @@ -577,6 +568,7 @@ struct wwvunit { int alarm; /* alarm flashers */ int misc; /* miscellaneous timecode bits */ int errcnt; /* data bit error counter */ + int errbit; /* data bit errors in minute */ }; /* @@ -592,10 +584,10 @@ static void wwv_poll P((int, struct peer *)); */ static void wwv_epoch P((struct peer *)); static void wwv_rf P((struct peer *, double)); -static void wwv_endpoc P((struct peer *, double, int)); +static void wwv_endpoc P((struct peer *, int)); static void wwv_rsec P((struct peer *, double)); static void wwv_qrz P((struct peer *, struct sync *, - double)); + double, int)); static void wwv_corr4 P((struct peer *, struct decvec *, double [], double [][4])); static void wwv_gain P((struct peer *)); @@ -605,7 +597,12 @@ static int timecode P((struct wwvunit *, char *)); static double wwv_snr P((double, double)); static int carry P((struct decvec *)); static void wwv_newchan P((struct peer *)); +static void wwv_newgame P((struct peer *)); +static double wwv_metric P((struct sync *)); +#ifdef ICOM static int wwv_qsy P((struct peer *, int)); +#endif /* ICOM */ + static double qsy[NCHAN] = {2.5, 5, 10, 15, 20}; /* frequencies (MHz) */ /* @@ -627,13 +624,12 @@ struct refclock refclock_wwv = { */ static int wwv_start( - int unit, /* instance number (not used) */ + int unit, /* instance number (used by PCM) */ struct peer *peer /* peer structure pointer */ ) { struct refclockproc *pp; struct wwvunit *up; - struct chan *cp; #ifdef ICOM int temp; #endif /* ICOM */ @@ -648,7 +644,7 @@ wwv_start( /* * Open audio device */ - fd = audio_init(); + fd = audio_init(DEVICE_AUDIO, AUDIO_BUFSIZ, unit); if (fd < 0) return (0); #ifdef DEBUG @@ -659,12 +655,11 @@ wwv_start( /* * Allocate and initialize unit structure */ - if (!(up = (struct wwvunit *) - emalloc(sizeof(struct wwvunit)))) { - (void) close(fd); + if (!(up = (struct wwvunit *)emalloc(sizeof(struct wwvunit)))) { + close(fd); return (0); } - memset((char *)up, 0, sizeof(struct wwvunit)); + memset(up, 0, sizeof(struct wwvunit)); pp = peer->procptr; pp->unitptr = (caddr_t)up; pp->io.clock_recv = wwv_receive; @@ -672,7 +667,7 @@ wwv_start( pp->io.datalen = 0; pp->io.fd = fd; if (!io_addclock(&pp->io)) { - (void)close(fd); + close(fd); free(up); return (0); } @@ -682,8 +677,6 @@ wwv_start( */ peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; - memcpy((char *)&pp->refid, REFID, 4); - DTOLFP(1. / SECOND, &up->tick); /* * The companded samples are encoded sign-magnitude. The table @@ -699,6 +692,7 @@ wwv_start( if (i % 16 == 0) step *= 2.; } + DTOLFP(1. / SECOND, &up->tick); /* * Initialize the decoding matrix with the radix for each digit @@ -713,22 +707,8 @@ wwv_start( up->decvec[DA + 2].radix = 4; up->decvec[YR].radix = 10; /* years */ up->decvec[YR + 1].radix = 10; - - /* - * Initialize the station processes for audio gain, select bit, - * station/frequency identifier and reference identifier. - */ - up->gain = 127; - for (i = 0; i < NCHAN; i++) { - cp = &up->mitig[i]; - cp->gain = up->gain; - cp->wwv.select = SELV; - strcpy(cp->wwv.refid, "WWV "); - sprintf(cp->wwv.ident,"C%.0f", floor(qsy[i])); - cp->wwvh.select = SELH; - strcpy(cp->wwvh.refid, "WWVH"); - sprintf(cp->wwvh.ident, "H%.0f", floor(qsy[i])); - } + wwv_newgame(peer); + up->schan = up->achan = 3; /* * Initialize autotune if available. Start out at 15 MHz. Note @@ -750,14 +730,17 @@ wwv_start( temp); } if (up->fd_icom > 0) { - up->schan = 3; - if ((temp = wwv_qsy(peer, up->schan)) < 0) { + if ((temp = wwv_qsy(peer, up->schan)) != 0) { NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) - msyslog(LOG_ERR, - "ICOM bus error; autotune disabled"); + msyslog(LOG_NOTICE, + "icom: radio not found"); up->errflg = CEVNT_FAULT; close(up->fd_icom); up->fd_icom = 0; + } else { + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, + "icom: autotune enabled"); } } #endif /* ICOM */ @@ -808,10 +791,8 @@ wwv_receive( */ double sample; /* codec sample */ u_char *dpt; /* buffer pointer */ + int bufcnt; /* buffer counter */ l_fp ltemp; - int isneg; - double dtemp; - int i, j; peer = (struct peer *)rbufp->recv_srcclock; pp = peer->procptr; @@ -821,13 +802,12 @@ wwv_receive( * Main loop - read until there ain't no more. Note codec * samples are bit-inverted. */ + DTOLFP((double)rbufp->recv_length / SECOND, <emp); + L_SUB(&rbufp->recv_time, <emp); up->timestamp = rbufp->recv_time; - up->bufcnt = rbufp->recv_length; - DTOLFP((double)up->bufcnt / SECOND, <emp); - L_SUB(&up->timestamp, <emp); dpt = rbufp->recv_buffer; - for (up->bufptr = 0; up->bufptr < up->bufcnt; up->bufptr++) { - sample = up->comp[~*dpt & 0xff]; + for (bufcnt = 0; bufcnt < rbufp->recv_length; bufcnt++) { + sample = up->comp[~*dpt++ & 0xff]; /* * Clip noise spikes greater than MAXSIG. If no clips, @@ -843,14 +823,17 @@ wwv_receive( } /* - * Variable frequency oscillator. A phase change of one - * unit produces a change of 360 degrees; a frequency - * change of one unit produces a change of 1 Hz. + * Variable frequency oscillator. The codec oscillator + * runs at the nominal rate of 8000 samples per second, + * or 125 us per sample. A frequency change of one unit + * results in either duplicating or deleting one sample + * per second, which results in a frequency change of + * 125 PPM. */ up->phase += up->freq / SECOND; if (up->phase >= .5) { up->phase -= 1.; - } else if (up->phase < - .5) { + } else if (up->phase < -.5) { up->phase += 1.; wwv_rf(peer, sample); wwv_rf(peer, sample); @@ -858,71 +841,30 @@ wwv_receive( wwv_rf(peer, sample); } L_ADD(&up->timestamp, &up->tick); - - /* - * Once each second adjust the codec port and gain. - * While at it, initialize the propagation delay for - * both WWV and WWVH. Don't forget to correct for the - * receiver phase delay, mostly due to the 600-Hz - * IIR bandpass filter used for the sync signals. - */ - up->cdelay = (int)(SECOND * (pp->fudgetime1 + PDELAY)); - up->hdelay = (int)(SECOND * (pp->fudgetime2 + PDELAY)); - up->seccnt = (up->seccnt + 1) % SECOND; - if (up->seccnt == 0) { - if (pp->sloppyclockflag & CLK_FLAG2) - up->port = 2; - else - up->port = 1; - } - - /* - * During development, it is handy to have an audio - * monitor that can be switched to various signals. This - * code converts the linear signal left in up->monitor - * to codec format. - */ - isneg = 0; - dtemp = up->monitor; - if (sample < 0) { - isneg = 1; - dtemp -= dtemp; - } - i = 0; - j = OFFSET >> 1; - while (j != 0) { - if (dtemp > up->comp[i]) - i += j; - else if (dtemp < up->comp[i]) - i -= j; - else - break; - j >>= 1; - } - if (isneg) - *dpt = ~(i + OFFSET); - else - *dpt = ~i; - dpt++; } /* - * Squawk to the monitor speaker if enabled. + * Set the input port and monitor gain for the next buffer. */ + if (pp->sloppyclockflag & CLK_FLAG2) + up->port = 2; + else + up->port = 1; if (pp->sloppyclockflag & CLK_FLAG3) - if (write(pp->io.fd, (u_char *)&rbufp->recv_space, - (u_int)up->bufcnt) < 0) - perror("wwv:"); + up->mongain = MONGAIN; + else + up->mongain = 0; } /* * wwv_poll - called by the transmit procedure * - * This routine keeps track of status. If nothing is heard for two - * successive poll intervals, a timeout event is declared and any - * orphaned timecode updates are sent to foster care. Once the clock is - * set, it always appears reachable, unless reset by watchdog timeout. + * This routine keeps track of status. If no offset samples have been + * processed during a poll interval, a timeout event is declared. If + * errors have have occurred during the interval, they are reported as + * well. Once the clock is set, it always appears reachable, unless + * reset by watchdog timeout. */ static void wwv_poll( @@ -937,13 +879,10 @@ wwv_poll( up = (struct wwvunit *)pp->unitptr; if (pp->coderecv == pp->codeproc) up->errflg = CEVNT_TIMEOUT; - else - pp->polls++; - if (up->status & INSYNC) - peer->reach |= 1; if (up->errflg) refclock_report(peer, up->errflg); up->errflg = 0; + pp->polls++; } @@ -955,36 +894,27 @@ wwv_poll( * form, plus the epoch index of the second sync signal and the second * index of the minute sync signal. * - * There are three 1-s ramps used by this program, all spanning the - * range 0-7999 logical samples for exactly one second, as determined by - * the logical clock. The first drives the second epoch and runs - * continuously. The second determines the receiver phase and the third - * the transmitter phase within the second. The receiver second begins - * upon arrival of the 5-ms second sync pulse which begins the second; - * while the transmitter second begins before it by the specified - * propagation delay. + * There are two 1-s ramps used by this program. Both count the 8000 + * logical clock samples spanning exactly one second. The epoch ramp + * counts the samples starting at an arbitrary time. The rphase ramp + * counts the samples starting at the 5-ms second sync pulse found + * during the epoch ramp. * - * There are three 1-m ramps spanning the range 0-59 seconds. The first - * drives the minute epoch in samples and runs continuously. The second - * determines the receiver second and the third the transmitter second. - * The receiver second begins upon arrival of the 800-ms sync pulse sent - * during the first second of the minute; while the transmitter second - * begins before it by the specified propagation delay. - * - * The output signals include the epoch maximum and phase and second - * maximum and index. The epoch phase provides the master reference for - * all signal and timing functions, while the second index identifies - * the first second of the minute. The epoch and second maxima are used - * to calculate SNR for gating functions. + * There are two 1-m ramps used by this program. The mphase ramp counts + * the 480,000 logical clock samples spanning exactly one minute and + * starting at an arbitrary time. The rsec ramp counts the 60 seconds of + * the minute starting at the 800-ms minute sync pulse found during the + * mphase ramp. The rsec ramp drives the seconds state machine to + * determine the bits and digits of the timecode. * * Demodulation operations are based on three synthesized quadrature - * sinusoids: 100 Hz for the data subcarrier, 1000 Hz for the WWV sync - * signals and 1200 Hz for the WWVH sync signal. These drive synchronous - * matched filters for the data subcarrier (170 ms at 100 Hz), WWV - * minute sync signal (800 ms at 1000 Hz) and WWVH minute sync signal - * (800 ms at 1200 Hz). Two additional matched filters are switched in - * as required for the WWV seconds sync signal (5 ms at 1000 Hz) and - * WWVH seconds sync signal (5 ms at 1200 Hz). + * sinusoids: 100 Hz for the data signal, 1000 Hz for the WWV sync + * signal and 1200 Hz for the WWVH sync signal. These drive synchronous + * matched filters for the data signal (170 ms at 100 Hz), WWV minute + * sync signal (800 ms at 1000 Hz) and WWVH minute sync signal (800 ms + * at 1200 Hz). Two additional matched filters are switched in + * as required for the WWV second sync signal (5 ms at 1000 Hz) and + * WWVH second sync signal (5 ms at 1200 Hz). */ static void wwv_rf( @@ -994,6 +924,7 @@ wwv_rf( { struct refclockproc *pp; struct wwvunit *up; + struct sync *sp; static double lpf[5]; /* 150-Hz lpf delay line */ double data; /* lpf output */ @@ -1023,13 +954,14 @@ wwv_rf( static int epopos; /* epoch sync position buffer */ static int iniflg; /* initialization flag */ - struct sync *sp; - double dtemp; - long ltemp; - int i; + int epoch; /* comb filter index */ + int pdelay; /* propagation delay (samples) */ + double dtemp; + int i; pp = peer->procptr; up = (struct wwvunit *)pp->unitptr; + if (!iniflg) { iniflg = 1; memset((char *)lpf, 0, sizeof(lpf)); @@ -1043,7 +975,6 @@ wwv_rf( memset((char *)hqbuf, 0, sizeof(hqbuf)); memset((char *)epobuf, 0, sizeof(epobuf)); } - up->monitor = isig; /* change for debug */ /* * Baseband data demodulation. The 100-Hz subcarrier is @@ -1071,13 +1002,9 @@ wwv_rf( * multiplying the filtered signal by 100-Hz sine and cosine * signals, respectively. The data signals are demodulated by * 170-ms synchronous matched filters to produce the amplitude - * and phase signals used by the decoder. Note the correction - * due to the propagation delay is necessary for seamless - * handover between WWV and WWVH. + * and phase signals used by the decoder. */ - i = up->datapt - up->pdelay % 80; - if (i < 0) - i += 80; + i = up->datapt; up->datapt = (up->datapt + IN100) % 80; dtemp = sintab[i] * data / DATSIZ * DGAIN; up->irig -= ibuf[iptr]; @@ -1125,9 +1052,14 @@ wwv_rf( * signals are demodulated by 800-ms synchronous matched filters * to synchronize the second and minute and to detect which one * (or both) the WWV or WWVH signal is present. + * + * Note the master timing ramps, which run continuously. The + * minute counter (mphase) counts the samples in the minute, + * while the second counter (epoch) counts the samples in the + * second. */ up->mphase = (up->mphase + 1) % MINUTE; - + epoch = up->mphase % SECOND; i = csinptr; csinptr = (csinptr + IN1000) % 80; dtemp = sintab[i] * syncx / SYNSIZ * SGAIN; @@ -1137,9 +1069,12 @@ wwv_rf( dtemp = sintab[i] * syncx / SYNSIZ * SGAIN; cqamp = cqamp - cqbuf[jptr] + dtemp; cqbuf[jptr] = dtemp; + sp = &up->mitig[up->schan].wwv; dtemp = ciamp * ciamp + cqamp * cqamp; - wwv_qrz(peer, &up->mitig[up->schan].wwv, dtemp); - + sp->amp = dtemp; + if (!(up->status & MSYNC)) + wwv_qrz(peer, sp, dtemp, (int)(pp->fudgetime1 * + SECOND)); i = hsinptr; hsinptr = (hsinptr + IN1200) % 80; dtemp = sintab[i] * syncx / SYNSIZ * SGAIN; @@ -1149,98 +1084,95 @@ wwv_rf( dtemp = sintab[i] * syncx / SYNSIZ * SGAIN; hqamp = hqamp - hqbuf[jptr] + dtemp; hqbuf[jptr] = dtemp; + sp = &up->mitig[up->schan].wwvh; dtemp = hiamp * hiamp + hqamp * hqamp; - wwv_qrz(peer, &up->mitig[up->schan].wwvh, dtemp); - + sp->amp = dtemp; + if (!(up->status & MSYNC)) + wwv_qrz(peer, sp, dtemp, (int)(pp->fudgetime2 * + SECOND)); jptr = (jptr + 1) % SYNSIZ; + /* + * The following section is called once per minute. It does + * housekeeping and timeout functions and empties the dustbins. + */ if (up->mphase == 0) { - - /* - * This section is called once per minute at the minute - * epoch independently of the transmitter or receiver - * minute. If the leap bit is set, set the minute epoch - * back one second so the station processes don't miss a - * beat. Then, increment the watchdog counter and test - * for two sets of conditions depending on whether - * minute sync has been acquired or not. - */ up->watch++; - if (up->rsec == 60) { - up->mphase -= SECOND; - if (up->mphase < 0) - up->mphase += MINUTE; - } else if (!(up->status & MSYNC)) { + if (!(up->status & MSYNC)) { - /* - * If minute sync has not been acquired, the - * program listens for minute sync pulses from - * both WWV and WWVH. The station with the - * greater compare count is selected, with ties - * broken by WWV, but only if the count is at - * least three. Once a station has been - * acquired, it is initialized and begins - * tracking the signal. + /* + * If minute sync has not been acquired before + * timeout, or if no signal is heard, the + * program cycles to the next frequency and + * tries again. */ - if (up->mitig[up->achan].wwv.count >= - up->mitig[up->achan].wwvh.count) - sp = &up->mitig[up->achan].wwv; - else - sp = &up->mitig[up->achan].wwvh; - if (sp->count >= AMIN) { - up->watch = up->swatch = 0; - up->status |= MSYNC; - ltemp = sp->mepoch - SYNSIZ; - if (ltemp < 0) - ltemp += MINUTE; - up->rsec = (MINUTE - ltemp) / SECOND; - if (!(up->status & SSYNC)) { - up->repoch = ltemp % SECOND; - up->yepoch = up->repoch - - up->pdelay; - if (up->yepoch < 0) - up->yepoch += SECOND; + wwv_newchan(peer); + if (!(up->status & (SELV | SELH)) || up->watch > + ACQSN) { + wwv_newgame(peer); +#ifdef ICOM + if (up->fd_icom > 0) { + up->schan = (up->schan + 1) % + NCHAN; + wwv_qsy(peer, up->schan); } - wwv_newchan(peer); - } else if (sp->count == 0 || up->watch >= ACQSN) - { - up->watch = sp->count = 0; - up->schan = (up->schan + 1) % NCHAN; - wwv_qsy(peer, up->schan); +#endif /* ICOM */ } } else { /* - * If minute sync has been acquired, the program - * watches for timeout. The timeout is reset - * when the clock is set or verified. If a - * timeout occurs and the minute units digit has - * not synchronized, reset the program and start - * over. + * If the leap bit is set, set the minute epoch + * back one second so the station processes + * don't miss a beat. */ - if (up->watch > DIGIT && !(up->status & DSYNC)) - up->watch = up->status = 0; - - /* - * If the second sync times out, dim the sync - * lamp and raise an alarm. - */ - up->swatch++; - if (up->swatch > HSPEC) - up->status &= ~SSYNC; - if (!(up->status & SSYNC)) - up->alarm |= 1 << SYNERR; + if (up->status & LEPSEC) { + up->mphase -= SECOND; + if (up->mphase < 0) + up->mphase += MINUTE; + } } } /* - * The second sync pulse is extracted using 5-ms FIR matched - * filters at 1000 Hz for WWV or 1200 Hz for WWVH. This pulse is - * used for the most precise synchronization, since if provides - * a resolution of one sample (125 us). + * When the channel metric reaches threshold and the second + * counter matches the minute epoch within the second, the + * driver has synchronized to the station. The second number is + * the remaining seconds until the next minute epoch, while the + * sync epoch is zero. Watch out for the first second; if + * already synchronized to the second, the buffered sync epoch + * must be set. + */ + if (up->status & MSYNC) { + wwv_epoch(peer); + } else if ((sp = up->sptr) != NULL) { + struct chan *cp; + + if (sp->count >= AMIN && epoch == sp->mepoch % SECOND) { + up->rsec = 60 - sp->mepoch / SECOND; + up->rphase = 0; + up->status |= MSYNC; + up->watch = 0; + if (!(up->status & SSYNC)) + up->repoch = up->yepoch = epoch; + else + up->repoch = up->yepoch; + for (i = 0; i < NCHAN; i++) { + cp = &up->mitig[i]; + cp->wwv.count = cp->wwv.reach = 0; + cp->wwvh.count = cp->wwvh.reach = 0; + } + } + } + + /* + * The second sync pulse is extracted using 5-ms (40 sample) FIR + * matched filters at 1000 Hz for WWV or 1200 Hz for WWVH. This + * pulse is used for the most precise synchronization, since if + * provides a resolution of one sample (125 us). The filters run + * only if the station has been reliably determined. */ if (up->status & SELV) { - up->pdelay = up->cdelay; + pdelay = (int)(pp->fudgetime1 * SECOND); /* * WWV FIR matched filter, five cycles of 1000-Hz @@ -1288,7 +1220,7 @@ wwv_rf( mfsync += (mf[1] = mf[0]) * -4.224514e-02; mf[0] = syncx; } else if (up->status & SELH) { - up->pdelay = up->hdelay; + pdelay = (int)(pp->fudgetime2 * SECOND); /* * WWVH FIR matched filter, six cycles of 1200-Hz @@ -1337,32 +1269,47 @@ wwv_rf( mf[0] = syncx; } else { mfsync = 0; + pdelay = 0; } /* - * Extract the seconds sync pulse using a 1-s comb filter at - * baseband. Correct for the FIR matched filter delay, which is - * 5 ms for both the WWV and WWVH filters. Blank the signal when - * probing. + * Enhance the seconds sync pulse using a 1-s (8000-sample) comb + * filter. Correct for the FIR matched filter delay, which is 5 + * ms for both the WWV and WWVH filters, and also for the + * propagation delay. Once each second look for second sync. If + * not in minute sync, fiddle the codec gain. Note the SNR is + * computed from the maximum sample and the two samples 6 ms + * before and 6 ms after it, so if we slip more than a cycle the + * SNR should plummet. */ - up->epoch = (up->epoch + 1) % SECOND; - if (up->epoch == 0) { - wwv_endpoc(peer, epomax, epopos); + dtemp = (epobuf[epoch] += (mfsync - epobuf[epoch]) / + up->avgint); + if (dtemp > epomax) { + epomax = dtemp; + epopos = epoch; + } + if (epoch == 0) { + int k, j; + up->epomax = epomax; + k = epopos - 6 * MS; + if (k < 0) + k += SECOND; + j = epopos + 6 * MS; + if (j >= SECOND) + i -= SECOND; + up->eposnr = wwv_snr(epomax, max(abs(epobuf[k]), + abs(epobuf[j]))); + epopos -= pdelay + 5 * MS; + if (epopos < 0) + epopos += SECOND; + wwv_endpoc(peer, epopos); + if (!(up->status & SSYNC)) + up->alarm |= SYNERR; epomax = 0; if (!(up->status & MSYNC)) wwv_gain(peer); } - dtemp = (epobuf[up->epoch] += (mfsync - epobuf[up->epoch]) / - (MINAVG << up->avgint)); - if (dtemp > epomax) { - epomax = dtemp; - epopos = up->epoch - up->pdelay - 5 * MS; - if (epopos < 0) - epopos += SECOND; - } - if (up->status & MSYNC) - wwv_epoch(peer); } @@ -1371,39 +1318,41 @@ wwv_rf( * * This routine implements a virtual station process used to acquire * minute sync and to mitigate among the ten frequency and station - * combinations. During minute sync acquisition, the process probes each + * combinations. During minute sync acquisition the process probes each * frequency in turn for the minute pulse from either station, which - * involves searching through the entire epoch minute of samples. After - * minute sync acquisition, the process searches only during the probe - * window, which occupies seconds 59, 0 and 1, to construct a metric - * used to determine which frequency and station provides the best - * signal. - * - * The pulse discriminator requires that (a) the peak on-pulse sample - * amplitude must be above 2000, (b) the SNR relative to the peak - * off-pulse sample amplitude must be reduced 6 dB or more below the - * peak and (c) the maximum difference between the current and previous - * epoch indices must be less than 50 ms. A compare counter keeps track - * of the number of successive intervals which satisfy these criteria. + * involves searching through the entire minute of samples. After + * finding a candidate, the process searches only the seconds before and + * after the candidate for the signal and all other seconds for the + * noise. * * Students of radar receiver technology will discover this algorithm - * amounts to a range gate discriminator. In practice, the performance - * of this gadget is amazing. Once setting teeth in a station, it hangs - * on until the minute beep can barely be heard and long after the - * second tick and comb filter have given up. + * amounts to a range gate discriminator. The discriminator requires + * that the peak minute pulse amplitude be at least 2000 and the SNR be + * at least 6 dB. In addition after finding a candidate, The peak second + * pulse amplitude must be at least 2000, the SNR at least 6 dB and the + * difference between the current and previous epoch must be less than + * 7.5 ms, which corresponds to a frequency error of 125 PPM.. A compare + * counter keeps track of the number of successive intervals which + * satisfy these criteria. + * + * Note that, while the minute pulse is found by by the discriminator, + * the actual value is determined from the second epoch. The assumption + * is that the discriminator peak occurs about 800 ms into the second, + * so the timing is retarted to the previous second epoch. */ static void wwv_qrz( - struct peer *peer, /* peerstructure pointer */ + struct peer *peer, /* peer structure pointer */ struct sync *sp, /* sync channel structure */ - double syncx /* bandpass filtered sync signal */ + double syncx, /* bandpass filtered sync signal */ + int pdelay /* propagation delay (samples) */ ) { struct refclockproc *pp; struct wwvunit *up; char tbuf[80]; /* monitor buffer */ double snr; /* on-pulse/off-pulse ratio (dB) */ - long epoch; + long epoch, fpoch; int isgood; pp = peer->procptr; @@ -1411,171 +1360,147 @@ wwv_qrz( /* * Find the sample with peak energy, which defines the minute - * epoch. If minute sync has been acquired, search only the - * probe window; otherwise, search the entire minute. If a - * maximum has been found with good amplitude, search only the - * second before and after that position for the next maximum - * and the rest of the window for the noise. + * epoch. If a sample has been found with good amplitude, + * accumulate the noise squares for all except the second before + * and after that position. */ - if (!(up->status & MSYNC) || up->status & SFLAG) { - sp->amp = syncx; - if (up->status & MSYNC) - epoch = up->nepoch; - else if (sp->count > 1) - epoch = sp->mepoch; - else - epoch = sp->lastpos; - if (syncx > sp->sigmax) { - sp->sigmax = syncx; - sp->pos = up->mphase; - } - if (abs(MOD(up->mphase - epoch, MINUTE)) > SYNSIZ && - syncx > sp->noise) { - sp->noise = syncx; - } + isgood = up->epomax > STHR && up->eposnr > SSNR; + if (isgood) { + fpoch = up->mphase % SECOND - up->tepoch; + if (fpoch < 0) + fpoch += SECOND; + } else { + fpoch = pdelay + SYNSIZ; } + epoch = up->mphase - fpoch; + if (epoch < 0) + epoch += MINUTE; + if (syncx > sp->maxamp) { + sp->maxamp = syncx; + sp->pos = epoch; + } + if (abs((epoch - sp->lastpos) % MINUTE) > SECOND) + sp->noiamp += syncx; + + /* + * At the end of the minute, determine the epoch of the + * sync pulse, as well as the SNR and difference between + * the current and previous epoch, which represents the + * intrinsic frequency error plus jitter. + */ if (up->mphase == 0) { + sp->synmax = sqrt(sp->maxamp); + sp->synmin = sqrt(sp->noiamp / (MINUTE - 2 * SECOND)); + epoch = (sp->pos - sp->lastpos) % MINUTE; /* - * At the end of the minute, determine the epoch of the - * sync pulse, as well as the SNR and difference between - * the current and previous epoch (jitter). + * If not yet in minute sync, we have to do a little + * dance to find a valid minute sync pulse, emphasis + * valid. */ - sp->jitter = MOD(sp->pos - sp->lastpos, MINUTE); - sp->select &= ~JITRNG; - if (abs(sp->jitter) > AWND * MS) - sp->select |= JITRNG; - sp->sigmax = sqrt(sp->sigmax); - sp->noise = sqrt(sp->noise); - if (up->status & MSYNC) { + snr = wwv_snr(sp->synmax, sp->synmin); + isgood = isgood && sp->synmax > ATHR && snr > ASNR; + switch (sp->count) { - /* - * If in minute sync, just count the runs up and - * down. - */ - if (sp->select & (DATANG | SYNCNG | JITRNG)) { - if (sp->count > 0) - sp->count--; - } else { - if (sp->count < AMAX) - sp->count++; - } - } else { + /* + * In state 0 the station was not heard during the + * previous probe. Look for the biggest blip greater + * than the amplitude threshold in the minute and assume + * that the minute sync pulse. We're fishing here, since + * the range gate has not yet been determined. If found, + * bump to state 1. + */ + case 0: + if (sp->synmax >= ATHR) + sp->count++; + break; - /* - * If not yet in minute sync, we have to do a - * little dance to find a valid minute sync - * pulse, emphasis valid. - */ - snr = wwv_snr(sp->sigmax, sp->noise); - isgood = sp->sigmax > ATHR && snr > ASNR && - !(sp->select & JITRNG); - switch (sp->count) { - - /* - * In state 0 the station was not heard during - * the previous probe. Look for the biggest blip - * greater than the amplitude threshold in the - * minute and assume that the minute sync pulse. - * If found, bump to state 1. - */ - case 0: - if (sp->sigmax >= ATHR) - sp->count++; + /* + * In state 1 a candidate blip has been found and the + * next minute has been searched for another blip. If + * none are found acceptable, drop back to state 0 and + * hunt some more. Otherwise, a legitimate minute pulse + * may have been found, so bump to state 2. + */ + case 1: + if (!isgood) { + sp->count = 0; break; - - /* - * In state 1 a candidate blip has been found - * and the next minute has been searched for - * another blip. If none are found greater than - * the threshold, or if the biggest blip outside - * the candidate pulse is less than 6 dB below - * the biggest blip, drop back to state 0 and - * hunt some more. Otherwise, a legitimate - * minute pulse may have been found, so bump to - * state 2. - */ - case 1: - if (sp->sigmax < ATHR) { - sp->count--; - break; - } else if (!isgood) { - break; - } - /* fall through */ - - /* - * In states 2 and above, continue to groom - * samples as before and drop back to the - * previous state if the groom fails. If it - * succeeds, bump to the next state until - * reaching the clamp, if ever. - */ - default: - if (!isgood) { - sp->count--; - break; - } - sp->mepoch = sp->pos; - if (sp->count < AMAX) - sp->count++; - break; } + sp->count++; + break; + + /* + * In states 2 and above, continue to groom samples as + * before and drop back to state 0 if the groom fails. + * If it succeeds, set the epoch and bump to the next + * state until reaching the threshold, if ever. + */ + default: + if (!isgood || abs(epoch) > AWND * MS) { + sp->count = 0; + break; + } + sp->mepoch = sp->pos; + sp->count++; + break; + } + if (pp->sloppyclockflag & CLK_FLAG4) { sprintf(tbuf, - "wwv8 %d %3d %-3s %d %5.0f %5.1f %7ld %7ld %7ld", - up->port, up->gain, sp->ident, sp->count, - sp->sigmax, snr, sp->pos, sp->jitter, - MOD(sp->pos - up->nepoch - SYNSIZ, MINUTE)); - if (pp->sloppyclockflag & CLK_FLAG4) - record_clock_stats(&peer->srcadr, tbuf); + "wwv8 %d %3d %s %d %5.0f %5.1f %5ld %5d %ld", + up->port, up->gain, sp->refid, sp->count, + sp->synmax, snr, sp->pos, up->tepoch, + epoch); + record_clock_stats(&peer->srcadr, tbuf); #ifdef DEBUG if (debug) printf("%s\n", tbuf); #endif } - sp->lastmax = sp->sigmax; sp->lastpos = sp->pos; - sp->sigmax = sp->noise = 0; + sp->maxamp = sp->noiamp = 0; } } /* - * wwv_endpoc - process receiver epoch + * wwv_endpoc - identify and acquire second sync pulse * - * This routine is called at the end of the receiver epoch. It - * determines the epoch position within the second and disciplines the - * sample clock using a frequency-lock loop (FLL). + * This routine is called at the end of the second sync interval. It + * determines the second sync epoch position within the interval and + * disciplines the sample clock using a frequency-lock loop (FLL). * - * Seconds sync is determined in the RF input routine as the maximum + * Second sync is determined in the RF input routine as the maximum * over all 8000 samples in the second comb filter. To assure accurate * and reliable time and frequency discipline, this routine performs a - * great deal of heavy-handed data filtering and grooming. + * great deal of heavy-handed heuristic data filtering and grooming. + * + * Note that, since the minute sync pulse is very wide (800 ms), precise + * minute sync epoch acquisition requires at least a rough estimate of + * the second sync pulse (5 ms). This becomes more important in choppy + * conditions at the lower frequencies at night, since sferics and + * cochannel crude can badly distort the minute pulse. */ static void wwv_endpoc( struct peer *peer, /* peer structure pointer */ - double epomax, /* epoch max */ int epopos /* epoch max position */ ) { struct refclockproc *pp; struct wwvunit *up; - static int epoch_mf[3]; /* epoch median filter */ - static int tepoch; /* median filter epoch */ - static int tspan; /* median filter span */ static int xepoch; /* last second epoch */ static int zepoch; /* last averaging interval epoch */ - static int syncnt; /* second epoch run length counter */ - static int jitcnt; /* jitter holdoff counter */ + static int syncnt; /* run length counter */ + static int maxrun; /* longest run length */ + static int mepoch; /* longest run epoch */ static int avgcnt; /* averaging interval counter */ static int avginc; /* averaging ratchet */ - static int iniflg; /* initialization flag */ char tbuf[80]; /* monitor buffer */ double dtemp; - int tmp2, tmp3; + int tmp2; pp = peer->procptr; up = (struct wwvunit *)pp->unitptr; @@ -1586,86 +1511,64 @@ wwv_endpoc( /* * A three-stage median filter is used to help denoise the - * seconds sync pulse. The median sample becomes the candidate - * epoch; the difference between the other two samples becomes - * the span, which is used currently only for debugging. + * second sync pulse. The median sample becomes the candidate + * epoch. */ epoch_mf[2] = epoch_mf[1]; epoch_mf[1] = epoch_mf[0]; epoch_mf[0] = epopos; if (epoch_mf[0] > epoch_mf[1]) { - if (epoch_mf[1] > epoch_mf[2]) { - tepoch = epoch_mf[1]; /* 0 1 2 */ - tspan = epoch_mf[0] - epoch_mf[2]; - } else if (epoch_mf[2] > epoch_mf[0]) { - tepoch = epoch_mf[0]; /* 2 0 1 */ - tspan = epoch_mf[2] - epoch_mf[1]; - } else { - tepoch = epoch_mf[2]; /* 0 2 1 */ - tspan = epoch_mf[0] - epoch_mf[1]; - } + if (epoch_mf[1] > epoch_mf[2]) + up->tepoch = epoch_mf[1]; /* 0 1 2 */ + else if (epoch_mf[2] > epoch_mf[0]) + up->tepoch = epoch_mf[0]; /* 2 0 1 */ + else + up->tepoch = epoch_mf[2]; /* 0 2 1 */ } else { - if (epoch_mf[1] < epoch_mf[2]) { - tepoch = epoch_mf[1]; /* 2 1 0 */ - tspan = epoch_mf[2] - epoch_mf[0]; - } else if (epoch_mf[2] < epoch_mf[0]) { - tepoch = epoch_mf[0]; /* 1 0 2 */ - tspan = epoch_mf[1] - epoch_mf[2]; - } else { - tepoch = epoch_mf[2]; /* 1 2 0 */ - tspan = epoch_mf[1] - epoch_mf[0]; - } + if (epoch_mf[1] < epoch_mf[2]) + up->tepoch = epoch_mf[1]; /* 2 1 0 */ + else if (epoch_mf[2] < epoch_mf[0]) + up->tepoch = epoch_mf[0]; /* 1 0 2 */ + else + up->tepoch = epoch_mf[2]; /* 1 2 0 */ } /* - * If the epoch candidate is within 1 ms of the last one, the - * new candidate replaces the last one and the jitter counter is - * reset; otherwise, the candidate is ignored and the jitter - * counter is incremented. If the jitter counter exceeds the - * frequency averaging interval, the new candidate replaces the - * old one anyway. The compare counter is incremented if the new - * candidate is identical to the last one; otherwise, it is - * forced to zero. If the compare counter increments to 10, the - * epoch is reset and the receiver second epoch is set. - * - * Careful attention to detail here. If the signal amplitude - * falls below the threshold or if no stations are heard, we - * certainly cannot be in sync. + * If the signal amplitude or SNR fall below thresholds or if no + * stations are heard, dim the second sync lamp and start over. */ - tmp2 = MOD(tepoch - xepoch, SECOND); - if (up->epomax < STHR || !(up->status & (SELV | SELH))) { - up->status &= ~SSYNC; - jitcnt = syncnt = avgcnt = 0; - } else if (abs(tmp2) <= MS || jitcnt >= (MINAVG << up->avgint)) - { - jitcnt = 0; - if (tmp2 != 0) { - xepoch = tepoch; - syncnt = 0; - } else { - if (syncnt < SCMP) { - syncnt++; - } else { - up->status |= SSYNC; - up->swatch = 0; - up->repoch = tepoch; - up->yepoch = up->repoch; - if (up->yepoch < 0) - up->yepoch += SECOND; - } - } - avgcnt++; - } else { - jitcnt++; - syncnt = avgcnt = 0; + if (!(up->status & (SELV | SELH)) || up->epomax < STHR || + up->eposnr < SSNR) { + up->status &= ~(SSYNC | FGATE); + avgcnt = syncnt = maxrun = 0; + return; } - if (!(up->status & SSYNC) && 0) { + avgcnt++; + + /* + * If the epoch candidate is the same as the last one, increment + * the compare counter. If not, save the length and epoch of the + * current run for use later and reset the counter. + */ + tmp2 = (up->tepoch - xepoch) % SECOND; + if (tmp2 == 0) { + syncnt++; + } else { + if (maxrun > 0 && mepoch == xepoch) { + maxrun += syncnt; + } else if (syncnt > maxrun) { + maxrun = syncnt; + mepoch = xepoch; + } + syncnt = 0; + } + if ((pp->sloppyclockflag & CLK_FLAG4) && !(up->status & (SSYNC | + MSYNC))) { sprintf(tbuf, - "wwv1 %2d %04x %5.0f %2d %5.0f %5d %5d %5d %2d %4d", - up->rsec, up->status, up->epomax, avgcnt, epomax, - tepoch, tspan, tmp2, syncnt, jitcnt); - if (pp->sloppyclockflag & CLK_FLAG4) - record_clock_stats(&peer->srcadr, tbuf); + "wwv1 %04x %5.0f %5.1f %5d %5d %4d %4d", + up->status, up->epomax, up->eposnr, up->tepoch, + tmp2, avgcnt, syncnt); + record_clock_stats(&peer->srcadr, tbuf); #ifdef DEBUG if (debug) printf("%s\n", tbuf); @@ -1673,72 +1576,122 @@ wwv_endpoc( } /* - * The sample clock frequency is disciplined using a first-order + * The sample clock frequency is disciplined using a first order * feedback loop with time constant consistent with the Allan - * intercept of typical computer clocks. The loop update is - * calculated each averaging interval from the epoch change in - * 125-us units and interval length in seconds. The interval is - * doubled after four intervals where epoch change is not more - * than one sample. + * intercept of typical computer clocks. * + * The frequency update is calculated from the epoch change in + * 125-us units divided by the averaging interval in seconds. * The averaging interval affects other receiver functions, - * including the the 1000/1200-Hz comb filter and sample clock + * including the the 1000/1200-Hz comb filter and codec clock * loop. It also affects the 100-Hz subcarrier loop and the bit * and digit comparison counter thresholds. */ - tmp3 = MOD(tepoch - zepoch, SECOND); - if (avgcnt >= (MINAVG << up->avgint)) { - if (abs(tmp3) < MS) { - dtemp = (double)tmp3 / avgcnt; - up->freq += dtemp / SYNCTC; - if (up->freq > MAXFREQ) - up->freq = MAXFREQ; - else if (up->freq < -MAXFREQ) - up->freq = -MAXFREQ; - if (abs(tmp3) <= 1 && up->avgint < MAXAVG) { - if (avginc < 4) { + if (avgcnt < up->avgint) { + xepoch = up->tepoch; + return; + } + + /* + * During the averaging interval the longest run of identical + * epoches is determined. If the longest run is at least 10 + * seconds, the SSYNC bit is lit and the value becomes the + * reference epoch for the next interval. If not, the second + * synd lamp is dark and flashers set. + */ + if (maxrun > 0 && mepoch == xepoch) { + maxrun += syncnt; + } else if (syncnt > maxrun) { + maxrun = syncnt; + mepoch = xepoch; + } + xepoch = up->tepoch; + if (maxrun > SCMP) { + up->status |= SSYNC; + up->yepoch = mepoch; + } else { + up->status &= ~SSYNC; + } + + /* + * If the epoch change over the averaging interval is less than + * 1 ms, the frequency is adjusted, but clamped at +-125 PPM. If + * greater than 1 ms, the counter is decremented. If the epoch + * change is less than 0.5 ms, the counter is incremented. If + * the counter increments to +3, the averaging interval is + * doubled and the counter set to zero; if it increments to -3, + * the interval is halved and the counter set to zero. + * + * Here be spooks. From careful observations, the epoch + * sometimes makes a long run of identical samples, then takes a + * lurch due apparently to lost interrupts or spooks. If this + * happens, the epoch change times the maximum run length will + * be greater than the averaging interval, so the lurch should + * be believed but the frequency left alone. Really intricate + * here. + */ + if (maxrun == 0) + mepoch = up->tepoch; + dtemp = (mepoch - zepoch) % SECOND; + if (up->status & FGATE) { + if (abs(dtemp) < MAXFREQ * MINAVG) { + if (maxrun * abs(mepoch - zepoch) < + avgcnt) { + up->freq += dtemp / avgcnt; + if (up->freq > MAXFREQ) + up->freq = MAXFREQ; + else if (up->freq < -MAXFREQ) + up->freq = -MAXFREQ; + } + if (abs(dtemp) < MAXFREQ * MINAVG / 2) { + if (avginc < 3) { avginc++; } else { - avginc = 0; - up->avgint++; + if (up->avgint < MAXAVG) { + up->avgint <<= 1; + avginc = 0; + } } } - if (up->avgint < MAXAVG) { - sprintf(tbuf, - "wwv2 %2d %04x %5.0f %5d %5d %2d %2d %6.1f %6.1f", - up->rsec, up->status, up->epomax, - MINAVG << up->avgint, avgcnt, - avginc, tmp3, dtemp / SECOND * 1e6, - up->freq / SECOND * 1e6); - if (pp->sloppyclockflag & CLK_FLAG4) - record_clock_stats( - &peer->srcadr, tbuf); -#ifdef DEBUG - if (debug) - printf("%s\n", tbuf); -#endif /* DEBUG */ + } else { + if (avginc > -3) { + avginc--; + } else { + if (up->avgint > MINAVG) { + up->avgint >>= 1; + avginc = 0; + } } } - zepoch = tepoch; - avgcnt = 0; } + if (pp->sloppyclockflag & CLK_FLAG4) { + sprintf(tbuf, + "wwv2 %04x %4.0f %4d %4d %2d %4d %4.0f %6.1f", + up->status, up->epomax, mepoch, maxrun, avginc, + avgcnt, dtemp, up->freq * 1e6 / SECOND); + record_clock_stats(&peer->srcadr, tbuf); +#ifdef DEBUG + if (debug) + printf("%s\n", tbuf); +#endif /* DEBUG */ + } + up->status |= FGATE; + zepoch = mepoch; + avgcnt = syncnt = maxrun = 0; } /* - * wwv_epoch - main loop + * wwv_epoch - epoch scanner * - * This routine establishes receiver and transmitter epoch - * synchronization and determines the data subcarrier pulse length. - * Receiver synchronization is determined by the minute sync pulse - * detected in the wwv_rf() routine and the second sync pulse detected - * in the wwv_epoch() routine. This establishes when to sample the data - * subcarrier in-phase signal for the maximum level and noise level and - * when to determine the pulse length. The transmitter second leads the - * receiver second by the propagation delay, receiver delay and filter - * delay of this program. It establishes the clock time and implements - * the sometimes idiosyncratic conventional clock time and civil - * calendar. + * This routine scans the receiver second epoch to determine the signal + * amplitudes and pulse timings. Receiver synchronization is determined + * by the minute sync pulse detected in the wwv_rf() routine and the + * second sync pulse detected in the wwv_epoch() routine. A pulse width + * discriminator extracts data signals from the 100-Hz subcarrier. The + * transmitted signals are delayed by the propagation delay, receiver + * delay and filter delay of this program. Delay corrections are + * introduced separately for WWV and WWVH. * * Most communications radios use a highpass filter in the audio stages, * which can do nasty things to the subcarrier phase relative to the @@ -1752,152 +1705,96 @@ wwv_epoch( struct peer *peer /* peer structure pointer */ ) { - static double dpulse; /* data pulse length */ struct refclockproc *pp; struct wwvunit *up; struct chan *cp; - struct sync *sp; - l_fp offset; /* NTP format offset */ + static double dpulse; /* data pulse length */ double dtemp; pp = peer->procptr; up = (struct wwvunit *)pp->unitptr; /* - * Sample the minute sync pulse amplitude at epoch 800 for both + * Sample the minute sync pulse envelopes at epoch 800 for both * the WWV and WWVH stations. This will be used later for - * channel mitigation. + * channel and station mitigation. Note that the seconds epoch + * is set here well before the end of the second to make sure we + * never seet the epoch backwards. */ - cp = &up->mitig[up->achan]; if (up->rphase == 800 * MS) { - sp = &cp->wwv; - sp->synamp = sqrt(sp->amp); - sp = &cp->wwvh; - sp->synamp = sqrt(sp->amp); + up->repoch = up->yepoch; + cp = &up->mitig[up->achan]; + cp->wwv.synamp = cp->wwv.amp; + cp->wwvh.synamp = cp->wwvh.amp; } - if (up->rsec == 0) { - up->sigamp = up->datsnr = 0; - } else { - - /* - * Estimate the noise level by integrating the I-channel - * energy at epoch 30 ms. - */ - if (up->rphase == 30 * MS) { - if (!(up->status & SFLAG)) - up->noiamp += (up->irig - up->noiamp) / - (MINAVG << up->avgint); - else - cp->noiamp += (sqrt(up->irig * - up->irig + up->qrig * up->qrig) - - cp->noiamp) / 8; - - /* - * Strobe the peak I-channel data signal at epoch 200 - * ms. Compute the SNR and adjust the 100-Hz reference - * oscillator phase using the Q-channel data signal at - * that epoch. Save the envelope amplitude for the probe - * channel. - */ - } else if (up->rphase == 200 * MS) { - if (!(up->status & SFLAG)) { - up->sigamp = up->irig; - if (up->sigamp < 0) - up->sigamp = 0; - up->datsnr = wwv_snr(up->sigamp, - up->noiamp); - up->datpha = up->qrig / (MINAVG << - up->avgint); - if (up->datpha >= 0) { - up->datapt++; - if (up->datapt >= 80) - up->datapt -= 80; - } else { - up->datapt--; - if (up->datapt < 0) - up->datapt += 80; - } - } else { - up->sigamp = sqrt(up->irig * up->irig + - up->qrig * up->qrig); - up->datsnr = wwv_snr(up->sigamp, - cp->noiamp); - } - - /* - * The slice level is set half way between the peak - * signal and noise levels. Strobe the negative zero - * crossing after epoch 200 ms and record the epoch at - * that time. This defines the length of the data pulse, - * which will later be converted into scaled bit - * probabilities. - */ - } else if (up->rphase > 200 * MS) { - dtemp = (up->sigamp + up->noiamp) / 2; - if (up->irig < dtemp && dpulse == 0) - dpulse = up->rphase; - } - } - /* - * At the end of the transmitter second, crank the clock state - * machine. Note we have to be careful to set the transmitter - * epoch at the same time as the receiver epoch to be sure the - * right propagation delay is used. We don't bother the heavy - * machinery unless the clock is set. + * Sample the data subcarrier at epoch 15 ms, giving a guard + * time of +-15 ms from the beginning of the second until the + * pulse rises at 30 ms. The I-channel amplitude is used to + * calculate the slice level. The envelope amplitude is used + * during the probe seconds to determine the SNR. There is a + * compromise here; we want to delay the sample as long as + * possible to give the radio time to change frequency and the + * AGC to stabilize, but as early as possible if the second + * epoch is not exact. */ - up->tphase++; - if (up->epoch == up->yepoch) { - wwv_tsec(up); - up->tphase = 0; + if (up->rphase == 15 * MS) { + up->noiamp = up->irig * up->irig + up->qrig * up->qrig; - /* - * Determine the current offset from the time of century - * and the sample timestamp, but only if the SYNERR - * alarm has not been raised in the present or previous - * minute. - */ - if (!(up->status & SFLAG) && up->status & INSYNC && - (up->alarm & (3 << SYNERR)) == 0) { - pp->second = up->tsec; - pp->minute = up->decvec[MN].digit + - up->decvec[MN + 1].digit * 10; - pp->hour = up->decvec[HR].digit + - up->decvec[HR + 1].digit * 10; - pp->day = up->decvec[DA].digit + up->decvec[DA + - 1].digit * 10 + up->decvec[DA + 2].digit * - 100; - pp->year = up->decvec[YR].digit + - up->decvec[YR + 1].digit * 10; - if (pp->year < UTCYEAR) - pp->year += 2000; - else - pp->year += 1900; - - /* - * We have to simulate refclock_process() here, - * since the fudgetime gets added much earlier - * than this. - */ - pp->lastrec = up->timestamp; - L_CLR(&offset); - if (!clocktime(pp->day, pp->hour, pp->minute, - pp->second, GMT, pp->lastrec.l_ui, - &pp->yearstart, &offset.l_ui)) - up->errflg = CEVNT_BADTIME; - else - refclock_process_offset(pp, offset, - pp->lastrec, 0.); + /* + * Sample the data subcarrier at epoch 215 ms, giving a guard + * time of +-15 ms from the earliest the pulse peak can be + * reached to the earliest it can begin to fall. For the data + * channel latch the I-channel amplitude for all except the + * probe seconds and adjust the 100-Hz reference oscillator + * phase using the Q-channel amplitude at this epoch. For the + * probe channel latch the envelope amplitude. + */ + } else if (up->rphase == 215 * MS) { + up->sigsig = up->irig; + if (up->sigsig < 0) + up->sigsig = 0; + up->datpha = up->qrig / up->avgint; + if (up->datpha >= 0) { + up->datapt++; + if (up->datapt >= 80) + up->datapt -= 80; + } else { + up->datapt--; + if (up->datapt < 0) + up->datapt += 80; } + up->sigamp = up->irig * up->irig + up->qrig * up->qrig; + + /* + * The slice level is set half way between the peak signal and + * noise levels. Sample the negative zero crossing after epoch + * 200 ms and record the epoch at that time. This defines the + * length of the data pulse, which will later be converted into + * scaled bit probabilities. + */ + } else if (up->rphase > 200 * MS) { + dtemp = (up->sigsig + sqrt(up->noiamp)) / 2; + if (up->irig < dtemp && dpulse == 0) + dpulse = up->rphase; } /* - * At the end of the receiver second, process the data bit and - * update the decoding matrix probabilities. + * At the end of the second crank the clock state machine and + * adjust the codec gain. Note the epoch is buffered from the + * center of the second in order to avoid jitter while the + * seconds synch is diddling the epoch. Then, determine the true + * offset and update the median filter in the driver interface. + * + * Sample the data subcarrier envelope at the end of the second + * to determine the SNR for the pulse. This gives a guard time + * of +-30 ms from the decay of the longest pulse to the rise of + * the next pulse. */ up->rphase++; - if (up->epoch == up->repoch) { + if (up->mphase % SECOND == up->repoch) { + up->datsnr = wwv_snr(up->sigsig, sqrt(up->noiamp)); wwv_rsec(peer, dpulse); wwv_gain(peer); up->rphase = dpulse = 0; @@ -1917,9 +1814,7 @@ wwv_epoch( * for leap years) or 31 December (day 365 or 366 for leap years) is * augmented by one second numbered 60. This is accomplished by * extending the minute interval by one second and teaching the state - * machine to ignore it. BTW, stations WWV/WWVH cowardly kill the - * transmitter carrier for a few seconds around the leap to avoid icky - * details of transmission format during the leap. + * machine to ignore it. */ static void wwv_rsec( @@ -1934,9 +1829,14 @@ wwv_rsec( struct wwvunit *up; struct chan *cp; struct sync *sp, *rp; + l_fp offset; /* offset in NTP seconds */ double bit; /* bit likelihood */ char tbuf[80]; /* monitor buffer */ int sw, arg, nsec; +#ifdef IRIG_SUCKS + int i; + l_fp ltemp; +#endif /* IRIG_SUCKS */ pp = peer->procptr; up = (struct wwvunit *)pp->unitptr; @@ -1971,65 +1871,105 @@ wwv_rsec( * Probe channel stuff * * The WWV/H format contains data pulses in second 59 (position - * identifier) and second 1 (not used), and the minute sync - * pulse in second 0. At the end of second 58, we QSYed to the - * probe channel, which rotates over all WWV/H frequencies. At - * the end of second 59, we latched the sync noise and tested - * for data bit error. At the end of second 0, we now latch the - * sync peak. + * identifier), second 1 (not used) and the minute sync pulse in + * second 0. At the end of second 58, QSY to the probe channel, + * which rotates over all WWV/H frequencies. At the end of + * second 1 QSY back to the data channel. + * + * At the end of second 0 save the minute sync pulse peak value + * previously latched at 800 ms. */ case SYNC2: /* 0 */ cp = &up->mitig[up->achan]; - sp = &cp->wwv; - sp->synmax = sp->synamp; - sp = &cp->wwvh; - sp->synmax = sp->synamp; + cp->wwv.synmax = sqrt(cp->wwv.synamp); + cp->wwvh.synmax = sqrt(cp->wwvh.synamp); break; /* - * At the end of second 1, latch and average the sync noise and - * test for data bit error. Set SYNCNG if the sync pulse - * amplitude and SNR are not above thresholds. Set DATANG if - * data error occurred on both second 59 and second 1. Finally, - * QSY back to the data channel. + * At the end of second 1 determine the minute sync pulse + * amplitude and SNR and set SYNCNG if these values are below + * thresholds. Determine the data pulse amplitude and SNR and + * set DATANG if these values are below thresholds. Set ERRRNG + * if data pulses in second 59 and second 1 are decoded in + * error. Shift a 1 into the reachability register if SYNCNG and + * DATANG are both lit; otherwise shift a 0. Ignore ERRRNG for + * the present. The number of 1 bits in the last six intervals + * represents the channel metric used by the mitigation routine. + * Finally, QSY back to the data channel. */ case SYNC3: /* 1 */ cp = &up->mitig[up->achan]; - if (up->sigamp < DTHR || up->datsnr < DSNR) - cp->errcnt++; + cp->sigamp = sqrt(up->sigamp); + cp->noiamp = sqrt(up->noiamp); + cp->datsnr = wwv_snr(cp->sigamp, cp->noiamp); + /* + * WWV station + */ sp = &cp->wwv; - sp->synmin = (sp->synmin + sp->synamp) / 2; + sp->synmin = sqrt((sp->synmin + sp->synamp) / 2.); sp->synsnr = wwv_snr(sp->synmax, sp->synmin); - sp->select &= ~(DATANG | SYNCNG); + sp->select &= ~(SYNCNG | DATANG | ERRRNG); if (sp->synmax < QTHR || sp->synsnr < QSNR) sp->select |= SYNCNG; - if (cp->errcnt > 1) + if (cp->sigamp < XTHR || cp->datsnr < XSNR) sp->select |= DATANG; + if (up->errcnt > 2) + sp->select |= ERRRNG; + sp->reach <<= 1; + if (sp->reach & (1 << AMAX)) + sp->count--; + if (!(sp->select & (SYNCNG | DATANG))) { + sp->reach |= 1; + sp->count++; + } + /* + * WWVH station + */ rp = &cp->wwvh; - rp->synmin = (rp->synmin + rp->synamp) / 2; + rp->synmin = sqrt((rp->synmin + rp->synamp) / 2.); rp->synsnr = wwv_snr(rp->synmax, rp->synmin); - rp->select &= ~(DATANG | SYNCNG); + rp->select &= ~(SYNCNG | DATANG | ERRRNG); if (rp->synmax < QTHR || rp->synsnr < QSNR) rp->select |= SYNCNG; - if (cp->errcnt > 1) + if (cp->sigamp < XTHR || cp->datsnr < XSNR) rp->select |= DATANG; + if (up->errcnt > 2) + rp->select |= ERRRNG; + rp->reach <<= 1; + if (rp->reach & (1 << AMAX)) + rp->count--; + if (!(rp->select & (SYNCNG | DATANG | ERRRNG))) { + rp->reach |= 1; + rp->count++; + } - cp->errcnt = 0; - sprintf(tbuf, - "wwv5 %d %3d %-3s %04x %d %.0f/%.1f/%ld %s %04x %d %.0f/%.1f/%ld", - up->port, up->gain, sp->ident, sp->select, - sp->count, sp->synmax, sp->synsnr, sp->jitter, - rp->ident, rp->select, rp->count, rp->synmax, - rp->synsnr, rp->jitter); - if (pp->sloppyclockflag & CLK_FLAG4) + /* + * Set up for next minute. + */ + if (pp->sloppyclockflag & CLK_FLAG4) { + sprintf(tbuf, + "wwv5 %2d %04x %3d %4d %d %.0f/%.1f %s %04x %.0f %.0f/%.1f %s %04x %.0f %.0f/%.1f", + up->port, up->status, up->gain, up->yepoch, + up->errcnt, cp->sigamp, cp->datsnr, + sp->refid, sp->reach & 0xffff, + wwv_metric(sp), sp->synmax, sp->synsnr, + rp->refid, rp->reach & 0xffff, + wwv_metric(rp), rp->synmax, rp->synsnr); record_clock_stats(&peer->srcadr, tbuf); #ifdef DEBUG - if (debug) - printf("%s\n", tbuf); + if (debug) + printf("%s\n", tbuf); #endif /* DEBUG */ + } +#ifdef ICOM + if (up->fd_icom > 0) + wwv_qsy(peer, up->dchan); +#endif /* ICOM */ up->status &= ~SFLAG; + up->errcnt = 0; + up->alarm = 0; wwv_newchan(peer); break; @@ -2040,7 +1980,9 @@ wwv_rsec( * considered valid. Bits not used in the digit are forced to * zero and not checked for errors. */ - case COEF1: /* 10-13 */ + case COEF: /* 4-7, 10-13, 15-17, 20-23, + 25-26, 30-33, 35-38, 40-41, + 51-54 */ if (up->status & DGATE) up->status |= BGATE; bcddld[arg] = bit; @@ -2050,13 +1992,6 @@ wwv_rsec( bcddld[arg] = 0; break; - case COEF: /* 4-7, 15-17, 20-23, 25-26, - 30-33, 35-38, 40-41, 51-54 */ - if (up->status & DGATE || !(up->status & DSYNC)) - up->status |= BGATE; - bcddld[arg] = bit; - break; - /* * Correlate coefficient vector with each valid digit vector and * save in decoding matrix. We step through the decoding matrix @@ -2083,122 +2018,207 @@ wwv_rsec( * Miscellaneous bits. If above the positive threshold, declare * 1; if below the negative threshold, declare 0; otherwise * raise the SYMERR alarm. At the end of second 58, QSY to the - * probe channel. + * probe channel. The design is intended to preserve the bits + * over periods of signal loss. */ case MSC20: /* 55 */ wwv_corr4(peer, &up->decvec[YR + 1], bcddld, bcd9); /* fall through */ - case MSCBIT: /* 2, 3, 50, 56-57 */ + case MSCBIT: /* 2-3, 50, 56-57 */ if (bitvec[up->rsec] > BTHR) up->misc |= arg; else if (bitvec[up->rsec] < -BTHR) up->misc &= ~arg; else - up->alarm |= 1 << SYMERR; + up->alarm |= SYMERR; break; + /* + * Save the data channel gain, then QSY to the probe channel. + */ case MSC21: /* 58 */ if (bitvec[up->rsec] > BTHR) up->misc |= arg; else if (bitvec[up->rsec] < -BTHR) up->misc &= ~arg; else - up->alarm |= 1 << SYMERR; - up->schan = (up->schan + 1) % NCHAN; - wwv_qsy(peer, up->schan); - up->status |= SFLAG; + up->alarm |= SYMERR; + up->mitig[up->dchan].gain = up->gain; +#ifdef ICOM + if (up->fd_icom > 0) { + up->schan = (up->schan + 1) % NCHAN; + wwv_qsy(peer, up->schan); + } +#endif /* ICOM */ + up->status |= SFLAG | SELV | SELH; + up->errbit = up->errcnt; + up->errcnt = 0; break; /* * The endgames * - * Second 59 contains the first data pulse of the probe - * sequence. Check it for validity and establish the noise floor - * for the minute sync SNR. + * During second 59 the receiver and codec AGC are settling + * down, so the data pulse is unusable. At the end of this + * second, latch the minute sync pulse noise floor. Then do the + * minute processing and update the system clock. If a leap + * second sail on to the next second (60); otherwise, set up for + * the next minute. */ case MIN1: /* 59 */ cp = &up->mitig[up->achan]; - if (up->sigamp < DTHR || up->datsnr < DSNR) - cp->errcnt++; - sp = &cp->wwv; - sp->synmin = sp->synamp; - sp = &cp->wwvh; - sp->synmin = sp->synamp; + cp->wwv.synmin = cp->wwv.synamp; + cp->wwvh.synmin = cp->wwvh.synamp; /* - * If SECWARN is set on the last minute of 30 June or 31 - * December, LEPSEC bit is set. At the end of the minute - * in which LEPSEC is set the transmitter and receiver - * insert an extra second (60) in the timescale and the - * minute sync skips a second. We only get to test this - * wrinkle at intervals of about 18 months, the actual - * mileage may vary. + * Dance the leap if necessary and the kernel has the + * right stuff. Then, wind up the clock and initialize + * for the following minute. If the leap dance, note the + * kernel is armed one second before the actual leap is + * scheduled. */ - if (up->tsec == 60) { - up->status &= ~LEPSEC; - break; - } - /* fall through */ - - /* - * If all nine clock digits are valid and the SYNERR alarm is - * not raised in the current or previous second, the clock is - * set or validated. If at least one digit is set, which by - * design must be the minute units digit, the clock state - * machine begins to count the minutes. - */ - case MIN2: /* 59/60 */ - up->minset = ((current_time - peer->update) + 30) / 60; - if (up->digcnt > 0) - up->status |= DSYNC; - if (up->digcnt >= 9 && (up->alarm & (3 << SYNERR)) == 0) - { + if (up->status & SSYNC && up->digcnt >= 9) up->status |= INSYNC; - up->watch = 0; + if (up->status & LEPDAY) { + pp->leap = LEAP_ADDSECOND; + } else { + pp->leap = LEAP_NOWARNING; + wwv_tsec(up); + nsec = up->digcnt = 0; } pp->lencode = timecode(up, pp->a_lastcode); - if (up->misc & SECWAR) - pp->leap = LEAP_ADDSECOND; - else - pp->leap = LEAP_NOWARNING; - refclock_receive(peer); record_clock_stats(&peer->srcadr, pp->a_lastcode); #ifdef DEBUG if (debug) printf("wwv: timecode %d %s\n", pp->lencode, pp->a_lastcode); #endif /* DEBUG */ + if (up->status & INSYNC && up->watch < HOLD) + refclock_receive(peer); + break; - /* - * The ultimate watchdog is the interval since the - * reference clock interface code last received an - * update from this driver. If the interval is greater - * than a couple of days, manual intervention is - * probably required, so the program resets and tries to - * resynchronized from scratch. - */ - if (up->minset > PANIC) - up->status = 0; - up->alarm = (up->alarm & ~0x8888) << 1; - up->nepoch = (up->mphase + SYNSIZ) % MINUTE; - up->errcnt = up->digcnt = nsec = 0; + /* + * If LEPDAY is set on the last minute of 30 June or 31 + * December, the LEPSEC bit is set. At the end of the minute in + * which LEPSEC is set the transmitter and receiver insert an + * extra second (60) in the timescale and the minute sync skips + * a second. We only get to test this wrinkle at intervals of + * about 18 months; the actual mileage may vary. + */ + case MIN2: /* 60 */ + wwv_tsec(up); + nsec = up->digcnt = 0; break; } - if (!(up->status & DSYNC)) { + + /* + * If digit sync has not been acquired before timeout or if no + * station has been heard, game over and restart from scratch. + */ + if (!(up->status & DSYNC) && (!(up->status & (SELV | SELH)) || + up->watch > DIGIT)) { + wwv_newgame(peer); + return; + } + + /* + * If no timestamps have been struck before timeout, game over + * and restart from scratch. + */ + if (up->watch > PANIC) { + wwv_newgame(peer); + return; + } + pp->disp += AUDIO_PHI; + up->rsec = nsec; + +#ifdef IRIG_SUCKS + /* + * You really don't wanna know what comes down here. Leave it to + * say Solaris 2.8 broke the nice clean audio stream, apparently + * affected by a 5-ms sawtooth jitter. Sundown on Solaris. This + * leaves a little twilight. + * + * The scheme involves differentiation, forward learning and + * integration. The sawtooth has a period of 11 seconds. The + * timestamp differences are integrated and subtracted from the + * signal. + */ + ltemp = pp->lastrec; + L_SUB(<emp, &pp->lastref); + if (ltemp.l_f < 0) + ltemp.l_i = -1; + else + ltemp.l_i = 0; + pp->lastref = pp->lastrec; + if (!L_ISNEG(<emp)) + L_CLR(&up->wigwag); + else + L_ADD(&up->wigwag, <emp); + L_SUB(&pp->lastrec, &up->wigwag); + up->wiggle[up->wp] = ltemp; + + /* + * Bottom fisher. To understand this, you have to know about + * velocity microphones and AM transmitters. No further + * explanation is offered, as this is truly a black art. + */ + up->wigbot[up->wp] = pp->lastrec; + for (i = 0; i < WIGGLE; i++) { + if (i != up->wp) + up->wigbot[i].l_ui++; + L_SUB(&pp->lastrec, &up->wigbot[i]); + if (L_ISNEG(&pp->lastrec)) + L_ADD(&pp->lastrec, &up->wigbot[i]); + else + pp->lastrec = up->wigbot[i]; + } + up->wp++; + up->wp %= WIGGLE; +#endif /* IRIG_SUCKS */ + + /* + * If victory has been declared and seconds sync is lit, strike + * a timestamp. It should not be a surprise, especially if the + * radio is not tunable, that sometimes no stations are above + * the noise and the reference ID set to NONE. + */ + if (up->status & INSYNC && up->status & SSYNC) { + pp->second = up->rsec; + pp->minute = up->decvec[MN].digit + up->decvec[MN + + 1].digit * 10; + pp->hour = up->decvec[HR].digit + up->decvec[HR + + 1].digit * 10; + pp->day = up->decvec[DA].digit + up->decvec[DA + + 1].digit * 10 + up->decvec[DA + 2].digit * 100; + pp->year = up->decvec[YR].digit + up->decvec[YR + + 1].digit * 10; + pp->year += 2000; + L_CLR(&offset); + if (!clocktime(pp->day, pp->hour, pp->minute, + pp->second, GMT, up->timestamp.l_ui, + &pp->yearstart, &offset.l_ui)) { + up->errflg = CEVNT_BADTIME; + } else { + up->watch = 0; + pp->disp = 0; + refclock_process_offset(pp, offset, + up->timestamp, PDELAY); + } + } + if ((pp->sloppyclockflag & CLK_FLAG4) && !(up->status & + DSYNC)) { sprintf(tbuf, - "wwv3 %2d %04x %5.0f %5.0f %5.0f %5.1f %5.0f %5.0f", - up->rsec, up->status, up->epomax, up->sigamp, - up->datpha, up->datsnr, bit, bitvec[up->rsec]); - if (pp->sloppyclockflag & CLK_FLAG4) - record_clock_stats(&peer->srcadr, tbuf); + "wwv3 %2d %04x %5.0f %5.1f %5.0f %5.1f %5.0f", + up->rsec, up->status, up->epomax, up->eposnr, + up->sigsig, up->datsnr, bit); + record_clock_stats(&peer->srcadr, tbuf); #ifdef DEBUG if (debug) printf("%s\n", tbuf); #endif /* DEBUG */ - } - up->rsec = up->tsec = nsec; - return; + } } @@ -2211,7 +2231,12 @@ wwv_rsec( * bit is bad, a bit error is declared and the probabilities are forced * to zero. Otherwise, the data gate is enabled and the probabilities * are calculated. Note that the data matched filter contributes half - * the pulse width, or 85 ms.. + * the pulse width, or 85 ms. + * + * It's important to observe that there are three conditions to + * determine: average to +1 (hit), average to -1 (miss) or average to + * zero (erasure). The erasure condition results from insufficient + * signal (noise) and has no bias toward either a hit or miss. */ static double wwv_data( @@ -2226,14 +2251,16 @@ wwv_data( dpulse = pulse - DATSIZ / 2; /* - * If the data amplitude or SNR are below threshold or if the - * pulse length is less than 170 ms, declare an erasure. + * If no station is being tracked, if either the data amplitude + * or SNR are below threshold or if the pulse length is less + * than 170 ms, declare an erasure. */ - if (up->sigamp < DTHR || up->datsnr < DSNR || dpulse < DATSIZ) { + if (!(up->status & (SELV | SELH)) || up->sigsig < DTHR || + up->datsnr < DSNR || dpulse < DATSIZ) { up->status |= DGATE; up->errcnt++; if (up->errcnt > MAXERR) - up->alarm |= 1 << MODERR; + up->alarm |= MODERR; return (0); } @@ -2327,44 +2354,59 @@ wwv_corr4( /* * The maximum likelihood digit is compared with the current * clock digit. The difference represents the decoding phase - * error. If the digit probability and likelihood are good and - * the difference stays the same for a number of comparisons, - * the clock digit is reset to the maximum likelihood digit. + * error. If the clock is not yet synchronized, the phase error + * is corrected even of the digit probability and likelihood are + * below thresholds. This avoids lengthy averaging times should + * a carry mistake occur. However, the digit is not declared + * synchronized until these values are above thresholds and the + * last five decoded values are identical. If the clock is + * synchronized, the phase error is not corrected unless the + * last five digits are all above thresholds and identical. This + * avoids mistakes when the signal is coming out of the noise + * and the SNR is very marginal. */ diff = mldigit - vp->digit; if (diff < 0) diff += vp->radix; if (diff != vp->phase) { + vp->count = 0; vp->phase = diff; - vp->count = 0; } - if (vp->digprb < BTHR || vp->digsnr < BSNR) { + if (vp->digsnr < BSNR) { vp->count = 0; - up->alarm |= 1 << SYMERR; - } else if (vp->count < BCMP) { + up->alarm |= SYMERR; + } else if (vp->digprb < BTHR) { + vp->count = 0; + up->alarm |= SYMERR; if (!(up->status & INSYNC)) { vp->phase = 0; vp->digit = mldigit; } + } else if (vp->count < BCMP) { vp->count++; + up->status |= DSYNC; + if (!(up->status & INSYNC)) { + vp->phase = 0; + vp->digit = mldigit; + } } else { vp->phase = 0; vp->digit = mldigit; up->digcnt++; } if (vp->digit != mldigit) - up->alarm |= 1 << DECERR; - if (!(up->status & INSYNC)) { + up->alarm |= DECERR; + if ((pp->sloppyclockflag & CLK_FLAG4) && !(up->status & + INSYNC)) { sprintf(tbuf, "wwv4 %2d %04x %5.0f %2d %d %d %d %d %5.0f %5.1f", - up->rsec, up->status, up->epomax, vp->radix, + up->rsec, up->status, up->epomax, vp->radix, vp->digit, vp->mldigit, vp->phase, vp->count, vp->digprb, vp->digsnr); - if (pp->sloppyclockflag & CLK_FLAG4) - record_clock_stats(&peer->srcadr, tbuf); + record_clock_stats(&peer->srcadr, tbuf); #ifdef DEBUG - if (debug) - printf("%s\n", tbuf); + if (debug) + printf("%s\n", tbuf); #endif /* DEBUG */ } up->status &= ~BGATE; @@ -2372,13 +2414,11 @@ wwv_corr4( /* - * wwv_tsec - transmitter second processing + * wwv_tsec - transmitter minute processing * - * This routine is called at the end of the transmitter second. It + * This routine is called at the end of the transmitter minute. It * implements a state machine that advances the logical clock subject to - * the funny rules that govern the conventional clock and calendar. Note - * that carries from the least significant (minutes) digit are inhibited - * until that digit is synchronized. + * the funny rules that govern the conventional clock and calendar. */ static void wwv_tsec( @@ -2388,18 +2428,10 @@ wwv_tsec( int minute, day, isleap; int temp; - up->tsec++; - if (up->tsec < 60 || up->status & LEPSEC) - return; - up->tsec = 0; - /* - * Advance minute unit of the day. If the minute unit is not - * synchronized, go no further. + * Advance minute unit of the day. */ temp = carry(&up->decvec[MN]); /* minute units */ - if (!(up->status & DSYNC)) - return; /* * Propagate carries through the day. @@ -2412,8 +2444,10 @@ wwv_tsec( temp = carry(&up->decvec[HR + 1]); /* - * Decode the current minute and day. Set the leap second enable - * bit on the last minute of 30 June and 31 December. + * Decode the current minute and day. Set leap day if the + * timecode leap bit is set on 30 June or 31 December. Set leap + * minute if the last minute on leap day. This code fails in + * 2400 AD. */ minute = up->decvec[MN].digit + up->decvec[MN + 1].digit * 10 + up->decvec[HR].digit * 60 + up->decvec[HR + @@ -2421,9 +2455,16 @@ wwv_tsec( day = up->decvec[DA].digit + up->decvec[DA + 1].digit * 10 + up->decvec[DA + 2].digit * 100; isleap = (up->decvec[YR].digit & 0x3) == 0; - if (minute == 1439 && (day == (isleap ? 182 : 183) || day == - (isleap ? 365 : 366)) && up->misc & SECWAR) + if (up->misc & SECWAR && (day == (isleap ? 182 : 183) || day == + (isleap ? 365 : 366)) && up->status & INSYNC && up->status & + SSYNC) + up->status |= LEPDAY; + else + up->status &= ~LEPDAY; + if (up->status & LEPDAY && minute == 1439) up->status |= LEPSEC; + else + up->status &= ~LEPSEC; /* * Roll the day if this the first minute and propagate carries @@ -2461,7 +2502,7 @@ wwv_tsec( * carry - process digit * * This routine rotates a likelihood vector one position and increments - * the clock digit modulo the radix. It returns the new clock digit - + * the clock digit modulo the radix. It returns the new clock digit or * zero if a carry occurred. Once synchronized, the clock digit will * match the maximum likelihood digit corresponding to that position. */ @@ -2519,19 +2560,36 @@ wwv_snr( return (rval); } + /* * wwv_newchan - change to new data channel * - * Assuming the radio can be tuned by this program, it actually appears - * as a 10-channel receiver, one channel for each of WWV and WWVH on - * each of five frequencies. While the radio is tuned to the working - * data channel (frequency and station) for most of the minute, during - * seconds 59, 0 and 1 the radio is tuned to a probe channel, in order - * to pick up minute sync and data pulses. The search for WWV and WWVH - * stations operates simultaneously, with WWV on 1000 Hz and WWVH on - * 1200 Hz. The probe channel rotates for each minute over the five - * frequencies. At the end of each rotation, this routine mitigates over - * all channels and chooses the best frequency and station. + * The radio actually appears to have ten channels, one channel for each + * of five frequencies and each of two stations (WWV and WWVH), although + * if not tunable only the 15 MHz channels appear live. While the radio + * is tuned to the working data channel frequency and station for most + * of the minute, during seconds 59, 0 and 1 the radio is tuned to a + * probe frequency in order to search for minute sync pulse and data + * subcarrier from other transmitters. + * + * The search for WWV and WWVH operates simultaneously, with WWV minute + * sync pulse at 1000 Hz and WWVH at 1200 Hz. The probe frequency + * rotates each minute over 2.5, 5, 10, 15 and 20 MHz in order and yes, + * we all know WWVH is dark on 20 MHz, but few remember when WWV was lit + * on 25 MHz. + * + * This routine selects the best channel using a metric computed from + * the reachability register and minute pulse amplitude. Normally, the + * award goes to the the channel with the highest metric; but, in case + * of ties, the award goes to the channel with the highest minute sync + * pulse amplitude and then to the highest frequency. + * + * The routine performs an important squelch function to keep dirty data + * from polluting the integrators. During acquisition and until the + * clock is synchronized, the signal metric must be at least MTR (13); + * after that the metrict must be at least TTHR (50). If either of these + * is not true, the station select bits are cleared so the second sync + * is disabled and the data bit integrators averaged to a miss. */ static void wwv_newchan( @@ -2540,60 +2598,119 @@ wwv_newchan( { struct refclockproc *pp; struct wwvunit *up; - struct chan *cp; struct sync *sp, *rp; - int rank; + double rank, dtemp; int i, j; pp = peer->procptr; up = (struct wwvunit *)pp->unitptr; /* - * Reset the matched filter selector and station pointer to - * avoid fooling around should we lose this game. - */ - up->sptr = 0; - up->status &= ~(SELV | SELH); - - /* - * Search all five station pairs looking for the station with - * the maximum compare counter. Ties go to the highest frequency - * and then to WWV. + * Search all five station pairs looking for the channel with + * maximum metric. If no station is found above thresholds, the + * reference ID is set to NONE and we wait for hotter ions. */ j = 0; - sp = (struct sync *)0; + sp = NULL; rank = 0; for (i = 0; i < NCHAN; i++) { - cp = &up->mitig[i]; - rp = &cp->wwvh; - if (rp->count >= rank) { + rp = &up->mitig[i].wwvh; + dtemp = wwv_metric(rp); + if (dtemp >= rank) { + rank = dtemp; sp = rp; - rank = rp->count; j = i; } - rp = &cp->wwv; - if (rp->count >= rank) { + rp = &up->mitig[i].wwv; + dtemp = wwv_metric(rp); + if (dtemp >= rank) { + rank = dtemp; sp = rp; - rank = rp->count; j = i; } } - - /* - * If we find a station, continue to track it. If not, X marks - * the spot and we wait for better ions. - */ - if (rank > 0) { - up->dchan = j; - up->sptr = sp; + up->dchan = j; + up->sptr = sp; + up->status &= ~(SELV | SELH); + memcpy(&pp->refid, "NONE", 4); + if ((!(up->status & INSYNC) && rank >= MTHR) || ((up->status & + INSYNC) && rank >= TTHR)) { up->status |= sp->select & (SELV | SELH); - memcpy((char *)&pp->refid, sp->refid, 4); - memcpy((char *)&peer->refid, sp->refid, 4); - wwv_qsy(peer, up->dchan); + memcpy(&pp->refid, sp->refid, 4); } + if (peer->stratum <= 1) + memcpy(&peer->refid, &pp->refid, 4); } +/* + * www_newgame - reset and start over + */ +static void +wwv_newgame( + struct peer *peer /* peer structure pointer */ + ) +{ + struct refclockproc *pp; + struct wwvunit *up; + struct chan *cp; + int i; + + pp = peer->procptr; + up = (struct wwvunit *)pp->unitptr; + + /* + * Initialize strategic values. Note we set the leap bits + * NOTINSYNC and the refid "NONE". + */ + peer->leap = LEAP_NOTINSYNC; + up->watch = up->status = up->alarm = 0; + up->avgint = MINAVG; + up->freq = 0; + up->sptr = NULL; + up->gain = MAXGAIN / 2; + + /* + * Initialize the station processes for audio gain, select bit, + * station/frequency identifier and reference identifier. + */ + memset(up->mitig, 0, sizeof(up->mitig)); + for (i = 0; i < NCHAN; i++) { + cp = &up->mitig[i]; + cp->gain = up->gain; + cp->wwv.select = SELV; + sprintf(cp->wwv.refid, "WV%.0f", floor(qsy[i])); + cp->wwvh.select = SELH; + sprintf(cp->wwvh.refid, "WH%.0f", floor(qsy[i])); + } + wwv_newchan(peer); +} + +/* + * wwv_metric - compute station metric + * + * The most significant bits represent the number of ones in the + * reachability register. The least significant bits represent the + * minute sync pulse amplitude. The combined value is scaled 0-100. + */ +double +wwv_metric( + struct sync *sp /* station pointer */ + ) +{ + double dtemp; + + dtemp = sp->count * MAXSIG; + if (sp->synmax < MAXSIG) + dtemp += sp->synmax; + else + dtemp += MAXSIG - 1; + dtemp /= (AMAX + 1) * MAXSIG; + return (dtemp * 100.); +} + + +#ifdef ICOM /* * wwv_qsy - Tune ICOM receiver * @@ -2607,22 +2724,22 @@ wwv_qsy( int chan /* channel */ ) { + int rval = 0; struct refclockproc *pp; struct wwvunit *up; - int rval = 0; pp = peer->procptr; up = (struct wwvunit *)pp->unitptr; - up->mitig[up->achan].gain = up->gain; -#ifdef ICOM - if (up->fd_icom > 0) + if (up->fd_icom > 0) { + up->mitig[up->achan].gain = up->gain; rval = icom_freq(up->fd_icom, peer->ttl & 0x7f, qsy[chan]); -#endif /* ICOM */ - up->achan = chan; - up->gain = up->mitig[up->achan].gain; + up->achan = chan; + up->gain = up->mitig[up->achan].gain; + } return (rval); } +#endif /* ICOM */ /* @@ -2630,23 +2747,22 @@ wwv_qsy( * * Prettytime format - similar to Spectracom * - * sq yy ddd hh:mm:ss.fff ld dut lset agc stn comp errs freq avgt + * sq yy ddd hh:mm:ss ld dut lset agc iden sig errs freq avgt * * s sync indicator ('?' or ' ') - * q quality character (hex 0-F) + * q error bits (hex 0-F) * yyyy year of century * ddd day of year * hh hour of day * mm minute of hour - * ss minute of hour - * fff millisecond of second - * l leap second warning ' ' or 'L' - * d DST state 'S', 'D', 'I', or 'O' - * dut DUT sign and magnitude in deciseconds + * ss second of minute) + * l leap second warning (' ' or 'L') + * d DST state ('S', 'D', 'I', or 'O') + * dut DUT sign and magnitude (0.1 s) * lset minutes since last clock update * agc audio gain (0-255) - * iden station identifier (station and frequency) - * comp minute sync compare counter + * iden reference identifier (station and frequency) + * sig signal quality (0-100) * errs bit errors in last minute * freq frequency offset (PPM) * avgt averaging time (s) @@ -2658,8 +2774,8 @@ timecode( ) { struct sync *sp; - int year, day, hour, minute, second, frac, dut; - char synchar, qual, leapchar, dst; + int year, day, hour, minute, second, dut; + char synchar, leapchar, dst; char cptr[50]; @@ -2667,49 +2783,30 @@ timecode( * Common fixed-format fields */ synchar = (up->status & INSYNC) ? ' ' : '?'; - qual = 0; - if (up->alarm & (3 << DECERR)) - qual |= 0x1; - if (up->alarm & (3 << SYMERR)) - qual |= 0x2; - if (up->alarm & (3 << MODERR)) - qual |= 0x4; - if (up->alarm & (3 << SYNERR)) - qual |= 0x8; - year = up->decvec[7].digit + up->decvec[7].digit * 10; - if (year < UTCYEAR) - year += 2000; - else - year += 1900; - day = up->decvec[4].digit + up->decvec[5].digit * 10 + - up->decvec[6].digit * 100; - hour = up->decvec[2].digit + up->decvec[3].digit * 10; - minute = up->decvec[0].digit + up->decvec[1].digit * 10; - second = up->tsec; - frac = (up->tphase * 1000) / SECOND; + year = up->decvec[YR].digit + up->decvec[YR + 1].digit * 10 + + 2000; + day = up->decvec[DA].digit + up->decvec[DA + 1].digit * 10 + + up->decvec[DA + 2].digit * 100; + hour = up->decvec[HR].digit + up->decvec[HR + 1].digit * 10; + minute = up->decvec[MN].digit + up->decvec[MN + 1].digit * 10; + second = 0; leapchar = (up->misc & SECWAR) ? 'L' : ' '; dst = dstcod[(up->misc >> 4) & 0x3]; dut = up->misc & 0x7; if (!(up->misc & DUTS)) dut = -dut; - sprintf(ptr, "%c%1X", synchar, qual); - sprintf(cptr, " %4d %03d %02d:%02d:%02d.%.03d %c%c %+d", - year, day, hour, minute, second, frac, leapchar, dst, dut); + sprintf(ptr, "%c%1X", synchar, up->alarm); + sprintf(cptr, " %4d %03d %02d:%02d:%02d %c%c %+d", + year, day, hour, minute, second, leapchar, dst, dut); strcat(ptr, cptr); /* * Specific variable-format fields */ sp = up->sptr; - if (sp != 0) - sprintf(cptr, " %d %d %s %d %d %.1f %d", up->minset, - up->mitig[up->dchan].gain, sp->ident, sp->count, - up->errcnt, up->freq / SECOND * 1e6, MINAVG << - up->avgint); - else - sprintf(cptr, " %d %d X 0 %d %.1f %d", up->minset, - up->mitig[up->dchan].gain, up->errcnt, up->freq / - SECOND * 1e6, MINAVG << up->avgint); + sprintf(cptr, " %d %d %s %.0f %d %.1f %d", up->watch, + up->mitig[up->dchan].gain, sp->refid, wwv_metric(sp), + up->errbit, up->freq / SECOND * 1e6, up->avgint); strcat(ptr, cptr); return (strlen(ptr)); } @@ -2718,9 +2815,10 @@ timecode( /* * wwv_gain - adjust codec gain * - * This routine is called once each second. If the signal envelope - * amplitude is too low, the codec gain is bumped up by four units; if - * too high, it is bumped down. The decoder is relatively insensitive to + * This routine is called at the end of each second. It counts the + * number of signal clips above the MAXSIG threshold during the previous + * second. If there are no clips, the gain is bumped up; if too many + * clips, it is bumped down. The decoder is relatively insensitive to * amplitude, so this crudity works just fine. The input port is set and * the error flag is cleared, mostly to be ornery. */ @@ -2742,15 +2840,19 @@ wwv_gain( */ if (up->clipcnt == 0) { up->gain += 4; - if (up->gain > 255) - up->gain = 255; - } else if (up->clipcnt > SECOND / 100) { + if (up->gain > MAXGAIN) + up->gain = MAXGAIN; + } else if (up->clipcnt > MAXCLP) { up->gain -= 4; if (up->gain < 0) up->gain = 0; } - audio_gain(up->gain, up->port); + audio_gain(up->gain, up->mongain, up->port); up->clipcnt = 0; +#if DEBUG + if (debug > 1) + audio_show(); +#endif } diff --git a/dist/ntp/ntpd/refclock_wwvb.c b/dist/ntp/ntpd/refclock_wwvb.c index f608625c4280..296d697140e8 100644 --- a/dist/ntp/ntpd/refclock_wwvb.c +++ b/dist/ntp/ntpd/refclock_wwvb.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_wwvb.c,v 1.1.1.2 2003/12/04 16:05:30 drochner Exp $ */ +/* $NetBSD: refclock_wwvb.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * refclock_wwvb - clock driver for Spectracom WWVB receivers diff --git a/dist/ntp/ntpd/refclock_zyfer.c b/dist/ntp/ntpd/refclock_zyfer.c index 7688256cdd7c..fc32d449bd18 100644 --- a/dist/ntp/ntpd/refclock_zyfer.c +++ b/dist/ntp/ntpd/refclock_zyfer.c @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_zyfer.c,v 1.1.1.1 2003/12/04 16:05:30 drochner Exp $ */ +/* $NetBSD: refclock_zyfer.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * refclock_zyfer - clock driver for the Zyfer GPSTarplus Clock diff --git a/dist/ntp/ntpdate/ntpdate.c b/dist/ntp/ntpdate/ntpdate.c index 7779d6ad0338..e37206355162 100644 --- a/dist/ntp/ntpdate/ntpdate.c +++ b/dist/ntp/ntpdate/ntpdate.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntpdate.c,v 1.2 2001/02/02 03:35:24 hubertf Exp $ */ +/* $NetBSD: ntpdate.c,v 1.3 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpdate - set the time of day by polling one or more NTP servers @@ -8,9 +8,21 @@ # include #endif -#ifdef HAVE_SYS_TYPES_H -# include +#ifdef HAVE_NETINFO +#include #endif + +#include "ntp_machine.h" +#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 #endif @@ -19,18 +31,29 @@ #include #include #ifdef HAVE_POLL_H -#include +# include #endif #ifndef SYS_WINNT # include -# include -# include +# ifdef HAVE_SYS_SIGNAL_H +# include +# else +# include +# endif +# ifdef HAVE_SYS_IOCTL_H +# include +# endif #endif /* SYS_WINNT */ -#include #ifdef HAVE_SYS_RESOURCE_H # include #endif /* HAVE_SYS_RESOURCE_H */ +#include + +#ifdef __QNXNTO__ +# include "adjtime.h" +#endif + #ifdef SYS_VXWORKS # include "ioLib.h" # include "sockLib.h" @@ -42,28 +65,17 @@ struct timeval timeout = {0,0}; struct timeval timeout = {60,0}; #endif - -#if defined(SYS_HPUX) -# include -#endif - #ifdef HAVE_NETINFO #include #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 -# define TARGET_RESOLUTION 1 /* Try for 1-millisecond accuracy +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#define TARGET_RESOLUTION 1 /* Try for 1-millisecond accuracy on Windows NT timers. */ #pragma comment(lib, "winmm") #endif /* SYS_WINNT */ @@ -101,12 +113,18 @@ volatile int debug = 0; /* * File descriptor masks etc. for call to select */ -int fd; + +int ai_fam_templ; +int nbsock; +SOCKET fd[MAX_AF]; /* support up to 2 sockets */ +int fd_family[MAX_AF]; /* to remember the socket family */ #ifdef HAVE_POLL_H -struct pollfd fdmask; +struct pollfd fdmask[MAX_AF]; #else fd_set fdmask; +int maxfd; #endif +int polltest = 0; /* * Initializing flag. All async routines watch this and only do their @@ -187,6 +205,7 @@ int always_step = 0; int never_step = 0; int ntpdatemain P((int, char **)); + static void transmit P((struct server *)); static void receive P((struct recvbuf *)); static void server_data P((struct server *, s_fp, l_fp *, u_fp)); @@ -194,20 +213,19 @@ static void clock_filter P((struct server *)); static struct server *clock_select P((void)); static int clock_adjust P((void)); static void addserver P((char *)); -static struct server *findserver P((struct sockaddr_in *)); +static struct server *findserver P((struct sockaddr_storage *)); void timer P((void)); static void init_alarm P((void)); #ifndef SYS_WINNT static RETSIGTYPE alarming P((int)); #endif /* SYS_WINNT */ static void init_io P((void)); -static void sendpkt P((struct sockaddr_in *, struct pkt *, int)); +static void sendpkt P((struct sockaddr_storage *, struct pkt *, int)); void input_handler P((void)); static int l_adj_systime P((l_fp *)); static int l_step_systime P((l_fp *)); -static int getnetnum P((const char *, u_int32 *)); static void printserver P((struct server *, FILE *)); #ifdef SYS_WINNT @@ -308,6 +326,8 @@ ntpdatemain ( l_fp tmp; int errflg; int c; + int nfound; + #ifdef HAVE_NETINFO ni_namelist *netinfoservers; #endif @@ -316,7 +336,7 @@ ntpdatemain ( wVersionRequested = MAKEWORD(1,1); if (WSAStartup(wVersionRequested, &wsaData)) { - msyslog(LOG_ERR, "No useable winsock.dll: %m"); + netsyslog(LOG_ERR, "No useable winsock.dll: %m"); exit(1); } @@ -339,9 +359,15 @@ ntpdatemain ( /* * Decode argument list */ - while ((c = ntp_getopt(argc, argv, "a:bBde:k:o:p:qr:st:uv")) != EOF) + while ((c = ntp_getopt(argc, argv, "46a:bBde:k:o:p:qr:st:uv")) != EOF) switch (c) { + case '4': + ai_fam_templ = AF_INET; + break; + case '6': + ai_fam_templ = AF_INET6; + break; case 'a': c = atoi(ntp_optarg); sys_authenticate = 1; @@ -431,8 +457,8 @@ ntpdatemain ( if (errflg) { (void) fprintf(stderr, - "usage: %s [-bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-r rate] [-t timeo] server ...\n", - progname); + "usage: %s [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-r rate] [-t timeo] server ...\n", + progname); exit(2); } @@ -507,9 +533,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]; @@ -540,17 +567,20 @@ ntpdatemain ( } #endif /* SYS_WINNT */ - initializing = 0; + + initializing = 0; was_alarmed = 0; rbuflist = (struct recvbuf *)0; + while (complete_servers < sys_numservers) { #ifdef HAVE_POLL_H - struct pollfd rdfdes; + struct pollfd* rdfdes; + rdfdes = fdmask; #else fd_set rdfdes; + rdfdes = fdmask; #endif - int nfound; if (alarm_flag) { /* alarmed? */ was_alarmed = 1; @@ -562,11 +592,11 @@ ntpdatemain ( /* * Nothing to do. Wait for something. */ - rdfdes = fdmask; #ifdef HAVE_POLL_H - nfound = poll(&rdfdes, 1, timeout.tv_sec * 1000); + nfound = poll(rdfdes, (unsigned int)nbsock, timeout.tv_sec * 1000); + #else - nfound = select(fd+1, &rdfdes, (fd_set *)0, + nfound = select(maxfd, &rdfdes, (fd_set *)0, (fd_set *)0, &timeout); #endif if (nfound > 0) @@ -581,7 +611,7 @@ ntpdatemain ( #ifndef SYS_WINNT if (errno != EINTR) #endif - msyslog(LOG_ERR, + netsyslog(LOG_ERR, #ifdef HAVE_POLL_H "poll() error: %m" #else @@ -590,7 +620,7 @@ ntpdatemain ( ); } else { #ifndef SYS_VXWORKS - msyslog(LOG_DEBUG, + netsyslog(LOG_DEBUG, #ifdef HAVE_POLL_H "poll(): nfound = %d, error: %m", #else @@ -641,6 +671,7 @@ ntpdatemain ( close (fd); timer_delete(ntpdate_timerid); #endif + return clock_adjust(); } @@ -658,7 +689,7 @@ transmit( struct pkt xpkt; if (debug) - printf("transmit(%s)\n", ntoa(&server->srcadr)); + printf("transmit(%s)\n", stoa(&(server->srcadr))); if (server->filter_nextpt < server->xmtcnt) { l_fp ts; @@ -713,14 +744,14 @@ transmit( if (debug > 1) printf("transmit auth to %s\n", - ntoa(&(server->srcadr))); + stoa(&(server->srcadr))); } else { get_systime(&(server->xmt)); HTONL_FP(&server->xmt, &xpkt.xmt); sendpkt(&(server->srcadr), &xpkt, LEN_PKT_NOMAC); if (debug > 1) - printf("transmit to %s\n", ntoa(&(server->srcadr))); + printf("transmit to %s\n", stoa(&(server->srcadr))); } /* @@ -742,7 +773,7 @@ receive( register struct pkt *rpkt; register struct server *server; register s_fp di; - l_fp t10, t23; + l_fp t10, t23, tmp; l_fp org; l_fp rec; l_fp ci; @@ -750,7 +781,7 @@ receive( int is_authentic; if (debug) - printf("receive(%s)\n", ntoa(&rbufp->recv_srcadr)); + printf("receive(%s)\n", stoa(&rbufp->recv_srcadr)); /* * Check to see if the packet basically looks like something * intended for us. @@ -774,7 +805,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); @@ -864,9 +895,15 @@ receive( L_SUB(&t23, &org); /* pkt->org == t3 */ /* now have (t2 - t3) and (t0 - t1). Calculate (ci) and (di) */ + /* + * Calculate (ci) = ((t1 - t0) / 2) + ((t2 - t3) / 2) + * For large offsets this may prevent an overflow on '+' + */ ci = t10; - L_ADD(&ci, &t23); L_RSHIFT(&ci); + tmp = t23; + L_RSHIFT(&tmp); + L_ADD(&ci, &tmp); /* * Calculate di in t23 in full precision, then truncate @@ -907,7 +944,7 @@ server_data( u_fp e ) { - register int i; + u_short i; i = server->filter_nextpt; if (i < NTP_SHIFT) { @@ -915,7 +952,7 @@ server_data( server->filter_offset[i] = *c; server->filter_soffset[i] = LFPTOFP(c); server->filter_error[i] = e; - server->filter_nextpt = i + 1; + server->filter_nextpt = (u_short)(i + 1); } } @@ -1022,23 +1059,44 @@ clock_select(void) */ nlist = 0; /* none yet */ for (server = sys_servers; server != NULL; server = server->next_server) { - if (server->delay == 0) - continue; /* no data */ - if (server->stratum > NTP_INFIN) - continue; /* stratum no good */ - if (server->delay > NTP_MAXWGT) { - continue; /* too far away */ + if (server->delay == 0) { + if (debug) + printf("%s: Server dropped: no data\n", ntoa(&server->srcadr)); + continue; /* no data */ + } + if (server->stratum > NTP_INFIN) { + if (debug) + printf("%s: Server dropped: strata too high\n", ntoa(&server->srcadr)); + continue; /* stratum no good */ + } + if (server->delay > NTP_MAXWGT) { + if (debug) + printf("%s: Server dropped: server too far away\n", + ntoa(&server->srcadr)); + continue; /* too far away */ + } + if (server->leap == LEAP_NOTINSYNC) { + if (debug) + printf("%s: Server dropped: Leap not in sync\n", ntoa(&server->srcadr)); + continue; /* he's in trouble */ } - if (server->leap == LEAP_NOTINSYNC) - continue; /* he's in trouble */ if (!L_ISHIS(&server->org, &server->reftime)) { - continue; /* very broken host */ + if (debug) + printf("%s: Server dropped: server is very broken\n", + ntoa(&server->srcadr)); + continue; /* very broken host */ } if ((server->org.l_ui - server->reftime.l_ui) - >= NTP_MAXAGE) { + >= NTP_MAXAGE) { + if (debug) + printf("%s: Server dropped: Server has gone too long without sync\n", + ntoa(&server->srcadr)); continue; /* too long without sync */ } if (server->trust != 0) { + if (debug) + printf("%s: Server dropped: Server is untrusted\n", + ntoa(&server->srcadr)); continue; } @@ -1223,20 +1281,20 @@ clock_adjust(void) absoffset = server->soffset; if (absoffset < 0) absoffset = -absoffset; - dostep = (absoffset >= NTPDATE_THRESHOLD); + dostep = (absoffset >= NTPDATE_THRESHOLD || absoffset < 0); } if (dostep) { if (simple_query || l_step_systime(&server->offset)) { msyslog(LOG_NOTICE, "step time server %s offset %s sec", - ntoa(&server->srcadr), + stoa(&server->srcadr), lfptoa(&server->offset, 6)); } } else { #if !defined SYS_WINNT && !defined SYS_CYGWIN32 if (simple_query || l_adj_systime(&server->offset)) { msyslog(LOG_NOTICE, "adjust time server %s offset %s sec", - ntoa(&server->srcadr), + stoa(&server->srcadr), lfptoa(&server->offset, 6)); } #else @@ -1268,20 +1326,39 @@ addserver( ) { register struct server *server; - u_int32 netnum; + /* Address infos structure to store result of getaddrinfo */ + struct addrinfo *addrResult; + /* Address infos structure to store hints for getaddrinfo */ + struct addrinfo hints; + /* Error variable for getaddrinfo */ + int error; + /* Service name */ + char service[5]; + strcpy(service, "ntp"); - if (!getnetnum(serv, &netnum)) { + /* Get host address. Looking for UDP datagram connection. */ + memset(&hints, 0, sizeof(hints)); + hints.ai_family = ai_fam_templ; + hints.ai_socktype = SOCK_DGRAM; + + printf("Looking for host %s and service %s\n", serv, service); + + error = getaddrinfo(serv, service, &hints, &addrResult); + if (error != 0) { + fprintf(stderr, "Error : %s\n", gai_strerror(error)); msyslog(LOG_ERR, "can't find host %s\n", serv); return; } + else { + fprintf(stderr, "host found : %s\n", stohost((struct sockaddr_storage*)addrResult->ai_addr)); + } server = (struct server *)emalloc(sizeof(struct server)); memset((char *)server, 0, sizeof(struct server)); - server->srcadr.sin_family = AF_INET; - server->srcadr.sin_addr.s_addr = netnum; - server->srcadr.sin_port = htons(NTP_PORT); - + /* For now we only get the first returned server of the addrinfo list */ + memset(&(server->srcadr), 0, sizeof(struct sockaddr_storage)); + memcpy(&(server->srcadr), addrResult->ai_addr, addrResult->ai_addrlen); server->event_time = ++sys_numservers; if (sys_servers == NULL) sys_servers = server; @@ -1297,47 +1374,56 @@ addserver( /* * findserver - find a server in the list given its address + * ***(For now it isn't totally AF-Independant, to check later..) */ static struct server * findserver( - struct sockaddr_in *addr + struct sockaddr_storage *addr ) { - register u_int32 netnum; struct server *server; struct server *mc_server; mc_server = NULL; - if (htons(addr->sin_port) != NTP_PORT) + if (htons(((struct sockaddr_in*)addr)->sin_port) != NTP_PORT) return 0; - netnum = addr->sin_addr.s_addr; for (server = sys_servers; server != NULL; server = server->next_server) { - register u_int32 servnum; - servnum = server->srcadr.sin_addr.s_addr; - if (netnum == servnum) + if (memcmp(addr, &server->srcadr, SOCKLEN(addr))==0) return server; - if (IN_MULTICAST(ntohl(servnum))) + /* Multicast compatibility to verify here... I'm not sure it's working */ + if(addr->ss_family == AF_INET) { + if (IN_MULTICAST(ntohl(((struct sockaddr_in*)addr)->sin_addr.s_addr))) + mc_server = server; + } + else { +#ifdef AF_INET6 + if (IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)(&server->srcadr))->sin6_addr)) mc_server = server; +#else + return 0; +#endif + } } if (mc_server != NULL) { + struct server *sp; if (mc_server->event_time != 0) { mc_server->event_time = 0; complete_servers++; } + server = (struct server *)emalloc(sizeof(struct server)); memset((char *)server, 0, sizeof(struct server)); - server->srcadr.sin_family = AF_INET; - server->srcadr.sin_addr.s_addr = netnum; - server->srcadr.sin_port = htons(NTP_PORT); + memcpy(&server->srcadr, &addr, sizeof(struct sockaddr_storage)); server->event_time = ++sys_numservers; + for (sp = sys_servers; sp->next_server != NULL; sp = sp->next_server) ; sp->next_server = server; @@ -1374,6 +1460,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 @@ -1382,13 +1473,16 @@ static RETSIGTYPE alarming( int sig ) -#else -void CALLBACK -alarming(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) -#endif /* SYS_WINNT */ { alarm_flag++; } +#else +void CALLBACK +alarming(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) +{ + alarm_flag++; +} +#endif /* SYS_WINNT */ /* @@ -1452,6 +1546,7 @@ init_alarm(void) itimer.it_interval.tv_sec = itimer.it_value.tv_sec = 0; itimer.it_interval.tv_usec = 1000000/TIMER_HZ; itimer.it_value.tv_usec = 1000000/(TIMER_HZ<<1); + setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); # endif #if defined SYS_CYGWIN32 @@ -1549,51 +1644,96 @@ init_alarm(void) static void init_io(void) { + struct addrinfo *res, *ressave; + struct addrinfo hints; + char service[5]; + int optval = 1; + /* * Init buffer free list and stat counters */ init_recvbuff(sys_numservers + 2); + /* * Open the socket */ + strcpy(service, "ntp"); + + /* + * Init hints addrinfo structure + */ + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_PASSIVE; + hints.ai_socktype = SOCK_DGRAM; + + if(getaddrinfo(NULL, service, &hints, &res) != 0) { + msyslog(LOG_ERR, "getaddrinfo() failed: %m"); + exit(1); + /*NOTREACHED*/ + } + + /* Remember the address of the addrinfo structure chain */ + ressave = res; + + /* + * For each structure returned, open and bind socket + */ + for(nbsock = 0; (nbsock < MAX_AF) && res ; res = res->ai_next) { /* create a datagram (UDP) socket */ - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - msyslog(LOG_ERR, "socket() failed: %m"); + if ((fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) { + if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT || + errno == EPFNOSUPPORT) + continue; + netsyslog(LOG_ERR, "socket() failed: %m"); exit(1); /*NOTREACHED*/ } + /* set socket to reuse address */ + if (setsockopt(fd[nbsock], SOL_SOCKET, SO_REUSEADDR, (void*) &optval, sizeof(optval)) < 0) { + netsyslog(LOG_ERR, "setsockopt() SO_REUSEADDR failed: %m"); + exit(1); + /*NOTREACHED*/ + } +#ifdef IPV6_V6ONLY + /* Restricts AF_INET6 socket to IPv6 communications (see RFC 2553bis-03) */ + if (res->ai_family == AF_INET6) + if (setsockopt(fd[nbsock], IPPROTO_IPV6, IPV6_V6ONLY, (void*) &optval, sizeof(optval)) < 0) { + netsyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m"); + exit(1); + /*NOTREACHED*/ + } +#endif + + /* Remember the socket family in fd_family structure */ + fd_family[nbsock] = res->ai_family; /* * bind the socket to the NTP port */ if (!debug && !simple_query && !unpriv_port) { - struct sockaddr_in addr; - - memset((char *)&addr, 0, sizeof addr); - addr.sin_family = AF_INET; - addr.sin_port = htons(NTP_PORT); - addr.sin_addr.s_addr = htonl(INADDR_ANY); - if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + if (bind(fd[nbsock], res->ai_addr, SOCKLEN(res->ai_addr)) < 0) { #ifndef SYS_WINNT if (errno == EADDRINUSE) #else if (WSAGetLastError() == WSAEADDRINUSE) #endif /* SYS_WINNT */ - msyslog(LOG_ERR, + netsyslog(LOG_ERR, "the NTP socket is in use, exiting"); else - msyslog(LOG_ERR, "bind() fails: %m"); + netsyslog(LOG_ERR, "bind() fails: %m"); exit(1); } } #ifdef HAVE_POLL_H - fdmask.fd = fd; - fdmask.events = POLLIN; + fdmask[nbsock].fd = fd[nbsock]; + fdmask[nbsock].events = POLLIN; #else - FD_ZERO(&fdmask); - FD_SET(fd, &fdmask); + FD_SET(fd[nbsock], &fdmask); + if ((SOCKET) maxfd < fd[nbsock]+1) { + maxfd = fd[nbsock]+1; + } #endif /* @@ -1604,22 +1744,22 @@ init_io(void) { int on = TRUE; - if (ioctl(fd,FIONBIO, &on) == ERROR) { - msyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m"); + if (ioctl(fd[nbsock],FIONBIO, &on) == ERROR) { + netsyslog(LOG_ERR, "ioctl(FIONBIO) fails: %m"); exit(1); } } # else /* not SYS_VXWORKS */ # if defined(O_NONBLOCK) - if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { - msyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m"); + if (fcntl(fd[nbsock], F_SETFL, O_NONBLOCK) < 0) { + netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m"); exit(1); /*NOTREACHED*/ } # else /* not O_NONBLOCK */ # if defined(FNDELAY) - if (fcntl(fd, F_SETFL, FNDELAY) < 0) { - msyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m"); + if (fcntl(fd[nbsock], F_SETFL, FNDELAY) < 0) { + netsyslog(LOG_ERR, "fcntl(FNDELAY|FASYNC) fails: %m"); exit(1); /*NOTREACHED*/ } @@ -1629,32 +1769,51 @@ init_io(void) # endif /* not O_NONBLOCK */ # endif /* SYS_VXWORKS */ #else /* SYS_WINNT */ - if (ioctlsocket(fd, FIONBIO, (u_long *) &on) == SOCKET_ERROR) { - msyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m"); + if (ioctlsocket(fd[nbsock], FIONBIO, (u_long *) &on) == SOCKET_ERROR) { + netsyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m"); exit(1); } #endif /* SYS_WINNT */ + nbsock++; + } + freeaddrinfo(ressave); } - /* * sendpkt - send a packet to the specified destination */ static void sendpkt( - struct sockaddr_in *dest, + struct sockaddr_storage *dest, struct pkt *pkt, int len ) { + int i; int cc; + SOCKET sock = 0; #ifdef SYS_WINNT DWORD err; #endif /* SYS_WINNT */ - cc = sendto(fd, (char *)pkt, len, 0, (struct sockaddr *)dest, - sizeof(struct sockaddr_in)); + /* Find a local family compatible socket to send ntp packet to ntp server */ + for(i = 0; (i < MAX_AF); i++) { + if(dest->ss_family == fd_family[i]) { + sock = fd[i]; + break; + } + } + + if ( sock == 0 ) { + netsyslog(LOG_ERR, "cannot find family compatible socket to send ntp packet"); + exit(1); + /*NOTREACHED*/ + } + + cc = sendto(sock, (char *)pkt, len, 0, (struct sockaddr *)dest, + SOCKLEN(dest)); + #ifndef SYS_WINNT if (cc == -1) { if (errno != EWOULDBLOCK && errno != ENOBUFS) @@ -1663,7 +1822,7 @@ sendpkt( err = WSAGetLastError(); if (err != WSAEWOULDBLOCK && err != WSAENOBUFS) #endif /* SYS_WINNT */ - msyslog(LOG_ERR, "sendto(%s): %m", ntoa(dest)); + netsyslog(LOG_ERR, "sendto(%s): %m", stohost(dest)); } } @@ -1679,22 +1838,49 @@ input_handler(void) struct timeval tvzero; int fromlen; l_fp ts; + int i; #ifdef HAVE_POLL_H - struct pollfd fds; + struct pollfd fds[MAX_AF]; #else fd_set fds; #endif + int fdc = 0; /* * Do a poll to see if we have data */ for (;;) { - fds = fdmask; tvzero.tv_sec = tvzero.tv_usec = 0; #ifdef HAVE_POLL_H - n = poll(&fds, 1, tvzero.tv_sec * 1000); + memcpy(fds, fdmask, sizeof(fdmask)); + n = poll(fds, (unsigned int)nbsock, tvzero.tv_sec * 1000); + + /* + * Determine which socket received data + */ + + for(i=0; i < nbsock; i++) { + if(fds[i].revents & POLLIN) { + fdc = fd[i]; + break; + } + } + #else - n = select(fd+1, &fds, (fd_set *)0, (fd_set *)0, &tvzero); + fds = fdmask; + n = select(maxfd, &fds, (fd_set *)0, (fd_set *)0, &tvzero); + + /* + * Determine which socket received data + */ + + for(i=0; i < maxfd; i++) { + if(FD_ISSET(fd[i], &fds)) { + fdc = fd[i]; + break; + } + } + #endif /* @@ -1706,7 +1892,7 @@ input_handler(void) return; else if (n == -1) { if (errno != EINTR) - msyslog(LOG_ERR, + netsyslog(LOG_ERR, #ifdef HAVE_POLL_H "poll() error: %m" #else @@ -1725,23 +1911,24 @@ input_handler(void) if (initializing || free_recvbuffs() == 0) { char buf[100]; + #ifndef SYS_WINNT - (void) read(fd, buf, sizeof buf); + (void) read(fdc, buf, sizeof buf); #else /* NT's _read does not operate on nonblocking sockets * either recvfrom or ReadFile() has to be used here. * ReadFile is used in [ntpd]ntp_intres() and ntpdc, * just to be different use recvfrom() here */ - recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)0, NULL); + recvfrom(fdc, buf, sizeof(buf), 0, (struct sockaddr *)0, NULL); #endif /* SYS_WINNT */ continue; } rb = get_free_recv_buffer(); - fromlen = sizeof(struct sockaddr_in); - rb->recv_length = recvfrom(fd, (char *)&rb->recv_pkt, + fromlen = sizeof(struct sockaddr_storage); + rb->recv_length = recvfrom(fdc, (char *)&rb->recv_pkt, sizeof(rb->recv_pkt), 0, (struct sockaddr *)&rb->recv_srcadr, &fromlen); if (rb->recv_length == -1) { @@ -1875,25 +2062,6 @@ l_step_systime( #endif /* SLEWALWAYS */ } -/* - * getnetnum - given a host name, return its net number - */ -static int -getnetnum( - const char *host, - u_int32 *num - ) -{ - struct hostent *hp; - - if (decodenetnum(host, num)) { - return 1; - } else if ((hp = gethostbyname(host)) != 0) { - memmove((char *)num, hp->h_addr, sizeof(u_int32)); - return (1); - } - return (0); -} /* XXX ELIMINATE printserver similar in ntptrace.c, ntpdate.c */ /* @@ -1911,13 +2079,13 @@ printserver( if (!debug) { (void) fprintf(fp, "server %s, stratum %d, offset %s, delay %s\n", - ntoa(&pp->srcadr), pp->stratum, + stoa(&pp->srcadr), pp->stratum, lfptoa(&pp->offset, 6), fptoa((s_fp)pp->delay, 5)); return; } (void) fprintf(fp, "server %s, port %d\n", - ntoa(&pp->srcadr), ntohs(pp->srcadr.sin_port)); + stoa(&pp->srcadr), ntohs(((struct sockaddr_in*)&(pp->srcadr))->sin_port)); (void) fprintf(fp, "stratum %d, precision %d, leap %c%c, trust %03o\n", pp->stratum, pp->precision, @@ -1930,7 +2098,7 @@ printserver( memmove(junk, (char *)&pp->refid, 4); str = junk; } else { - str = numtoa(pp->refid); + str = stoa(&pp->srcadr); } (void) fprintf(fp, "refid [%s], delay %s, dispersion %s\n", diff --git a/dist/ntp/ntpdate/ntpdate.h b/dist/ntp/ntpdate/ntpdate.h index 94ce2d07e9e0..40beda8d08db 100644 --- a/dist/ntp/ntpdate/ntpdate.h +++ b/dist/ntp/ntpdate/ntpdate.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntpdate.h,v 1.2 2000/04/17 05:49:54 simonb Exp $ */ +/* $NetBSD: ntpdate.h,v 1.3 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpdate.h - declarations for the ntpdate and ntptimeset programs @@ -17,7 +17,7 @@ extern void loadservers P((char *cfgpath)); */ struct server { struct server *next_server; /* next server in build list */ - struct sockaddr_in srcadr; /* address of remote host */ + struct sockaddr_storage srcadr; /* address of remote host */ u_char version; /* version to use */ u_char leap; /* leap indicator */ u_char stratum; /* stratum of remote server */ @@ -65,6 +65,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 @@ -97,3 +99,8 @@ struct server { #define DEFMAXPERIOD 60 /* maximum time to wait */ #define DEFMINSERVERS 3 /* minimum responding servers */ #define DEFMINVALID 1 /* mimimum servers with valid time */ + +/* + * Define the max number of sockets we can open + */ +#define MAX_AF 2 diff --git a/dist/ntp/ntpdate/ntptime_config.c b/dist/ntp/ntpdate/ntptime_config.c index 9e72b7f6bb4a..fe5530f6a480 100644 --- a/dist/ntp/ntpdate/ntptime_config.c +++ b/dist/ntp/ntpdate/ntptime_config.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntptime_config.c,v 1.1.1.2 2003/12/04 16:05:31 drochner Exp $ */ +/* $NetBSD: ntptime_config.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * ntptime_config.c diff --git a/dist/ntp/ntpdate/ntptimeset.c b/dist/ntp/ntpdate/ntptimeset.c index dd939280bcaa..608773bca4f6 100644 --- a/dist/ntp/ntpdate/ntptimeset.c +++ b/dist/ntp/ntpdate/ntptimeset.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntptimeset.c,v 1.3 2000/04/22 15:04:49 simonb Exp $ */ +/* $NetBSD: ntptimeset.c,v 1.4 2003/12/04 16:23:38 drochner Exp $ */ /* * ntptimeset - get/set the time via ntp @@ -123,37 +123,7 @@ # include #endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif - -#include -#include -#include -#ifndef SYS_WINNT -# include -# include -# include -#endif /* SYS_WINNT */ -#include -#ifdef HAVE_SYS_RESOURCE_H -# include -#endif /* HAVE_SYS_RESOURCE_H */ - -#ifdef SYS_VXWORKS -# include "ioLib.h" -# include "sockLib.h" -# include "timers.h" -#endif - - -#if defined(SYS_HPUX) -# include -#endif - +#include "ntp_machine.h" #include "ntp_fp.h" #include "ntp.h" #include "ntp_io.h" @@ -164,6 +134,34 @@ #include "ntp_syslog.h" #include "ntp_select.h" #include "ntp_stdlib.h" + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include +#include +#ifndef SYS_WINNT +# include +# ifdef HAVE_SYS_SIGNAL_H +# include +# else +# include +# endif +# include +#endif /* SYS_WINNT */ + +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif /* HAVE_SYS_RESOURCE_H */ + +#ifdef SYS_VXWORKS +# include "ioLib.h" +# include "sockLib.h" +# include "timers.h" +#endif + #include "recvbuff.h" #ifdef SYS_WINNT @@ -1014,7 +1012,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); @@ -1978,7 +1976,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/dist/ntp/ntpdc/nl_in.c b/dist/ntp/ntpdc/nl_in.c index 55f54dfb65b7..43ac146f53a2 100644 --- a/dist/ntp/ntpdc/nl_in.c +++ b/dist/ntp/ntpdc/nl_in.c @@ -1,4 +1,4 @@ -/* $NetBSD: nl_in.c,v 1.1.1.1 2003/12/04 16:05:31 drochner Exp $ */ +/* $NetBSD: nl_in.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ #include #include "ntpdc.h" diff --git a/dist/ntp/ntpdc/ntpdc-layout.c b/dist/ntp/ntpdc/ntpdc-layout.c index 5bb34a0db355..789dcfe8f8d2 100644 --- a/dist/ntp/ntpdc/ntpdc-layout.c +++ b/dist/ntp/ntpdc/ntpdc-layout.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntpdc-layout.c,v 1.1.1.1 2003/12/04 16:05:31 drochner Exp $ */ +/* $NetBSD: ntpdc-layout.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpdc-layout - print layout of NTP mode 7 request/response packets diff --git a/dist/ntp/ntpdc/ntpdc.c b/dist/ntp/ntpdc/ntpdc.c index b780123de1af..0c71d74a37bd 100644 --- a/dist/ntp/ntpdc/ntpdc.c +++ b/dist/ntp/ntpdc/ntpdc.c @@ -1,27 +1,35 @@ -/* $NetBSD: ntpdc.c,v 1.4 2001/04/06 11:13:54 wiz Exp $ */ +/* $NetBSD: ntpdc.c,v 1.5 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpdc - control and monitor your ntpd daemon */ + #include -#include -#include -#include -#include -#include -#include - -#ifdef SYS_WINNT -#include -#else -#define closesocket close -#endif /* SYS_WINNT */ - #include "ntpdc.h" #include "ntp_select.h" #include "ntp_io.h" #include "ntp_stdlib.h" +/* Don't include ISC's version of IPv6 variables and structures */ +#define ISC_IPV6_H 1 +#include "isc/net.h" +#include "isc/result.h" + +#include +#include +#include +#include + +#ifdef SYS_WINNT +# include +#else +# define closesocket close +#endif /* SYS_WINNT */ + +#if defined(HAVE_LIBREADLINE) || defined (HAVE_LIBEDIT) +# include +# include +#endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */ #ifdef SYS_VXWORKS /* vxWorks needs mode flag -casey*/ @@ -43,12 +51,11 @@ static const char * prompt = "ntpdc> "; /* prompt to ask him about */ static u_long info_auth_keyid; /* - * Type of key md5 or des + * Type of key md5 */ -#define KEY_TYPE_DES 3 #define KEY_TYPE_MD5 4 -static int info_auth_keytype = KEY_TYPE_MD5; /* MD5*/ +static int info_auth_keytype = KEY_TYPE_MD5; /* MD5 */ u_long current_time; /* needed by authkeys; not used */ int ntpdcmain P((int, char **)); @@ -58,7 +65,7 @@ int ntpdcmain P((int, char **)); static int openhost P((const char *)); static int sendpkt P((char *, int)); static void growpktdata P((void)); -static int getresponse P((int, int, int *, int *, char **)); +static int getresponse P((int, int, int *, int *, char **, int)); static int sendrequest P((int, int, int, int, int, char *)); static void getcmds P((void)); static RETSIGTYPE abortcmd P((int)); @@ -66,7 +73,7 @@ static void docmd P((const char *)); static void tokenize P((const char *, char **, int *)); static int findcmd P((char *, struct xcmd *, struct xcmd *, struct xcmd **)); static int getarg P((char *, int, arg_v *)); -static int getnetnum P((const char *, u_int32 *, char *)); +static int getnetnum P((const char *, struct sockaddr_storage *, char *, int)); static void help P((struct parse *, FILE *)); #ifdef QSORT_USES_VOID_P static int helpsort P((const void *, const void *)); @@ -84,10 +91,8 @@ static void hostnames P((struct parse *, FILE *)); static void setdebug P((struct parse *, FILE *)); static void quit P((struct parse *, FILE *)); static void version P((struct parse *, FILE *)); -static void warning P((const char *, ...)) - __attribute__((__format__(__printf__, 1, 2))); -static void error P((const char *, ...)) - __attribute__((__format__(__printf__, 1, 2))); +static void warning P((const char *, const char *, const char *)); +static void error P((const char *, const char *, const char *)); static u_long getkeyid P((const char *)); @@ -108,8 +113,8 @@ static struct xcmd builtins[] = { { "delay", my_delay, { OPT|INT, NO, NO, NO }, { "msec", "", "", "" }, "set the delay added to encryption time stamps" }, - { "host", host, { OPT|NTP_STR, NO, NO, NO }, - { "hostname", "", "", "" }, + { "host", host, { OPT|NTP_STR, OPT|NTP_STR, NO, NO }, + { "-4|-6", "hostname", "", "" }, "specify the host whose NTP server we talk to" }, { "passwd", passwd, { OPT|NTP_STR, NO, NO, NO }, { "", "", "", "" }, @@ -151,7 +156,9 @@ static struct xcmd builtins[] = { #define MAXCMDS 100 /* maximum commands on cmd line */ #define MAXHOSTS 200 /* maximum hosts on cmd line */ #define MAXLINE 512 /* maximum line length */ -#define MAXTOKENS (1+MAXARGS+2) /* maximum number of usable tokens */ +#define MAXTOKENS (1+1+MAXARGS+2) /* maximum number of usable tokens */ + /* command + -4|-6 + MAXARGS + */ + /* redirection */ /* * Some variables used and manipulated locally @@ -160,20 +167,19 @@ static struct timeval tvout = { DEFTIMEOUT, 0 }; /* time out for reads */ static struct timeval tvsout = { DEFSTIMEOUT, 0 }; /* secondary time out */ static l_fp delay_time; /* delay time */ static char currenthost[LENHOSTNAME]; /* current host name */ -static struct sockaddr_in hostaddr = { 0 }; /* host address */ -static int showhostnames = 1; /* show host names by default */ +int showhostnames = 1; /* show host names by default */ -static int sockfd; /* fd socket is openned on */ +static int ai_fam_templ; /* address family */ +static int ai_fam_default; /* default address family */ +static SOCKET sockfd; /* fd socket is opened on */ static int havehost = 0; /* set to 1 when host open */ -struct servent *server_entry = NULL; /* server entry for ntp */ +int s_port = 0; #if defined (SYS_WINNT) || defined (SYS_VXWORKS) char password[9]; #endif /* SYS_WINNT || SYS_VXWORKS */ #ifdef SYS_WINNT -WORD wVersionRequested; -WSADATA wsaData; DWORD NumberOfBytesWritten; HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */ @@ -191,6 +197,12 @@ void timer(void) { ; }; /* 1998/06/03 - Used in ntplib/machines.c */ static char *pktdata; static int pktdatasize; +/* + * These are used to help the magic with old and new versions of ntpd. + */ +int impl_ver = IMPL_XNTPD; +static int req_pkt_size = REQ_LEN_NOMAC; + /* * For commands typed on the command line (with the -c option) */ @@ -263,7 +275,6 @@ void clear_globals(void) showhostnames = 0; /* show host names by default */ ntp_optind = 0; ntp_optarg = 0; - server_entry = NULL; /* server entry for ntp */ havehost = 0; /* set to 1 when host open */ numcmds = 0; numhosts = 0; @@ -292,9 +303,29 @@ ntpdcmain( taskPrioritySet(taskIdSelf(), 100 ); #endif +#ifdef SYS_WINNT + if (!Win32InitSockets()) + { + fprintf(stderr, "No useable winsock.dll:"); + exit(1); + } +#endif /* SYS_WINNT */ + + /* Check to see if we have IPv6. Otherwise force the -4 flag */ + if (isc_net_probeipv6() != ISC_R_SUCCESS) { + ai_fam_default = AF_INET; + } + progname = argv[0]; - while ((c = ntp_getopt(argc, argv, "c:dilnps")) != EOF) + ai_fam_templ = ai_fam_default; + while ((c = ntp_getopt(argc, argv, "46c:dilnps")) != EOF) switch (c) { + case '4': + ai_fam_templ = AF_INET; + break; + case '6': + ai_fam_templ = AF_INET6; + break; case 'c': ADDCMD(ntp_optarg); break; @@ -322,7 +353,7 @@ ntpdcmain( } if (errflg) { (void) fprintf(stderr, - "usage: %s [-dilnps] [-c cmd] host ...\n", + "usage: %s [-46dilnps] [-c cmd] host ...\n", progname); exit(2); } @@ -353,14 +384,6 @@ ntpdcmain( } pktdatasize = INITDATASIZE; -#ifdef SYS_WINNT - wVersionRequested = MAKEWORD(1,1); - if (WSAStartup(wVersionRequested, &wsaData)) { - fprintf(stderr, "No useable winsock.dll"); - exit(1); - } -#endif /* SYS_WINNT */ - if (numcmds == 0) { (void) openhost(chosts[0]); getcmds(); @@ -392,29 +415,68 @@ openhost( const char *hname ) { - u_int32 netnum; char temphost[LENHOSTNAME]; + int a_info, i; + struct addrinfo hints, *ai = NULL; + register const char *cp; + char name[LENHOSTNAME]; + char service[5]; - if (server_entry == NULL) { - server_entry = getservbyname("ntp", "udp"); - if (server_entry == NULL) { -#ifdef VMS /* UCX getservbyname() doesn't work [yet], but we do know better */ - server_entry = (struct servent *) - malloc(sizeof(struct servent)); - server_entry->s_port = htons(NTP_PORT); -#else - (void) fprintf(stderr, "%s: ntp/udp: unknown service\n", - progname); - exit(1); -#endif /* VMS & UCX */ - } - if (debug > 2) - printf("Got ntp/udp service entry\n"); + /* + * We need to get by the [] if they were entered + */ + + cp = hname; + + if (*cp == '[') { + cp++; + for(i = 0; *cp != ']'; cp++, i++) + name[i] = *cp; + name[i] = '\0'; + hname = name; + } + + /* + * First try to resolve it as an ip address and if that fails, + * do a fullblown (dns) lookup. That way we only use the dns + * when it is needed and work around some implementations that + * will return an "IPv4-mapped IPv6 address" address if you + * give it an IPv4 address to lookup. + */ + strcpy(service, "ntp"); + memset((char *)&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = ai_fam_templ; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_NUMERICHOST; + + a_info = getaddrinfo(hname, service, &hints, &ai); + if (a_info == EAI_NONAME || a_info == EAI_NODATA) { + hints.ai_flags = AI_CANONNAME; +#ifdef AI_ADDRCONFIG + hints.ai_flags |= AI_ADDRCONFIG; +#endif + a_info = getaddrinfo(hname, service, &hints, &ai); + } + /* Some older implementations don't like AI_ADDRCONFIG. */ + if (a_info == EAI_BADFLAGS) { + hints.ai_flags = AI_CANONNAME; + a_info = getaddrinfo(hname, service, &hints, &ai); + } + if (a_info != 0) { + (void) fprintf(stderr, "%s\n", gai_strerror(a_info)); + return 0; + } + + if (ai->ai_canonname == NULL) { + strncpy(temphost, stoa((struct sockaddr_storage *)ai->ai_addr), + LENHOSTNAME); + temphost[LENHOSTNAME-1] = '\0'; + } else { + strncpy(temphost, ai->ai_canonname, LENHOSTNAME); + temphost[LENHOSTNAME-1] = '\0'; } - if (!getnetnum(hname, &netnum, temphost)) - return 0; - if (debug > 2) printf("Opening host %s\n", temphost); @@ -425,14 +487,18 @@ openhost( havehost = 0; } (void) strcpy(currenthost, temphost); - - hostaddr.sin_family = AF_INET; -#ifndef SYS_VXWORKS - hostaddr.sin_port = server_entry->s_port; -#else - hostaddr.sin_port = htons(SERVER_PORT_NUM); -#endif - hostaddr.sin_addr.s_addr = netnum; + + /* port maps to the same in both families */ + s_port = ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port; +#ifdef SYS_VXWORKS + ((struct sockaddr_in6 *)&hostaddr)->sin6_port = htons(SERVER_PORT_NUM); + if (ai->ai_family == AF_INET) + *(struct sockaddr_in *)&hostaddr= + *((struct sockaddr_in *)ai->ai_addr); + else + *(struct sockaddr_in6 *)&hostaddr= + *((struct sockaddr_in6 *)ai->ai_addr); +#endif /* SYS_VXWORKS */ #ifdef SYS_WINNT { @@ -444,16 +510,16 @@ openhost( exit(1); } } - - sockfd = socket(AF_INET, SOCK_DGRAM, 0); + + sockfd = socket(ai->ai_family, SOCK_DGRAM, 0); if (sockfd == INVALID_SOCKET) { - error("socket"); - exit(1); + error("socket", "", ""); + exit(-1); } #else - sockfd = socket(AF_INET, SOCK_DGRAM, 0); + sockfd = socket(ai->ai_family, SOCK_DGRAM, 0); if (sockfd == -1) - error("socket"); + error("socket", "", ""); #endif /* SYS_WINNT */ @@ -464,16 +530,24 @@ openhost( if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &rbufsize, sizeof(int)) == -1) - error("setsockopt"); + error("setsockopt", "", ""); } # endif #endif - if (connect(sockfd, (struct sockaddr *)&hostaddr, +#ifdef SYS_VXWORKS + if (connect(sockfd, (struct sockaddr *)&hostaddr, sizeof(hostaddr)) == -1) - error("connect"); - +#else + if (connect(sockfd, (struct sockaddr *)ai->ai_addr, + ai->ai_addrlen) == -1) +#endif /* SYS_VXWORKS */ + error("connect", "", ""); + if (a_info) + freeaddrinfo(ai); havehost = 1; + req_pkt_size = REQ_LEN_NOMAC; + impl_ver = IMPL_XNTPD; return 1; } @@ -488,8 +562,8 @@ sendpkt( int xdatalen ) { - if (send(sockfd, xdata, xdatalen, 0) == -1) { - warning("write to %s failed", currenthost); + if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) { + warning("write to %s failed", currenthost, ""); return -1; } @@ -521,15 +595,18 @@ getresponse( int reqcode, int *ritems, int *rsize, - char **rdata + char **rdata, + int esize ) { struct resp_pkt rpkt; struct timeval tvo; int items; + int i; int size; int datasize; char *datap; + char *tmp_data; char haveseq[MAXSEQ+1]; int firstpkt; int lastseq; @@ -537,6 +614,7 @@ getresponse( int seq; fd_set fds; int n; + int pad; /* * This is pretty tricky. We may get between 1 and many packets @@ -564,7 +642,7 @@ getresponse( n = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvo); if (n == -1) { - warning("select fails"); + warning("select fails", "", ""); return -1; } if (n == 0) { @@ -595,7 +673,7 @@ getresponse( n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0); if (n == -1) { - warning("read"); + warning("read", "", ""); return -1; } @@ -660,13 +738,15 @@ getresponse( return (int)INFO_ERR(rpkt.err_nitems); } - /* * Collect items and size. Make sure they make sense. */ items = INFO_NITEMS(rpkt.err_nitems); size = INFO_ITEMSIZE(rpkt.mbz_itemsize); - + if (esize > size) + pad = esize - size; + else + pad = 0; if ((datasize = items*size) > (n-RESP_HEADER_SIZE)) { if (debug) printf( @@ -679,15 +759,14 @@ getresponse( * If this isn't our first packet, make sure the size matches * the other ones. */ - if (!firstpkt && size != *rsize) { + if (!firstpkt && esize != *rsize) { if (debug) printf("Received itemsize %d, previous %d\n", size, *rsize); goto again; } - /* - * If we've received this before, toss it + * If we've received this before, +toss it */ seq = INFO_SEQ(rpkt.auth_seq); if (haveseq[seq]) { @@ -711,17 +790,28 @@ getresponse( /* * So far, so good. Copy this data into the output array. */ - if ((datap + datasize) > (pktdata + pktdatasize)) { + if ((datap + datasize + (pad * items)) > (pktdata + pktdatasize)) { int offset = datap - pktdata; growpktdata(); *rdata = pktdata; /* might have been realloced ! */ datap = pktdata + offset; } - memmove(datap, (char *)rpkt.data, (unsigned)datasize); - datap += datasize; + /* + * We now move the pointer along according to size and number of + * items. This is so we can play nice with older implementations + */ + + tmp_data = (char *)rpkt.data; + for(i = 0; i keyid = htonl(info_auth_keyid); get_systime(&ts); L_ADD(&ts, &delay_time); - HTONL_FP(&ts, &qpkt.tstamp); + HTONL_FP(&ts, &qpktail->tstamp); maclen = authencrypt(info_auth_keyid, (u_int32 *)&qpkt, - REQ_LEN_NOMAC); + req_pkt_size); if (maclen == 0) { (void) fprintf(stderr, "Key not found\n"); return (1); } - return sendpkt((char *)&qpkt, (int)(REQ_LEN_NOMAC + maclen)); + return sendpkt((char *)&qpkt, (int)(req_pkt_size + maclen)); } /*NOTREACHED*/ } @@ -827,7 +920,8 @@ doquery( int *ritems, int *rsize, char **rdata, - int quiet_mask + int quiet_mask, + int esize ) { int res; @@ -846,6 +940,7 @@ doquery( /* * Poll the socket and clear out any pending data */ +again: do { tvzero.tv_sec = tvzero.tv_usec = 0; FD_ZERO(&fds); @@ -853,7 +948,7 @@ doquery( res = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvzero); if (res == -1) { - warning("polling select"); + warning("polling select", "", ""); return -1; } else if (res > 0) @@ -871,12 +966,43 @@ doquery( /* * Get the response. If we got a standard error, print a message */ - res = getresponse(implcode, reqcode, ritems, rsize, rdata); + res = getresponse(implcode, reqcode, ritems, rsize, rdata, esize); + + /* + * Try to be compatible with older implementations of ntpd. + */ + if (res == INFO_ERR_FMT && req_pkt_size != 48) { + int oldsize; + + oldsize = req_pkt_size; + + switch(req_pkt_size) { + case REQ_LEN_NOMAC: + req_pkt_size = 160; + break; + case 160: + req_pkt_size = 48; + break; + } + if (impl_ver == IMPL_XNTPD) { + fprintf(stderr, + "***Warning changing to older implementation\n"); + return INFO_ERR_IMPL; + } + + fprintf(stderr, + "***Warning changing the request packet size from %d to %d\n", + oldsize, req_pkt_size); + goto again; + } /* log error message if not told to be quiet */ if ((res > 0) && (((1 << res) & quiet_mask) == 0)) { switch(res) { case INFO_ERR_IMPL: + /* Give us a chance to try the older implementation. */ + if (implcode == IMPL_XNTPD) + break; (void) fprintf(stderr, "***Server implementation incompatable with our own\n"); break; @@ -918,6 +1044,16 @@ doquery( static void getcmds(void) { +#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) + char *line; + + for (;;) { + if ((line = readline(interactive?prompt:"")) == NULL) return; + if (*line) add_history(line); + docmd(line); + free(line); + } +#else /* not (HAVE_LIBREADLINE || HAVE_LIBEDIT) */ char line[MAXLINE]; for (;;) { @@ -934,9 +1070,11 @@ getcmds(void) docmd(line); } +#endif /* not HAVE_LIBREADLINE || HAVE_LIBEDIT */ } +#ifndef SYS_WINNT /* Under NT cannot handle SIGINT, WIN32 spawns a handler */ /* * abortcmd - catch interrupts and abort the current command */ @@ -952,7 +1090,7 @@ abortcmd( (void) fflush(stderr); if (jump) longjmp(interrupt_buf, 1); } - +#endif /* SYS_WINNT */ /* * docmd - decode the command line and execute a command @@ -965,9 +1103,11 @@ docmd( char *tokens[1+MAXARGS+2]; struct parse pcmd; int ntok; - static int i; + int i, ti; + int rval; struct xcmd *xcmd; + ai_fam_templ = ai_fam_default; /* * Tokenize the command line. If nothing on it, return. */ @@ -995,22 +1135,29 @@ docmd( */ pcmd.keyword = tokens[0]; pcmd.nargs = 0; - for (i = 0; i < MAXARGS && xcmd->arg[i] != NO; i++) { - if ((i+1) >= ntok) { + ti = 1; + for (i = 0; i < MAXARGS && xcmd->arg[i] != NO;) { + if ((i+ti) >= ntok) { if (!(xcmd->arg[i] & OPT)) { printusage(xcmd, stderr); return; } break; } - if ((xcmd->arg[i] & OPT) && (*tokens[i+1] == '>')) - break; - if (!getarg(tokens[i+1], (int)xcmd->arg[i], &pcmd.argval[i])) - return; + if ((xcmd->arg[i] & OPT) && (*tokens[i+ti] == '>')) + break; + rval = getarg(tokens[i+ti], (int)xcmd->arg[i], &pcmd.argval[i]); + if (rval == -1) { + ti++; + continue; + } + if (rval == 0) + return; pcmd.nargs++; + i++; } - i++; + i += ti; if (i < ntok && *tokens[i] == '>') { char *fname; @@ -1029,10 +1176,8 @@ docmd( perror(""); return; } - i = 1; /* flag we need a close */ } else { current_output = stdout; - i = 0; /* flag no close */ } if (interactive && setjmp(interrupt_buf)) { @@ -1041,7 +1186,9 @@ docmd( jump = 1; (xcmd->handler)(&pcmd, current_output); jump = 0; - if (i) (void) fclose(current_output); + if (current_output != stdout) + (void) fclose(current_output); + current_output = NULL; } } @@ -1145,8 +1292,12 @@ findcmd( } - /* +/* * getarg - interpret an argument token + * + * return: 0 - failure + * 1 - success + * -1 - skip to next token */ static int getarg( @@ -1164,7 +1315,14 @@ getarg( argp->string = str; break; case ADD: - if (!getnetnum(str, &(argp->netnum), (char *)0)) { + if (!strcmp("-6", str)) { + ai_fam_templ = AF_INET6; + return -1; + } else if (!strcmp("-4", str)) { + ai_fam_templ = AF_INET; + return -1; + } + if (!getnetnum(str, &(argp->netnum), (char *)0, 0)) { return 0; } break; @@ -1198,6 +1356,17 @@ getarg( argp->ival = -argp->ival; } break; + case IP_VERSION: + if (!strcmp("-6", str)) + argp->ival = 6 ; + else if (!strcmp("-4", str)) + argp->ival = 4 ; + else { + (void) fprintf(stderr, + "***Version must be either 4 or 6\n"); + return 0; + } + break; } return 1; @@ -1211,24 +1380,36 @@ getarg( static int getnetnum( const char *hname, - u_int32 *num, - char *fullhost + struct sockaddr_storage *num, + char *fullhost, + int af ) { - struct hostent *hp; + int err; + int sockaddr_len; + struct addrinfo hints, *ai = NULL; + sockaddr_len = (af == AF_INET) + ? sizeof(struct sockaddr_in) + : sizeof(struct sockaddr_in6); + memset((char *)&hints, 0, sizeof(struct addrinfo)); + hints.ai_flags = AI_CANONNAME; +#ifdef AI_ADDRCONFIG + hints.ai_flags |= AI_ADDRCONFIG; +#endif + + /* decodenetnum only works with addresses */ if (decodenetnum(hname, num)) { if (fullhost != 0) { - (void) sprintf(fullhost, - "%u.%u.%u.%u", (u_int)((htonl(*num)>>24)&0xff), - (u_int)((htonl(*num)>>16)&0xff), (u_int)((htonl(*num)>>8)&0xff), - (u_int)(htonl(*num)&0xff)); + getnameinfo((struct sockaddr *)num, sockaddr_len, + fullhost, sizeof(fullhost), NULL, 0, + NI_NUMERICHOST); } return 1; - } else if ((hp = gethostbyname(hname)) != 0) { - memmove((char *)num, hp->h_addr, sizeof(u_int32)); + } else if ((err = getaddrinfo(hname, "ntp", &hints, &ai)) == 0) { + memmove((char *)num, ai->ai_addr, ai->ai_addrlen); if (fullhost != 0) - (void) strcpy(fullhost, hp->h_name); + (void) strcpy(fullhost, ai->ai_canonname); return 1; } else { (void) fprintf(stderr, "***Can't find host %s\n", hname); @@ -1243,14 +1424,15 @@ getnetnum( */ char * nntohost( - u_int32 netnum + struct sockaddr_storage *netnum ) { if (!showhostnames) - return numtoa(netnum); - if ((ntohl(netnum) & REFCLOCK_MASK) == REFCLOCK_ADDR) - return refnumtoa(netnum); - return numtohost(netnum); + return stoa(netnum); + + if ((netnum->ss_family == AF_INET) && ISREFCLOCKADR(netnum)) + return refnumtoa(netnum); + return socktohost(netnum); } @@ -1287,9 +1469,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; @@ -1338,8 +1520,8 @@ helpsort( const void *t2 ) { - const char **name1 = (const char **)t1; - const char **name2 = (const char **)t2; + char const * const * name1 = (char const * const *)t1; + char const * const * name2 = (char const * const *)t2; return strcmp(*name1, *name2); } @@ -1364,10 +1546,15 @@ printusage( FILE *fp ) { - register int i; + int i, opt46; + opt46 = 0; (void) fprintf(fp, "usage: %s", xcp->keyword); for (i = 0; i < MAXARGS && xcp->arg[i] != NO; i++) { + if (opt46 == 0 && (xcp->arg[i] & ~OPT) == ADD) { + (void) fprintf(fp, " [ -4|-6 ]"); + opt46 = 1; + } if (xcp->arg[i] & OPT) (void) fprintf(fp, " [ %s ]", xcp->desc[i]); else @@ -1442,12 +1629,33 @@ host( FILE *fp ) { + int i; + if (pcmd->nargs == 0) { if (havehost) (void) fprintf(fp, "current host is %s\n", currenthost); else (void) fprintf(fp, "no current host\n"); - } else if (openhost(pcmd->argval[0].string)) { + return; + } + + i = 0; + if (pcmd->nargs == 2) { + if (!strcmp("-4", pcmd->argval[i].string)) + ai_fam_templ = AF_INET; + else if (!strcmp("-6", pcmd->argval[i].string)) + ai_fam_templ = AF_INET6; + else { + if (havehost) + (void) fprintf(fp, + "current host remains %s\n", currenthost); + else + (void) fprintf(fp, "still no current host\n"); + return; + } + i = 1; + } + if (openhost(pcmd->argval[i].string)) { (void) fprintf(fp, "current host set to %s\n", currenthost); } else { if (havehost) @@ -1490,7 +1698,7 @@ keytype( { if (pcmd->nargs == 0) fprintf(fp, "keytype is %s\n", - (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "DES"); + (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "???"); else switch (*(pcmd->argval[0].string)) { case 'm': @@ -1498,13 +1706,8 @@ keytype( info_auth_keytype = KEY_TYPE_MD5; break; - case 'd': - case 'D': - info_auth_keytype = KEY_TYPE_DES; - break; - default: - fprintf(fp, "keytype must be 'md5' or 'des'\n"); + fprintf(fp, "keytype must be 'md5'\n"); } } @@ -1532,16 +1735,16 @@ 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: " - : "MD5 Password: " - ); + pass = getpass("MD5 Password: "); 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); + } } } @@ -1635,17 +1838,12 @@ version( static void warning( const char *fmt, - ... + const char *st1, + const char *st2 ) { - va_list ap; - (void) fprintf(stderr, "%s: ", progname); - - va_start(ap, fmt); - (void) vfprintf(stderr, fmt, ap); - va_end(ap); - + (void) fprintf(stderr, fmt, st1, st2); (void) fprintf(stderr, ": "); perror(""); } @@ -1657,19 +1855,11 @@ warning( static void error( const char *fmt, - ... + const char *st1, + const char *st2 ) { - va_list ap; - - (void) fprintf(stderr, "%s: ", progname); - - va_start(ap, fmt); - (void) vfprintf(stderr, fmt, ap); - va_end(ap); - - (void) fprintf(stderr, ": "); - perror(""); + warning(fmt, st1, st2); exit(1); } @@ -1697,7 +1887,7 @@ getkeyid( fprintf(stderr, "%s", keyprompt); fflush(stderr); for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) { if (p < &pbuf[18]) - *p++ = c; + *p++ = (char) c; } *p = '\0'; if (fi != stdin) diff --git a/dist/ntp/ntpdc/ntpdc.h b/dist/ntp/ntpdc/ntpdc.h index 10a9ec9235d6..479b6123f508 100644 --- a/dist/ntp/ntpdc/ntpdc.h +++ b/dist/ntp/ntpdc/ntpdc.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntpdc.h,v 1.1.1.2 2003/12/04 16:05:31 drochner Exp $ */ +/* $NetBSD: ntpdc.h,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpdc.h - definitions of interest to ntpdc diff --git a/dist/ntp/ntpdc/ntpdc_ops.c b/dist/ntp/ntpdc/ntpdc_ops.c index 402dfaa48925..531f7a60a577 100644 --- a/dist/ntp/ntpdc/ntpdc_ops.c +++ b/dist/ntp/ntpdc/ntpdc_ops.c @@ -1,7 +1,7 @@ -/* $NetBSD: ntpdc_ops.c,v 1.2 2002/12/06 15:12:56 thorpej Exp $ */ +/* $NetBSD: ntpdc_ops.c,v 1.3 2003/12/04 16:23:38 drochner Exp $ */ /* - * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc + * ntpdc_ops.c - subroutines which are called to perform operations by xntpdc */ #ifdef HAVE_CONFIG_H @@ -9,9 +9,14 @@ #endif #include +#include + +#include "ntpdc.h" +#include "ntp_control.h" +#include "ntp_refclock.h" +#include "ntp_stdlib.h" + #include -#include -#include #ifdef HAVE_SYS_TIMEX_H # include #endif @@ -20,11 +25,6 @@ #include #endif -#include "ntpdc.h" -#include "ntp_control.h" -#include "ntp_refclock.h" -#include "ntp_stdlib.h" - #include /* @@ -86,16 +86,16 @@ static void kerninfo P((struct parse *, FILE *)); * Commands we understand. Ntpdc imports this. */ struct xcmd opcmds[] = { - { "listpeers", peerlist, { NO, NO, NO, NO }, - { "", "", "", "" }, - "display list of peers the server knows about" }, - { "peers", peers, { NO, NO, NO, NO }, - { "", "", "", "" }, - "display peer summary information" }, - { "dmpeers", dmpeers, { NO, NO, NO, NO }, - { "", "", "", "" }, - "display peer summary info the way Dave Mills likes it" }, - { "showpeer", showpeer, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "listpeers", peerlist, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "display list of peers the server knows about [IP Version]" }, + { "peers", peers, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "display peer summary information [IP Version]" }, + { "dmpeers", dmpeers, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "display peer summary info the way Dave Mills likes it (IP Version)" }, + { "showpeer", showpeer, { ADD, OPT|ADD, OPT|ADD, OPT|ADD}, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "display detailed information for one or more peers" }, { "pstats", peerstats, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, @@ -140,17 +140,17 @@ struct xcmd opcmds[] = { { "disable", sys_clear, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, { "auth|bclient|monitor|pll|kernel|stats", "...", "...", "..." }, "clear a system flag (auth, bclient, monitor, pll, kernel, stats)" }, - { "reslist", reslist, { NO, NO, NO, NO }, - { "", "", "", "" }, + { "reslist", reslist, {OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, "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 }, @@ -212,13 +212,6 @@ struct xcmd opcmds[] = { { "", "", "", "" }, "" } }; - -/* - * Imported from ntpdc.c - */ -extern int showhostnames; -extern struct servent *server_entry; - /* * For quick string comparisons */ @@ -295,25 +288,49 @@ peerlist( ) { struct info_peer_list *plist; + struct sockaddr_storage paddr; int items; int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_PEER_LIST, 0, 0, 0, (char *)NULL, &items, - &itemsize, (void *)&plist, 0); +again: + res = doquery(impl_ver, REQ_PEER_LIST, 0, 0, 0, (char *)NULL, &items, + &itemsize, (void *)&plist, 0, + sizeof(struct info_peer_list)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_peer_list))) + if (!checkitemsize(itemsize, sizeof(struct info_peer_list)) && + !checkitemsize(itemsize, v4sizeof(struct info_peer_list))) return; while (items > 0) { - (void) fprintf(fp, "%-9s %s\n", modetoa(plist->hmode), - nntohost(plist->address)); + memset((char *)&paddr, 0, sizeof(paddr)); + if (plist->v6_flag != 0) { + GET_INADDR6(paddr) = plist->addr6; + paddr.ss_family = AF_INET6; + } else { + GET_INADDR(paddr) = plist->addr; + paddr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + paddr.ss_len = SOCKLEN(&paddr); +#endif + if ((pcmd->nargs == 0) || + ((pcmd->argval->ival == 6) && (plist->v6_flag != 0)) || + ((pcmd->argval->ival == 4) && (plist->v6_flag == 0))) + (void) fprintf(fp, "%-9s %s\n", + modetoa(plist->hmode), + nntohost(&paddr)); plist++; items--; } @@ -357,6 +374,8 @@ dopeers( ) { struct info_peer_summary *plist; + struct sockaddr_storage dstadr; + struct sockaddr_storage srcadr; int items; int itemsize; int ntp_poll; @@ -364,17 +383,25 @@ dopeers( int c; l_fp tempts; - res = doquery(IMPL_XNTPD, REQ_PEER_LIST_SUM, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&plist, 0); +again: + res = doquery(impl_ver, REQ_PEER_LIST_SUM, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&plist, 0, + sizeof(struct info_peer_summary)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_peer_summary))) - return; + if (!checkitemsize(itemsize, sizeof(struct info_peer_summary)) && + !checkitemsize(itemsize, v4sizeof(struct info_peer_summary))) + return; (void) fprintf(fp, " remote local st poll reach delay offset disp\n"); @@ -409,15 +436,33 @@ dopeers( NTOHL_FP(&(plist->offset), &tempts); ntp_poll = 1<ppoll, plist->hpoll, NTP_MAXPOLL), NTP_MINPOLL); - (void) fprintf(fp, - "%c%-15.15s %-15.15s %2d %4d %3o %7.7s %9.9s %7.7s\n", - c, nntohost(plist->srcadr), - numtoa(plist->dstadr), - plist->stratum, ntp_poll, plist->reach, - fptoa(NTOHS_FP(plist->delay), 5), - lfptoa(&tempts, 6), - ufptoa(NTOHS_FP(plist->dispersion), 5)); - + memset((char *)&dstadr, 0, sizeof(dstadr)); + memset((char *)&srcadr, 0, sizeof(srcadr)); + if (plist->v6_flag != 0) { + GET_INADDR6(dstadr) = plist->dstadr6; + GET_INADDR6(srcadr) = plist->srcadr6; + srcadr.ss_family = AF_INET6; + dstadr.ss_family = AF_INET6; + } else { + GET_INADDR(dstadr) = plist->dstadr; + GET_INADDR(srcadr) = plist->srcadr; + srcadr.ss_family = AF_INET; + dstadr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + srcadr.ss_len = SOCKLEN(&srcadr); + dstadr.ss_len = SOCKLEN(&dstadr); +#endif + if ((pcmd->nargs == 0) || + ((pcmd->argval->ival == 6) && (plist->v6_flag != 0)) || + ((pcmd->argval->ival == 4) && (plist->v6_flag == 0))) + (void) fprintf(fp, + "%c%-15.15s %-15.15s %2d %4d %3o %7.7s %9.9s %7.7s\n", + c, nntohost(&srcadr), stoa(&dstadr), + plist->stratum, ntp_poll, plist->reach, + fptoa(NTOHS_FP(plist->delay), 5), + lfptoa(&tempts, 6), + ufptoa(NTOHS_FP(plist->dispersion), 5)); plist++; items--; } @@ -452,10 +497,27 @@ printpeer( register int i; const char *str; l_fp tempts; - + struct sockaddr_storage srcadr, dstadr; + + memset((char *)&srcadr, 0, sizeof(srcadr)); + memset((char *)&dstadr, 0, sizeof(dstadr)); + if (pp->v6_flag != 0) { + srcadr.ss_family = AF_INET6; + dstadr.ss_family = AF_INET6; + GET_INADDR6(srcadr) = pp->srcadr6; + GET_INADDR6(dstadr) = pp->dstadr6; + } else { + srcadr.ss_family = AF_INET; + dstadr.ss_family = AF_INET; + GET_INADDR(srcadr) = pp->srcadr; + GET_INADDR(dstadr) = pp->dstadr; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + srcadr.ss_len = SOCKLEN(&srcadr); + dstadr.ss_len = SOCKLEN(&dstadr); +#endif (void) fprintf(fp, "remote %s, local %s\n", - numtoa(pp->srcadr), numtoa(pp->dstadr)); - + stoa(&srcadr), stoa(&dstadr)); (void) fprintf(fp, "hmode %s, pmode %s, stratum %d, precision %d\n", modetoa(pp->hmode), modetoa(pp->pmode), pp->stratum, pp->precision); @@ -472,8 +534,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); @@ -573,29 +635,55 @@ showpeer( { struct info_peer *pp; /* 4 is the maximum number of peers which will fit in a packet */ - struct info_peer_list plist[min(MAXARGS, 4)]; + struct info_peer_list *pl, plist[min(MAXARGS, 4)]; int qitems; int items; int itemsize; int res; + int sendsize; - for (qitems = 0; qitems < min(pcmd->nargs, 4); qitems++) { - plist[qitems].address = pcmd->argval[qitems].netnum; - plist[qitems].port = server_entry->s_port; - plist[qitems].hmode = plist[qitems].flags = 0; +again: + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct info_peer_list); + else + sendsize = v4sizeof(struct info_peer_list); + + for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 4); qitems++) { + if (pcmd->argval[qitems].netnum.ss_family == AF_INET) { + pl->addr = GET_INADDR(pcmd->argval[qitems].netnum); + if (impl_ver == IMPL_XNTPD) + pl->v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + pl->addr6 = GET_INADDR6(pcmd->argval[qitems].netnum); + pl->v6_flag = 1; + } + pl->port = (u_short)s_port; + pl->hmode = pl->flags = 0; + pl = (struct info_peer_list *)((char *)pl + sendsize); } - res = doquery(IMPL_XNTPD, REQ_PEER_INFO, 0, qitems, - sizeof(struct info_peer_list), (char *)plist, &items, - &itemsize, (void *)&pp, 0); + res = doquery(impl_ver, REQ_PEER_INFO, 0, qitems, + sendsize, (char *)plist, &items, + &itemsize, (void *)&pp, 0, sizeof(struct info_peer)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_peer))) + if (!checkitemsize(itemsize, sizeof(struct info_peer)) && + !checkitemsize(itemsize, v4sizeof(struct info_peer))) return; while (items-- > 0) { @@ -618,36 +706,82 @@ peerstats( { struct info_peer_stats *pp; /* 4 is the maximum number of peers which will fit in a packet */ - struct info_peer_list plist[min(MAXARGS, 4)]; + struct info_peer_list *pl, plist[min(MAXARGS, 4)]; + struct sockaddr_storage src, dst; int qitems; int items; int itemsize; int res; + int sendsize; - for (qitems = 0; qitems < min(pcmd->nargs, 4); qitems++) { - plist[qitems].address = pcmd->argval[qitems].netnum; - plist[qitems].port = server_entry->s_port; - plist[qitems].hmode = plist[qitems].flags = 0; +again: + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct info_peer_list); + else + sendsize = v4sizeof(struct info_peer_list); + + memset((char *)plist, 0, sizeof(struct info_peer_list) * min(MAXARGS, 4)); + for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 4); qitems++) { + if (pcmd->argval[qitems].netnum.ss_family == AF_INET) { + pl->addr = GET_INADDR(pcmd->argval[qitems].netnum); + if (impl_ver == IMPL_XNTPD) + pl->v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + pl->addr6 = GET_INADDR6(pcmd->argval[qitems].netnum); + pl->v6_flag = 1; + } + pl->port = (u_short)s_port; + pl->hmode = plist[qitems].flags = 0; + pl = (struct info_peer_list *)((char *)pl + sendsize); } - res = doquery(IMPL_XNTPD, REQ_PEER_STATS, 0, qitems, - sizeof(struct info_peer_list), (char *)plist, &items, - &itemsize, (void *)&pp, 0); + res = doquery(impl_ver, REQ_PEER_STATS, 0, qitems, + sendsize, (char *)plist, &items, + &itemsize, (void *)&pp, 0, + sizeof(struct info_peer_stats)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_peer_stats))) + if (!checkitemsize(itemsize, sizeof(struct info_peer_stats)) && + !checkitemsize(itemsize, v4sizeof(struct info_peer_stats))) return; while (items-- > 0) { + memset((char *)&src, 0, sizeof(src)); + memset((char *)&dst, 0, sizeof(dst)); + if (pp->v6_flag != 0) { + GET_INADDR6(src) = pp->srcadr6; + GET_INADDR6(dst) = pp->dstadr6; + src.ss_family = AF_INET6; + dst.ss_family = AF_INET6; + } else { + GET_INADDR(src) = pp->srcadr; + GET_INADDR(dst) = pp->dstadr; + src.ss_family = AF_INET; + dst.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + src.ss_len = SOCKLEN(&src); + dst.ss_len = SOCKLEN(&dst); +#endif (void) fprintf(fp, "remote host: %s\n", - nntohost(pp->srcadr)); + nntohost(&src)); (void) fprintf(fp, "local interface: %s\n", - numtoa(pp->dstadr)); + stoa(&dst)); (void) fprintf(fp, "time last received: %lds\n", (long)ntohl(pp->timereceived)); (void) fprintf(fp, "time until next send: %lds\n", @@ -704,9 +838,16 @@ loopinfo( } } - res = doquery(IMPL_XNTPD, REQ_LOOP_INFO, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&il, 0); +again: + res = doquery(impl_ver, REQ_LOOP_INFO, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&il, 0, + sizeof(struct info_loop)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -754,24 +895,44 @@ sysinfo( ) { struct info_sys *is; + struct sockaddr_storage peeraddr; int items; int itemsize; int res; l_fp tempts; - res = doquery(IMPL_XNTPD, REQ_SYS_INFO, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&is, 0); +again: + res = doquery(impl_ver, REQ_SYS_INFO, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&is, 0, + sizeof(struct info_sys)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!check1item(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_sys))) + if (!checkitemsize(itemsize, sizeof(struct info_sys)) && + !checkitemsize(itemsize, v4sizeof(struct info_sys))) return; - (void) fprintf(fp, "system peer: %s\n", nntohost(is->peer)); + memset((char *)&peeraddr, 0, sizeof(peeraddr)); + if (is->v6_flag != 0) { + GET_INADDR6(peeraddr) = is->peer6; + peeraddr.ss_family = AF_INET6; + } else { + GET_INADDR(peeraddr) = is->peer; + peeraddr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + peeraddr.ss_len = SOCKLEN(&peeraddr); +#endif + (void) fprintf(fp, "system peer: %s\n", nntohost(&peeraddr)); (void) fprintf(fp, "system peer mode: %s\n", modetoa(is->peer_mode)); (void) fprintf(fp, "leap indicator: %c%c\n", is->leap & 0x2 ? '1' : '0', @@ -789,7 +950,7 @@ sysinfo( (void) fprintf(fp, "system flags: "); if ((is->flags & (INFO_FLAG_BCLIENT | INFO_FLAG_AUTHENABLE | - INFO_FLAG_NTP | INFO_FLAG_KERNEL| INFO_FLAG_PLL_SYNC | + INFO_FLAG_NTP | INFO_FLAG_KERNEL| INFO_FLAG_CAL | INFO_FLAG_PPS_SYNC | INFO_FLAG_MONITOR | INFO_FLAG_FILEGEN)) == 0) { (void) fprintf(fp, "none\n"); } else { @@ -805,10 +966,10 @@ sysinfo( (void) fprintf(fp, "kernel "); if (is->flags & INFO_FLAG_FILEGEN) (void) fprintf(fp, "stats "); - if (is->flags & INFO_FLAG_PLL_SYNC) - (void) fprintf(fp, "kernel_sync "); + if (is->flags & INFO_FLAG_CAL) + (void) fprintf(fp, "calibrate "); if (is->flags & INFO_FLAG_PPS_SYNC) - (void) fprintf(fp, "pps_sync "); + (void) fprintf(fp, "pps "); (void) fprintf(fp, "\n"); } (void) fprintf(fp, "jitter: %s s\n", @@ -837,9 +998,16 @@ sysstats( int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_SYS_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&ss, 0); +again: + res = doquery(impl_ver, REQ_SYS_STATS, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&ss, 0, + sizeof(struct info_sys_stats)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -852,30 +1020,31 @@ sysstats( checkitemsize(itemsize, sizeof(struct info_sys_stats)); return; } - - (void) fprintf(fp, "system uptime: %ld\n", - (u_long)ntohl(ss->timeup)); - (void) fprintf(fp, "time since reset: %ld\n", - (u_long)ntohl(ss->timereset)); - (void) fprintf(fp, "bad stratum in packet: %ld\n", - (u_long)ntohl(ss->badstratum)); - (void) fprintf(fp, "old version packets: %ld\n", - (u_long)ntohl(ss->oldversionpkt)); - (void) fprintf(fp, "new version packets: %ld\n", - (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", - (u_long)ntohl(ss->badlength)); - (void) fprintf(fp, "packets processed: %ld\n", - (u_long)ntohl(ss->processed)); - (void) fprintf(fp, "bad authentication: %ld\n", - (u_long)ntohl(ss->badauth)); + fprintf(fp, "time since restart: %ld\n", + (u_long)ntohl(ss->timeup)); + fprintf(fp, "time since reset: %ld\n", + (u_long)ntohl(ss->timereset)); + fprintf(fp, "packets received: %ld\n", + (u_long)ntohl(ss->received)); + fprintf(fp, "packets processed: %ld\n", + (u_long)ntohl(ss->processed)); + fprintf(fp, "current version: %ld\n", + (u_long)ntohl(ss->newversionpkt)); + fprintf(fp, "previous version: %ld\n", + (u_long)ntohl(ss->oldversionpkt)); + fprintf(fp, "bad version: %ld\n", + (u_long)ntohl(ss->unknownversion)); + fprintf(fp, "access denied: %ld\n", + (u_long)ntohl(ss->denied)); + fprintf(fp, "bad length or format: %ld\n", + (u_long)ntohl(ss->badlength)); + fprintf(fp, "bad authentication: %ld\n", + (u_long)ntohl(ss->badauth)); if (itemsize != sizeof(struct info_sys_stats)) return; - (void) fprintf(fp, "limitation rejects: %ld\n", - (u_long)ntohl(ss->limitrejected)); + fprintf(fp, "rate exceeded: %ld\n", + (u_long)ntohl(ss->limitrejected)); } @@ -895,9 +1064,16 @@ iostats( int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_IO_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&io, 0); +again: + res = doquery(impl_ver, REQ_IO_STATS, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&io, 0, + sizeof(struct info_io_stats)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -950,9 +1126,16 @@ memstats( int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_MEM_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&mem, 0); +again: + res = doquery(impl_ver, REQ_MEM_STATS, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&mem, 0, + sizeof(struct info_mem_stats)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -1002,9 +1185,16 @@ timerstats( int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_TIMER_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&tim, 0); +again: + res = doquery(impl_ver, REQ_TIMER_STATS, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&tim, 0, + sizeof(struct info_timer_stats)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -1096,7 +1286,9 @@ doconfig( u_int flags; u_char cmode; int res; + int sendsize; +again: keyid = 0; version = NTP_OLDVERSION + 1; flags = 0; @@ -1104,6 +1296,11 @@ doconfig( cmode = 0; minpoll = NTP_MINDPOLL; + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct conf_peer); + else + sendsize = v4sizeof(struct conf_peer); + items = pcmd->nargs; if (refc) { @@ -1162,9 +1359,21 @@ doconfig( if (res) return; - memset((void *)&cpeer, 0, sizeof cpeer); + memset((void *)&cpeer, 0, sizeof(cpeer)); - cpeer.peeraddr = pcmd->argval[0].netnum; + if (pcmd->argval[0].netnum.ss_family == AF_INET) { + cpeer.peeraddr = GET_INADDR(pcmd->argval[0].netnum); + if (impl_ver == IMPL_XNTPD) + cpeer.v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + cpeer.peeraddr6 = GET_INADDR6(pcmd->argval[0].netnum); + cpeer.v6_flag = 1; + } cpeer.hmode = (u_char) mode; cpeer.keyid = keyid; cpeer.version = (u_char) version; @@ -1173,10 +1382,23 @@ doconfig( cpeer.flags = (u_char)flags; cpeer.ttl = cmode; - res = doquery(IMPL_XNTPD, REQ_CONFIG, 1, 1, - sizeof(struct conf_peer), (char *)&cpeer, &items, - &itemsize, &dummy, 0); + res = doquery(impl_ver, REQ_CONFIG, 1, 1, + sendsize, (char *)&cpeer, &items, + &itemsize, &dummy, 0, sizeof(struct conf_peer)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + + if (res == INFO_ERR_FMT) { + (void) fprintf(fp, + "***Retrying command with old conf_peer size\n"); + res = doquery(impl_ver, REQ_CONFIG, 1, 1, + sizeof(struct old_conf_peer), (char *)&cpeer, + &items, &itemsize, &dummy, 0, + sizeof(struct conf_peer)); + } if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -1193,21 +1415,47 @@ unconfig( ) { /* 8 is the maximum number of peers which will fit in a packet */ - struct conf_unpeer plist[min(MAXARGS, 8)]; + struct conf_unpeer *pl, plist[min(MAXARGS, 8)]; int qitems; int items; int itemsize; char *dummy; int res; + int sendsize; - for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++) { - plist[qitems].peeraddr = pcmd->argval[qitems].netnum; +again: + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct conf_unpeer); + else + sendsize = v4sizeof(struct conf_unpeer); + + for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 8); qitems++) { + if (pcmd->argval[0].netnum.ss_family == AF_INET) { + pl->peeraddr = GET_INADDR(pcmd->argval[qitems].netnum); + if (impl_ver == IMPL_XNTPD) + pl->v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + pl->peeraddr6 = + GET_INADDR6(pcmd->argval[qitems].netnum); + pl->v6_flag = 1; + } + pl = (struct conf_unpeer *)((char *)pl + sendsize); } - res = doquery(IMPL_XNTPD, REQ_UNCONFIG, 1, qitems, - sizeof(struct conf_unpeer), (char *)plist, &items, - &itemsize, &dummy, 0); + res = doquery(impl_ver, REQ_UNCONFIG, 1, qitems, + sendsize, (char *)plist, &items, + &itemsize, &dummy, 0, sizeof(struct conf_unpeer)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); } @@ -1260,20 +1508,24 @@ doset( res = 0; for (items = 0; items < pcmd->nargs; items++) { if (STREQ(pcmd->argval[items].string, "auth")) - sys.flags |= SYS_FLAG_AUTHENTICATE; + sys.flags |= SYS_FLAG_AUTH; else if (STREQ(pcmd->argval[items].string, "bclient")) - sys.flags |= SYS_FLAG_BCLIENT; - else if (STREQ(pcmd->argval[items].string, "monitor")) - sys.flags |= SYS_FLAG_MONITOR; - else if (STREQ(pcmd->argval[items].string, "ntp")) - sys.flags |= SYS_FLAG_NTP; + sys.flags |= SYS_FLAG_BCLIENT; + else if (STREQ(pcmd->argval[items].string, "calibrate")) + sys.flags |= SYS_FLAG_CAL; else if (STREQ(pcmd->argval[items].string, "kernel")) - sys.flags |= SYS_FLAG_KERNEL; + sys.flags |= SYS_FLAG_KERNEL; + else if (STREQ(pcmd->argval[items].string, "monitor")) + sys.flags |= SYS_FLAG_MONITOR; + else if (STREQ(pcmd->argval[items].string, "ntp")) + sys.flags |= SYS_FLAG_NTP; + else if (STREQ(pcmd->argval[items].string, "pps")) + sys.flags |= SYS_FLAG_PPS; else if (STREQ(pcmd->argval[items].string, "stats")) - sys.flags |= SYS_FLAG_FILEGEN; + sys.flags |= SYS_FLAG_FILEGEN; else { (void) fprintf(fp, "Unknown flag %s\n", - pcmd->argval[items].string); + pcmd->argval[items].string); res = 1; } } @@ -1281,10 +1533,16 @@ doset( if (res || sys.flags == 0) return; - res = doquery(IMPL_XNTPD, req, 1, 1, +again: + res = doquery(impl_ver, req, 1, 1, sizeof(struct conf_sys_flags), (char *)&sys, &items, - &itemsize, &dummy, 0); + &itemsize, &dummy, 0, sizeof(struct conf_sys_flags)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); } @@ -1308,6 +1566,10 @@ static struct resflags resflags[] = { { "notrap", RES_NOTRAP }, { "lptrap", RES_LPTRAP }, { "limited", RES_LIMITED }, + { "version", RES_VERSION }, + { "kod", RES_DEMOBILIZE }, + { "timeout", RES_TIMEOUT }, + { "", 0 } }; @@ -1329,9 +1591,12 @@ reslist( ) { struct info_restrict *rl; + struct sockaddr_storage resaddr; + struct sockaddr_storage maskaddr; int items; int itemsize; int res; + int skip; char *addr; char *mask; struct resflags *rf; @@ -1341,28 +1606,62 @@ reslist( char flagstr[300]; static const char *comma = ", "; - res = doquery(IMPL_XNTPD, REQ_GET_RESTRICT, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&rl, 0); +again: + res = doquery(impl_ver, REQ_GET_RESTRICT, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&rl, 0, + sizeof(struct info_restrict)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_restrict))) + if (!checkitemsize(itemsize, sizeof(struct info_restrict)) && + !checkitemsize(itemsize, v4sizeof(struct info_restrict))) return; (void) fprintf(fp, - " address mask count flags\n"); + " address mask count flags\n"); (void) fprintf(fp, "=====================================================================\n"); + while (items > 0) { - if ((rl->mask == (u_int32)0xffffffff)) - addr = nntohost(rl->addr); - else - addr = numtoa( rl->addr ); - mask = numtoa(rl->mask); + memset((char *)&resaddr, 0, sizeof(resaddr)); + memset((char *)&maskaddr, 0, sizeof(maskaddr)); + if (rl->v6_flag != 0) { + GET_INADDR6(resaddr) = rl->addr6; + GET_INADDR6(maskaddr) = rl->mask6; + resaddr.ss_family = AF_INET6; + maskaddr.ss_family = AF_INET6; +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + resaddr.ss_len = SOCKLEN(&resaddr); +#endif + addr = nntohost(&resaddr); + } else { + GET_INADDR(resaddr) = rl->addr; + GET_INADDR(maskaddr) = rl->mask; + resaddr.ss_family = AF_INET; + maskaddr.ss_family = AF_INET; +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + resaddr.ss_len = SOCKLEN(&resaddr); +#endif + if ((rl->mask == (u_int32)0xffffffff)) + addr = nntohost(&resaddr); + else + addr = stoa(&resaddr); + } + mask = stoa(&maskaddr); + skip = 1; + if ((pcmd->nargs == 0) || + ((pcmd->argval->ival == 6) && (rl->v6_flag != 0)) || + ((pcmd->argval->ival == 4) && (rl->v6_flag == 0))) + skip = 0; count = ntohl(rl->count); flags = ntohs(rl->flags); mflags = ntohs(rl->mflags); @@ -1394,8 +1693,9 @@ reslist( if (flagstr[0] == '\0') (void) strcpy(flagstr, "none"); - (void) fprintf(fp, "%-15.15s %-15.15s %9ld %s\n", - addr, mask, (u_long)count, flagstr); + if (!skip) + (void) fprintf(fp, "%-15.15s %-15.15s %9ld %s\n", + addr, mask, (u_long)count, flagstr); rl++; items--; } @@ -1461,9 +1761,35 @@ do_restrict( int i; int res; int err; + int sendsize; - cres.addr = pcmd->argval[0].netnum; - cres.mask = pcmd->argval[1].netnum; + /* Initialize cres */ + cres.addr = 0; + cres.mask = 0; + cres.flags = 0; + cres.mflags = 0; + cres.v6_flag = 0; + +again: + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct conf_restrict); + else + sendsize = v4sizeof(struct conf_restrict); + + if (pcmd->argval[0].netnum.ss_family == AF_INET) { + cres.addr = GET_INADDR(pcmd->argval[0].netnum); + cres.mask = GET_INADDR(pcmd->argval[1].netnum); + if (impl_ver == IMPL_XNTPD) + cres.v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + cres.addr6 = GET_INADDR6(pcmd->argval[0].netnum); + cres.v6_flag = 1; + } cres.flags = 0; cres.mflags = 0; err = 0; @@ -1496,30 +1822,39 @@ do_restrict( * Make sure mask for default address is zero. Otherwise, * make sure mask bits are contiguous. */ - if (cres.addr == 0) { - cres.mask = 0; - } else { - num = ntohl(cres.mask); - for (bit = 0x80000000; bit != 0; bit >>= 1) - if ((num & bit) == 0) - break; - for ( ; bit != 0; bit >>= 1) - if ((num & bit) != 0) - break; - if (bit != 0) { - (void) fprintf(fp, "Invalid mask %s\n", - numtoa(cres.mask)); - err++; + if (pcmd->argval[0].netnum.ss_family == AF_INET) { + if (cres.addr == 0) { + cres.mask = 0; + } else { + num = ntohl(cres.mask); + for (bit = 0x80000000; bit != 0; bit >>= 1) + if ((num & bit) == 0) + break; + for ( ; bit != 0; bit >>= 1) + if ((num & bit) != 0) + break; + if (bit != 0) { + (void) fprintf(fp, "Invalid mask %s\n", + numtoa(cres.mask)); + err++; + } } + } else { + /* XXX IPv6 sanity checking stuff */ } if (err) return; - res = doquery(IMPL_XNTPD, req_code, 1, 1, - sizeof(struct conf_restrict), (char *)&cres, &items, - &itemsize, &dummy, 0); + res = doquery(impl_ver, req_code, 1, 1, + sendsize, (char *)&cres, &items, + &itemsize, &dummy, 0, sizeof(struct conf_restrict)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -1537,7 +1872,8 @@ monlist( ) { char *struct_star; - struct in_addr addr; + struct sockaddr_storage addr; + struct sockaddr_storage dstadr; int items; int itemsize; int res; @@ -1547,15 +1883,23 @@ monlist( version = pcmd->argval[0].ival; } - res = doquery(IMPL_XNTPD, +again: + res = doquery(impl_ver, (version == 1 || version == -1) ? REQ_MON_GETLIST_1 : REQ_MON_GETLIST, 0, 0, 0, (char *)NULL, &items, &itemsize, &struct_star, - (version < 0) ? (1 << INFO_ERR_REQ) : 0); + (version < 0) ? (1 << INFO_ERR_REQ) : 0, + sizeof(struct info_monitor_1)); + + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } if (res == INFO_ERR_REQ && version < 0) - res = doquery(IMPL_XNTPD, REQ_MON_GETLIST, 0, 0, 0, (char *)NULL, - &items, &itemsize, &struct_star, 0); + res = doquery(impl_ver, REQ_MON_GETLIST, 0, 0, 0, (char *)NULL, + &items, &itemsize, &struct_star, 0, + sizeof(struct info_monitor)); if (res != 0 && items == 0) return; @@ -1563,48 +1907,82 @@ monlist( if (!checkitems(items, fp)) return; - if (itemsize == sizeof(struct info_monitor_1)) { + if (itemsize == sizeof(struct info_monitor_1) || + itemsize == v4sizeof(struct info_monitor_1)) { struct info_monitor_1 *ml = (struct info_monitor_1 *) struct_star; (void) fprintf(fp, - "remote address port local address count m ver drop last first\n"); + "remote address port local address count m ver code avgint lstint\n"); (void) fprintf(fp, "===============================================================================\n"); while (items > 0) { - addr.s_addr = ml->daddr; - (void) fprintf(fp, - "%-22.22s %5d %-15s %8ld %1d %1d %6lu %6lu %7lu\n", - nntohost(ml->addr), - ntohs(ml->port), - inet_ntoa(addr), - (u_long)ntohl(ml->count), - ml->mode, - ml->version, - (u_long)ntohl(ml->lastdrop), - (u_long)ntohl(ml->lasttime), - (u_long)ntohl(ml->firsttime)); + memset((char *)&addr, 0, sizeof(addr)); + memset((char *)&dstadr, 0, sizeof(dstadr)); + if (ml->v6_flag != 0) { + GET_INADDR6(addr) = ml->addr6; + addr.ss_family = AF_INET6; + GET_INADDR6(dstadr) = ml->daddr6; + dstadr.ss_family = AF_INET6; + } else { + GET_INADDR(addr) = ml->addr; + addr.ss_family = AF_INET; + GET_INADDR(dstadr) = ml->daddr; + dstadr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + addr.ss_len = SOCKLEN(&addr); + dstadr.ss_len = SOCKLEN(&dstadr); +#endif + if ((pcmd->nargs == 0) || + ((pcmd->argval->ival == 6) && (ml->v6_flag != 0)) || + ((pcmd->argval->ival == 4) && (ml->v6_flag == 0))) + (void) fprintf(fp, + "%-22.22s %5d %-15s %8ld %1d %1d %6lx %6lu %7lu\n", + nntohost(&addr), + ntohs(ml->port), + stoa(&dstadr), + (u_long)ntohl(ml->count), + ml->mode, + ml->version, + (u_long)ntohl(ml->lastdrop), + (u_long)ntohl(ml->lasttime), + (u_long)ntohl(ml->firsttime)); ml++; items--; } - } else if (itemsize == sizeof(struct info_monitor)) { + } else if (itemsize == sizeof(struct info_monitor) || + itemsize == v4sizeof(struct info_monitor)) { struct info_monitor *ml = (struct info_monitor *) struct_star; (void) fprintf(fp, - " address port count mode ver lastdrop lasttime firsttime\n"); + " address port count mode ver code avgint lstint\n"); (void) fprintf(fp, "===============================================================================\n"); while (items > 0) { - addr.s_addr = ml->lastdrop; - (void) fprintf(fp, - "%-25.25s %5d %9ld %4d %2d %9lu %9lu %9lu\n", - nntohost(ml->addr), - ntohs(ml->port), - (u_long)ntohl(ml->count), - ml->mode, - ml->version, - (u_long)ntohl(ml->lastdrop), - (u_long)ntohl(ml->lasttime), - (u_long)ntohl(ml->firsttime)); + memset((char *)&dstadr, 0, sizeof(dstadr)); + if (ml->v6_flag != 0) { + GET_INADDR6(dstadr) = ml->addr6; + dstadr.ss_family = AF_INET6; + } else { + GET_INADDR(dstadr) = ml->addr; + dstadr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + dstadr.ss_len = SOCKLEN(&dstadr); +#endif + if ((pcmd->nargs == 0) || + ((pcmd->argval->ival == 6) && (ml->v6_flag != 0)) || + ((pcmd->argval->ival == 4) && (ml->v6_flag == 0))) + (void) fprintf(fp, + "%-25.25s %5d %9ld %4d %2d %9lx %9lu %9lu\n", + nntohost(&dstadr), + ntohs(ml->port), + (u_long)ntohl(ml->count), + ml->mode, + ml->version, + (u_long)ntohl(ml->lastdrop), + (u_long)ntohl(ml->lasttime), + (u_long)ntohl(ml->firsttime)); ml++; items--; } @@ -1615,8 +1993,19 @@ monlist( (void) fprintf(fp, "======================================================================\n"); while (items > 0) { + memset((char *)&dstadr, 0, sizeof(dstadr)); + if (oml->v6_flag != 0) { + GET_INADDR6(dstadr) = oml->addr6; + dstadr.ss_family = AF_INET6; + } else { + GET_INADDR(dstadr) = oml->addr; + dstadr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + dstadr.ss_len = SOCKLEN(&dstadr); +#endif (void) fprintf(fp, "%-20.20s %5d %9ld %4d %3d %9lu %9lu\n", - nntohost(oml->addr), + nntohost(&dstadr), ntohs(oml->port), (u_long)ntohl(oml->count), oml->mode, @@ -1687,10 +2076,16 @@ reset( return; } - res = doquery(IMPL_XNTPD, REQ_RESET_STATS, 1, 1, +again: + res = doquery(impl_ver, REQ_RESET_STATS, 1, 1, sizeof(struct reset_flags), (char *)&rflags, &items, - &itemsize, &dummy, 0); + &itemsize, &dummy, 0, sizeof(struct reset_flags)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -1708,21 +2103,47 @@ preset( ) { /* 8 is the maximum number of peers which will fit in a packet */ - struct conf_unpeer plist[min(MAXARGS, 8)]; + struct conf_unpeer *pl, plist[min(MAXARGS, 8)]; int qitems; int items; int itemsize; char *dummy; int res; + int sendsize; - for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++) { - plist[qitems].peeraddr = pcmd->argval[qitems].netnum; +again: + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct conf_unpeer); + else + sendsize = v4sizeof(struct conf_unpeer); + + for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 8); qitems++) { + if (pcmd->argval[qitems].netnum.ss_family == AF_INET) { + pl->peeraddr = GET_INADDR(pcmd->argval[qitems].netnum); + if (impl_ver == IMPL_XNTPD) + pl->v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + pl->peeraddr6 = + GET_INADDR6(pcmd->argval[qitems].netnum); + pl->v6_flag = 1; + } + pl = (struct conf_unpeer *)((char *)pl + sendsize); } - res = doquery(IMPL_XNTPD, REQ_RESET_PEER, 1, qitems, - sizeof(struct conf_unpeer), (char *)plist, &items, - &itemsize, &dummy, 0); + res = doquery(impl_ver, REQ_RESET_PEER, 1, qitems, + sendsize, (char *)plist, &items, + &itemsize, &dummy, 0, sizeof(struct conf_unpeer)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); } @@ -1743,9 +2164,15 @@ readkeys( char *dummy; int res; - res = doquery(IMPL_XNTPD, REQ_REREAD_KEYS, 1, 0, 0, (char *)0, - &items, &itemsize, &dummy, 0); +again: + res = doquery(impl_ver, REQ_REREAD_KEYS, 1, 0, 0, (char *)0, + &items, &itemsize, &dummy, 0, sizeof(dummy)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -1801,9 +2228,16 @@ do_trustkey( keyids[ritems++] = pcmd->argval[i].uval; } - res = doquery(IMPL_XNTPD, req, 1, ritems, sizeof(u_long), - (char *)keyids, &items, &itemsize, &dummy, 0); +again: + res = doquery(impl_ver, req, 1, ritems, sizeof(u_long), + (char *)keyids, &items, &itemsize, &dummy, 0, + sizeof(dummy)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -1826,9 +2260,16 @@ authinfo( int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_AUTHINFO, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&ia, 0); +again: + res = doquery(impl_ver, REQ_AUTHINFO, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&ia, 0, + sizeof(struct info_auth)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -1872,32 +2313,58 @@ traps( { int i; struct info_trap *it; + struct sockaddr_storage trap_addr, local_addr; int items; int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_TRAPS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&it, 0); +again: + res = doquery(impl_ver, REQ_TRAPS, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&it, 0, + sizeof(struct info_trap)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_trap))) + if (!checkitemsize(itemsize, sizeof(struct info_trap)) && + !checkitemsize(itemsize, v4sizeof(struct info_trap))) return; for (i = 0; i < items; i++ ) { if (i != 0) (void) fprintf(fp, "\n"); + memset((char *)&trap_addr, 0, sizeof(trap_addr)); + memset((char *)&local_addr, 0, sizeof(local_addr)); + if (it->v6_flag != 0) { + GET_INADDR6(trap_addr) = it->trap_address6; + GET_INADDR6(local_addr) = it->local_address6; + trap_addr.ss_family = AF_INET6; + local_addr.ss_family = AF_INET6; + } else { + GET_INADDR(trap_addr) = it->trap_address; + GET_INADDR(local_addr) = it->local_address; + trap_addr.ss_family = AF_INET; + local_addr.ss_family = AF_INET; + } +#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR + trap_addr.ss_len = SOCKLEN(&trap_addr); + local_addr.ss_len = SOCKLEN(&local_addr); +#endif (void) fprintf(fp, "address %s, port %d\n", - numtoa(it->trap_address), ntohs(it->trap_port)); + stoa(&trap_addr), + ntohs(it->trap_port)); (void) fprintf(fp, "interface: %s, ", - (it->local_address == 0) - ? "wildcard" - : numtoa(it->local_address)); - + (it->local_address == 0) + ? "wildcard" + : stoa(&local_addr)); if (ntohl(it->flags) & TRAP_CONFIGURED) (void) fprintf(fp, "configured\n"); else if (ntohl(it->flags) & TRAP_NONPRIO) @@ -1956,8 +2423,27 @@ do_addclr_trap( int itemsize; char *dummy; int res; + int sendsize; - ctrap.trap_address = pcmd->argval[0].netnum; +again: + if (impl_ver == IMPL_XNTPD) + sendsize = sizeof(struct conf_trap); + else + sendsize = v4sizeof(struct conf_trap); + + if (pcmd->argval[0].netnum.ss_family == AF_INET) { + ctrap.trap_address = GET_INADDR(pcmd->argval[0].netnum); + if (impl_ver == IMPL_XNTPD) + ctrap.v6_flag = 0; + } else { + if (impl_ver == IMPL_XNTPD_OLD) { + fprintf(stderr, + "***Server doesn't understand IPv6 addresses\n"); + return; + } + ctrap.trap_address6 = GET_INADDR6(pcmd->argval[0].netnum); + ctrap.v6_flag = 1; + } ctrap.local_address = 0; ctrap.trap_port = htons(TRAPPORT); ctrap.unused = 0; @@ -1965,13 +2451,29 @@ do_addclr_trap( if (pcmd->nargs > 1) { ctrap.trap_port = htons((u_short)(pcmd->argval[1].uval & 0xffff)); - if (pcmd->nargs > 2) - ctrap.local_address = pcmd->argval[2].netnum; + if (pcmd->nargs > 2) { + if (pcmd->argval[2].netnum.ss_family != + pcmd->argval[0].netnum.ss_family) { + fprintf(stderr, + "***Cannot mix IPv4 and IPv6 addresses\n"); + return; + } + if (pcmd->argval[2].netnum.ss_family == AF_INET) + ctrap.local_address = GET_INADDR(pcmd->argval[2].netnum); + else + ctrap.local_address6 = GET_INADDR6(pcmd->argval[2].netnum); + } } - res = doquery(IMPL_XNTPD, req, 1, 1, sizeof(struct conf_trap), - (char *)&ctrap, &items, &itemsize, &dummy, 0); + res = doquery(impl_ver, req, 1, 1, sendsize, + (char *)&ctrap, &items, &itemsize, &dummy, 0, + sizeof(struct conf_trap)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -2025,9 +2527,16 @@ do_changekey( key = htonl((u_int32)pcmd->argval[0].uval); - res = doquery(IMPL_XNTPD, req, 1, 1, sizeof(u_int32), - (char *)&key, &items, &itemsize, &dummy, 0); +again: + res = doquery(impl_ver, req, 1, 1, sizeof(u_int32), + (char *)&key, &items, &itemsize, &dummy, 0, + sizeof(dummy)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res == 0) (void) fprintf(fp, "done!\n"); return; @@ -2050,9 +2559,16 @@ ctlstats( int itemsize; int res; - res = doquery(IMPL_XNTPD, REQ_GET_CTLSTATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&ic, 0); +again: + res = doquery(impl_ver, REQ_GET_CTLSTATS, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&ic, 0, + sizeof(struct info_control)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -2116,12 +2632,18 @@ clockstat( u_long ltemp; for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++) - clist[qitems] = pcmd->argval[qitems].netnum; + clist[qitems] = GET_INADDR(pcmd->argval[qitems].netnum); - res = doquery(IMPL_XNTPD, REQ_GET_CLOCKINFO, 0, qitems, +again: + res = doquery(impl_ver, REQ_GET_CLOCKINFO, 0, qitems, sizeof(u_int32), (char *)clist, &items, - &itemsize, (void *)&cl, 0); + &itemsize, (void *)&cl, 0, sizeof(struct info_clock)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -2200,7 +2722,7 @@ fudge( err = 0; memset((char *)&fudgedata, 0, sizeof fudgedata); - fudgedata.clockadr = pcmd->argval[0].netnum; + fudgedata.clockadr = GET_INADDR(pcmd->argval[0].netnum); if (STREQ(pcmd->argval[1].string, "time1")) { fudgedata.which = htonl(FUDGE_TIME1); @@ -2244,10 +2766,15 @@ fudge( return; } - - res = doquery(IMPL_XNTPD, REQ_SET_CLKFUDGE, 1, 1, +again: + res = doquery(impl_ver, REQ_SET_CLKFUDGE, 1, 1, sizeof(struct conf_fudge), (char *)&fudgedata, &items, - &itemsize, &dummy, 0); + &itemsize, &dummy, 0, sizeof(dummy)); + + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } if (res == 0) (void) fprintf(fp, "done!\n"); @@ -2278,12 +2805,18 @@ clkbug( l_fp ts; for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++) - clist[qitems] = pcmd->argval[qitems].netnum; + clist[qitems] = GET_INADDR(pcmd->argval[qitems].netnum); - res = doquery(IMPL_XNTPD, REQ_GET_CLKBUGINFO, 0, qitems, +again: + res = doquery(impl_ver, REQ_GET_CLKBUGINFO, 0, qitems, sizeof(u_int32), (char *)clist, &items, - &itemsize, (void *)&cl, 0); + &itemsize, (void *)&cl, 0, sizeof(struct info_clkbug)); + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; @@ -2362,8 +2895,16 @@ kerninfo( unsigned status; double tscale = 1e-6; - res = doquery(IMPL_XNTPD, REQ_GET_KERNEL, 0, 0, 0, (char *)NULL, - &items, &itemsize, (void *)&ik, 0); +again: + res = doquery(impl_ver, REQ_GET_KERNEL, 0, 0, 0, (char *)NULL, + &items, &itemsize, (void *)&ik, 0, + sizeof(struct info_kernel)); + + if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { + impl_ver = IMPL_XNTPD_OLD; + goto again; + } + if (res != 0 && items == 0) return; if (!check1item(items, fp)) diff --git a/dist/ntp/ntpq/ntpq.c b/dist/ntp/ntpq/ntpq.c index 9f1825ec4ea5..5cffd80ac05e 100644 --- a/dist/ntp/ntpq/ntpq.c +++ b/dist/ntp/ntpq/ntpq.c @@ -1,9 +1,22 @@ -/* $NetBSD: ntpq.c,v 1.5 2002/12/06 15:13:56 thorpej Exp $ */ +/* $NetBSD: ntpq.c,v 1.6 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpq - query an NTP server using mode 6 commands */ + #include + +#include "ntpq.h" +#include "ntp_unixtime.h" +#include "ntp_calendar.h" +#include "ntp_io.h" +#include "ntp_select.h" +#include "ntp_stdlib.h" +/* Don't include ISC's version of IPv6 variables and structures */ +#define ISC_IPV6_H 1 +#include "isc/net.h" +#include "isc/result.h" + #include #include #include @@ -16,12 +29,10 @@ #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" +#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) +# include +# include +#endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */ #ifdef SYS_VXWORKS /* vxWorks needs mode flag -casey*/ @@ -40,12 +51,11 @@ const char *prompt = "ntpq> "; /* prompt to ask him about */ /* * Keyid used for authenticated requests. Obtained on the fly. */ -u_long info_auth_keyid = NTP_MAXKEY; +u_long info_auth_keyid = 0; /* - * Type of key md5 or des + * Type of key md5 */ -#define KEY_TYPE_DES 3 #define KEY_TYPE_MD5 4 static int info_auth_keytype = KEY_TYPE_MD5; /* MD5 */ @@ -109,13 +119,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, "" } }; @@ -160,7 +172,7 @@ 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 */ /* * These are duplicate entries so that we can * process deviant version of the ntp protocol. @@ -201,14 +213,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*/ }; @@ -251,10 +264,8 @@ static void raw P((struct parse *, FILE *)); static void cooked P((struct parse *, FILE *)); static void authenticate P((struct parse *, FILE *)); static void ntpversion P((struct parse *, FILE *)); -static void warning P((const char *, ...)) - __attribute__((__format__(__printf__, 1, 2))); -static void error P((const char *, ...)) - __attribute__((__format__(__printf__, 1, 2))); +static void warning P((const char *, const char *, const char *)); +static void error P((const char *, const char *, const char *)); static u_long getkeyid P((const char *)); static void atoascii P((int, char *, char *)); static void makeascii P((int, char *, FILE *)); @@ -287,8 +298,8 @@ struct xcmd builtins[] = { { "delay", auth_delay, { OPT|INT, NO, NO, NO }, { "msec", "", "", "" }, "set the delay added to encryption time stamps" }, - { "host", host, { OPT|STR, NO, NO, NO }, - { "hostname", "", "", "" }, + { "host", host, { OPT|STR, OPT|STR, NO, NO }, + { "-4|-6", "hostname", "", "" }, "specify the host whose NTP server we talk to" }, { "poll", ntp_poll, { OPT|UINT, OPT|STR, NO, NO }, { "n", "verbose", "", "" }, @@ -340,7 +351,7 @@ struct xcmd builtins[] = { #define DEFTIMEOUT (5) /* 5 second time out */ #define DEFSTIMEOUT (2) /* 2 second time out after first */ #define DEFDELAY 0x51EB852 /* 20 milliseconds, l_fp fraction */ -#define DEFHOST "127.0.0.1" /* default host name */ +#define DEFHOST "localhost" /* default host name */ #define LENHOSTNAME 256 /* host name is 256 characters long */ #define MAXCMDS 100 /* maximum commands on cmd line */ #define MAXHOSTS 200 /* maximum hosts on cmd line */ @@ -360,13 +371,14 @@ char currenthost[LENHOSTNAME]; /* current host name */ struct sockaddr_in hostaddr = { 0 }; /* host address */ int showhostnames = 1; /* show host names by default */ -int sockfd; /* fd socket is opened on */ +int ai_fam_templ; /* address family */ +int ai_fam_default; /* default address family */ +SOCKET sockfd; /* fd socket is opened on */ int havehost = 0; /* set to 1 when host open */ +int s_port = 0; struct servent *server_entry = NULL; /* server entry for ntp */ #ifdef SYS_WINNT -WORD wVersionRequested; -WSADATA wsaData; DWORD NumberOfBytesWritten; HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */ @@ -491,9 +503,29 @@ ntpqmain( delay_time.l_ui = 0; delay_time.l_uf = DEFDELAY; +#ifdef SYS_WINNT + if (!Win32InitSockets()) + { + fprintf(stderr, "No useable winsock.dll:"); + exit(1); + } +#endif /* SYS_WINNT */ + + /* Check to see if we have IPv6. Otherwise force the -4 flag */ + if (isc_net_probeipv6() != ISC_R_SUCCESS) { + ai_fam_default = AF_INET; + } + progname = argv[0]; - while ((c = ntp_getopt(argc, argv, "c:dinp")) != EOF) + ai_fam_templ = ai_fam_default; + while ((c = ntp_getopt(argc, argv, "46c:dinp")) != EOF) switch (c) { + case '4': + ai_fam_templ = AF_INET; + break; + case '6': + ai_fam_templ = AF_INET6; + break; case 'c': ADDCMD(ntp_optarg); break; @@ -515,7 +547,7 @@ ntpqmain( } if (errflg) { (void) fprintf(stderr, - "usage: %s [-dinp] [-c cmd] host ...\n", + "usage: %s [-46dinp] [-c cmd] host ...\n", progname); exit(2); } @@ -536,14 +568,6 @@ ntpqmain( (void) signal_no_reset(SIGINT, abortcmd); #endif /* SYS_WINNT */ -#ifdef SYS_WINNT - wVersionRequested = MAKEWORD(1,1); - if (WSAStartup(wVersionRequested, &wsaData)) { - fprintf(stderr, "No useable winsock.dll"); - exit(1); - } -#endif /* SYS_WINNT */ - if (numcmds == 0) { (void) openhost(chosts[0]); getcmds(); @@ -572,29 +596,69 @@ openhost( const char *hname ) { - u_int32 netnum; char temphost[LENHOSTNAME]; + int a_info, i; + struct addrinfo hints, *ai = NULL; + register const char *cp; + char name[LENHOSTNAME]; + char service[5]; - if (server_entry == NULL) { - server_entry = getservbyname("ntp", "udp"); - if (server_entry == NULL) { -#ifdef VMS /* UCX getservbyname() doesn't work [yet], but we do know better */ - server_entry = (struct servent *) - malloc(sizeof(struct servent)); - server_entry->s_port = htons(NTP_PORT); -#else - (void) fprintf(stderr, "%s: ntp/udp: unknown service\n", - progname); - exit(1); -#endif /* VMS & UCX */ - } - if (debug > 2) - printf("Got ntp/udp service entry\n"); + /* + * We need to get by the [] if they were entered + */ + + cp = hname; + + if(*cp == '[') { + cp++; + for(i = 0; *cp != ']'; cp++, i++) + name[i] = *cp; + name[i] = '\0'; + hname = name; + } + + /* + * First try to resolve it as an ip address and if that fails, + * do a fullblown (dns) lookup. That way we only use the dns + * when it is needed and work around some implementations that + * will return an "IPv4-mapped IPv6 address" address if you + * give it an IPv4 address to lookup. + */ + strcpy(service, "ntp"); + memset((char *)&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = ai_fam_templ; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_NUMERICHOST; + + a_info = getaddrinfo(hname, service, &hints, &ai); + if (a_info == EAI_NONAME || a_info == EAI_NODATA) { + hints.ai_flags = AI_CANONNAME; +#ifdef AI_ADDRCONFIG + hints.ai_flags |= AI_ADDRCONFIG; +#endif + a_info = getaddrinfo(hname, service, &hints, &ai); + } + /* Some older implementations don't like AI_ADDRCONFIG. */ + if (a_info == EAI_BADFLAGS) { + hints.ai_flags = AI_CANONNAME; + a_info = getaddrinfo(hname, service, &hints, &ai); + } + if (a_info != 0) { + (void) fprintf(stderr, "%s\n", gai_strerror(a_info)); + return 0; + } + + if (ai->ai_canonname == NULL) { + strncpy(temphost, stoa((struct sockaddr_storage *)ai->ai_addr), + LENHOSTNAME); + temphost[LENHOSTNAME-1] = '\0'; + + } else { + strncpy(temphost, ai->ai_canonname, LENHOSTNAME); + temphost[LENHOSTNAME-1] = '\0'; } - if (!getnetnum(hname, &netnum, temphost)) - return 0; - if (debug > 2) printf("Opening host %s\n", temphost); @@ -606,13 +670,17 @@ openhost( } (void) strcpy(currenthost, temphost); - hostaddr.sin_family = AF_INET; -#ifndef SYS_VXWORKS - hostaddr.sin_port = server_entry->s_port; -#else - hostaddr.sin_port = htons(SERVER_PORT_NUM); -#endif - hostaddr.sin_addr.s_addr = netnum; + /* port maps to the same location in both families */ + s_port = ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port; +#ifdef SYS_VXWORKS + ((struct sockaddr_in6 *)&hostaddr)->sin6_port = htons(SERVER_PORT_NUM); + if (ai->ai_family == AF_INET) + *(struct sockaddr_in *)&hostaddr= + *((struct sockaddr_in *)ai->ai_addr); + else + *(struct sockaddr_in6 *)&hostaddr= + *((struct sockaddr_in6 *)ai->ai_addr); +#endif /* SYS_VXWORKS */ #ifdef SYS_WINNT { @@ -624,34 +692,34 @@ openhost( exit(1); } } - - - sockfd = socket(AF_INET, SOCK_DGRAM, 0); - if (sockfd == INVALID_SOCKET) { - error("socket"); - exit(1); - } -#else - sockfd = socket(AF_INET, SOCK_DGRAM, 0); - if (sockfd == -1) - error("socket"); #endif /* SYS_WINNT */ + sockfd = socket(ai->ai_family, SOCK_DGRAM, 0); + if (sockfd == INVALID_SOCKET) { + error("socket", "", ""); + } + #ifdef NEED_RCVBUF_SLOP # ifdef SO_RCVBUF { int rbufsize = DATASIZE + 2048; /* 2K for slop */ if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &rbufsize, sizeof(int)) == -1) - error("setsockopt"); + error("setsockopt", "", ""); } # endif #endif +#ifdef SYS_VXWORKS if (connect(sockfd, (struct sockaddr *)&hostaddr, sizeof(hostaddr)) == -1) - error("connect"); - +#else + if (connect(sockfd, (struct sockaddr *)ai->ai_addr, + ai->ai_addrlen) == -1) +#endif /* SYS_VXWORKS */ + error("connect", "", ""); + if (a_info == 0) + freeaddrinfo(ai); havehost = 1; return 1; } @@ -671,8 +739,8 @@ sendpkt( printf("Sending %d octets\n", xdatalen); - if (send(sockfd, xdata, xdatalen, 0) == -1) { - warning("write to %s failed", currenthost); + if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) { + warning("write to %s failed", currenthost, ""); return -1; } @@ -749,7 +817,7 @@ getresponse( #endif if (n == -1) { - warning("select fails"); + warning("select fails", "", ""); return -1; } if (n == 0) { @@ -783,7 +851,7 @@ getresponse( n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0); if (n == -1) { - warning("read"); + warning("read", "", ""); return -1; } @@ -1064,7 +1132,7 @@ sendrequest( * Fill in the packet */ qpkt.li_vn_mode = PKT_LI_VN_MODE(0, pktversion, MODE_CONTROL); - qpkt.r_m_e_op = (u_char)opcode & CTL_OP_MASK; + qpkt.r_m_e_op = (u_char)(opcode & CTL_OP_MASK); qpkt.sequence = htons(sequence); qpkt.status = 0; qpkt.associd = htons((u_short)associd); @@ -1110,23 +1178,22 @@ sendrequest( * Get the keyid and the password if we don't have one. */ if (info_auth_keyid == 0) { - maclen = getkeyid("Keyid: "); - if (maclen == 0) { + int u_keyid = getkeyid("Keyid: "); + if (u_keyid == 0 || u_keyid > NTP_MAXKEY) { (void) fprintf(stderr, "Invalid key identifier\n"); return 1; } + info_auth_keyid = u_keyid; } if (!authistrusted(info_auth_keyid)) { - pass = getpass((info_auth_keytype == KEY_TYPE_DES) - ? "DES Password: " : "MD5 Password: "); + pass = getpass("MD5 Password: "); if (*pass == '\0') { (void) fprintf(stderr, "Invalid password\n"); return (1); } } - info_auth_keyid = maclen; authusekey(info_auth_keyid, info_auth_keytype, (const u_char *)pass); authtrust(info_auth_keyid, 1); @@ -1259,25 +1326,36 @@ doquery( static void getcmds(void) { - char line[MAXLINE]; +#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) + char *line; - for (;;) { - if (interactive) { -#ifdef VMS /* work around a problem with mixing stdout & stderr */ - fputs("",stdout); + for (;;) { + if ((line = readline(interactive?prompt:"")) == NULL) return; + if (*line) add_history(line); + docmd(line); + free(line); + } +#else /* not (HAVE_LIBREADLINE || HAVE_LIBEDIT) */ + char line[MAXLINE]; + + for (;;) { + if (interactive) { +#ifdef VMS /* work around a problem with mixing stdout & stderr */ + fputs("",stdout); #endif - (void) fputs(prompt, stderr); - (void) fflush(stderr); - } + (void) fputs(prompt, stderr); + (void) fflush(stderr); + } - if (fgets(line, sizeof line, stdin) == NULL) - return; + if (fgets(line, sizeof line, stdin) == NULL) + return; - docmd(line); - } + docmd(line); + } +#endif /* not (HAVE_LIBREADLINE || HAVE_LIBEDIT) */ } - +#ifndef SYS_WINNT /* Under NT cannot handle SIGINT, WIN32 spawns a handler */ /* * abortcmd - catch interrupts and abort the current command */ @@ -1292,7 +1370,7 @@ abortcmd( (void) fflush(stderr); if (jump) longjmp(interrupt_buf, 1); } - +#endif /* SYS_WINNT */ /* * docmd - decode the command line and execute a command @@ -1505,7 +1583,7 @@ getarg( argp->string = str; break; case ADD: - if (!getnetnum(str, &(argp->netnum), (char *)0)) { + if (!getnetnum(str, &(argp->netnum), (char *)0, 0)) { return 0; } break; @@ -1522,10 +1600,14 @@ getarg( return 0; } if (isneg > numassoc) { - (void) fprintf(stderr, - "***Association for `%s' unknown (max &%d)\n", - str, numassoc); - return 0; + if (numassoc == 0) { + (void) fprintf(stderr, + "***Association for `%s' unknown (max &%d)\n", + str, numassoc); + return 0; + } else { + isneg = numassoc; + } } argp->uval = assoc_cache[isneg-1].assid; break; @@ -1557,6 +1639,17 @@ getarg( argp->ival = -argp->ival; } break; + case IP_VERSION: + if (!strcmp("-6", str)) + argp->ival = 6 ; + else if (!strcmp("-4", str)) + argp->ival = 4 ; + else { + (void) fprintf(stderr, + "***Version must be either 4 or 6\n"); + return 0; + } + break; } return 1; @@ -1570,25 +1663,37 @@ getarg( int getnetnum( const char *hname, - u_int32 *num, - char *fullhost + struct sockaddr_storage *num, + char *fullhost, + int af ) { - struct hostent *hp; + int err; + int sockaddr_len; + struct addrinfo hints, *ai = NULL; + sockaddr_len = (af == AF_INET) + ? sizeof(struct sockaddr_in) + : sizeof(struct sockaddr_in6); + memset((char *)&hints, 0, sizeof(struct addrinfo)); + hints.ai_flags = AI_CANONNAME; +#ifdef AI_ADDRCONFIG + hints.ai_flags |= AI_ADDRCONFIG; +#endif + + /* decodenetnum works with addresses only */ if (decodenetnum(hname, num)) { if (fullhost != 0) { - (void) sprintf(fullhost, "%lu.%lu.%lu.%lu", - (u_long)((htonl(*num) >> 24) & 0xff), - (u_long)((htonl(*num) >> 16) & 0xff), - (u_long)((htonl(*num) >> 8) & 0xff), - (u_long)(htonl(*num) & 0xff)); + getnameinfo((struct sockaddr *)num, sockaddr_len, + fullhost, sizeof(fullhost), NULL, 0, + NI_NUMERICHOST); + } return 1; - } else if ((hp = gethostbyname(hname)) != 0) { - memmove((char *)num, hp->h_addr, sizeof(u_int32)); - if (fullhost != 0) - (void) strcpy(fullhost, hp->h_name); + } else if ((err = getaddrinfo(hname, "ntp", &hints, &ai)) == 0) { + memmove((char *)num, ai->ai_addr, ai->ai_addrlen); + if (ai->ai_canonname != 0) + (void) strcpy(fullhost, ai->ai_canonname); return 1; } else { (void) fprintf(stderr, "***Can't find host %s\n", hname); @@ -1603,14 +1708,14 @@ getnetnum( */ char * nntohost( - u_int32 netnum + struct sockaddr_storage *netnum ) { if (!showhostnames) - return numtoa(netnum); - if ((ntohl(netnum) & REFCLOCK_MASK) == REFCLOCK_ADDR) - return refnumtoa(netnum); - return numtohost(netnum); + return stoa(netnum); + if ((netnum->ss_family == AF_INET) && ISREFCLOCKADR(netnum)) + return refnumtoa(netnum); + return socktohost(netnum); } @@ -1655,10 +1760,10 @@ rtdatetolfp( return 0; } - cal.monthday = *cp++ - '0'; /* ascii dependent */ + cal.monthday = (u_char) (*cp++ - '0'); /* ascii dependent */ if (isdigit((int)*cp)) { - cal.monthday = (cal.monthday << 3) + (cal.monthday << 1); - cal.monthday += *cp++ - '0'; + cal.monthday = (u_char)((cal.monthday << 3) + (cal.monthday << 1)); + cal.monthday = (u_char)(cal.monthday + *cp++ - '0'); } if (*cp++ != '-') @@ -1673,25 +1778,25 @@ rtdatetolfp( break; if (i == 12) return 0; - cal.month = i + 1; + cal.month = (u_char)(i + 1); if (*cp++ != '-') return 0; if (!isdigit((int)*cp)) return 0; - cal.year = *cp++ - '0'; + cal.year = (u_short)(*cp++ - '0'); if (isdigit((int)*cp)) { - cal.year = (cal.year << 3) + (cal.year << 1); - cal.year += *cp++ - '0'; + cal.year = (u_short)((cal.year << 3) + (cal.year << 1)); + cal.year = (u_short)(*cp++ - '0'); } if (isdigit((int)*cp)) { - cal.year = (cal.year << 3) + (cal.year << 1); - cal.year += *cp++ - '0'; + cal.year = (u_short)((cal.year << 3) + (cal.year << 1)); + cal.year = (u_short)(cal.year + *cp++ - '0'); } if (isdigit((int)*cp)) { - cal.year = (cal.year << 3) + (cal.year << 1); - cal.year += *cp++ - '0'; + cal.year = (u_short)((cal.year << 3) + (cal.year << 1)); + cal.year = (u_short)(cal.year + *cp++ - '0'); } /* @@ -1704,26 +1809,26 @@ rtdatetolfp( if (*cp++ != ' ' || !isdigit((int)*cp)) return 0; - cal.hour = *cp++ - '0'; + cal.hour = (u_char)(*cp++ - '0'); if (isdigit((int)*cp)) { - cal.hour = (cal.hour << 3) + (cal.hour << 1); - cal.hour += *cp++ - '0'; + cal.hour = (u_char)((cal.hour << 3) + (cal.hour << 1)); + cal.hour = (u_char)(cal.hour + *cp++ - '0'); } if (*cp++ != ':' || !isdigit((int)*cp)) return 0; - cal.minute = *cp++ - '0'; + cal.minute = (u_char)(*cp++ - '0'); if (isdigit((int)*cp)) { - cal.minute = (cal.minute << 3) + (cal.minute << 1); - cal.minute += *cp++ - '0'; + cal.minute = (u_char)((cal.minute << 3) + (cal.minute << 1)); + cal.minute = (u_char)(cal.minute + *cp++ - '0'); } if (*cp++ != ':' || !isdigit((int)*cp)) return 0; - cal.second = *cp++ - '0'; + cal.second = (u_char)(*cp++ - '0'); if (isdigit((int)*cp)) { - cal.second = (cal.second << 3) + (cal.second << 1); - cal.second += *cp++ - '0'; + cal.second = (u_char)((cal.second << 3) + (cal.second << 1)); + cal.second = (u_char)(cal.second + *cp++ - '0'); } /* @@ -1908,9 +2013,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; @@ -1959,8 +2064,8 @@ helpsort( const void *t2 ) { - const char **name1 = (const char **)t1; - const char **name2 = (const char **)t2; + char const * const * name1 = (char const * const *)t1; + char const * const * name2 = (char const * const *)t2; return strcmp(*name1, *name2); } @@ -2063,12 +2168,34 @@ host( FILE *fp ) { + int i; + if (pcmd->nargs == 0) { if (havehost) (void) fprintf(fp, "current host is %s\n", currenthost); else (void) fprintf(fp, "no current host\n"); - } else if (openhost(pcmd->argval[0].string)) { + return; + } + + i = 0; + ai_fam_templ = ai_fam_default; + if (pcmd->nargs == 2) { + if (!strcmp("-4", pcmd->argval[i].string)) + ai_fam_templ = AF_INET; + else if (!strcmp("-6", pcmd->argval[i].string)) + ai_fam_templ = AF_INET6; + else { + if (havehost) + (void) fprintf(fp, + "current host remains %s\n", currenthost); + else + (void) fprintf(fp, "still no current host\n"); + return; + } + i = 1; + } + if (openhost(pcmd->argval[i].string)) { (void) fprintf(fp, "current host set to %s\n", currenthost); numassoc = 0; } else { @@ -2105,11 +2232,14 @@ keyid( ) { if (pcmd->nargs == 0) { - if (info_auth_keyid > NTP_MAXKEY) + if (info_auth_keyid == 0) (void) fprintf(fp, "no keyid defined\n"); else (void) fprintf(fp, "keyid is %lu\n", (u_long)info_auth_keyid); } else { + /* allow zero so that keyid can be cleared. */ + if(pcmd->argval[0].uval > NTP_MAXKEY) + (void) fprintf(fp, "Invalid key identifier\n"); info_auth_keyid = pcmd->argval[0].uval; } } @@ -2125,7 +2255,7 @@ keytype( { if (pcmd->nargs == 0) fprintf(fp, "keytype is %s\n", - (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "DES"); + (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "???"); else switch (*(pcmd->argval[0].string)) { case 'm': @@ -2133,13 +2263,8 @@ keytype( info_auth_keytype = KEY_TYPE_MD5; break; - case 'd': - case 'D': - info_auth_keytype = KEY_TYPE_DES; - break; - default: - fprintf(fp, "keytype must be 'md5' or 'des'\n"); + fprintf(fp, "keytype must be 'md5'\n"); } } @@ -2157,21 +2282,21 @@ passwd( { char *pass; - if (info_auth_keyid > NTP_MAXKEY) { - info_auth_keyid = getkeyid("Keyid: "); - if (info_auth_keyid > NTP_MAXKEY) { - (void)fprintf(fp, "Keyid must be defined\n"); + if (info_auth_keyid == 0) { + int u_keyid = getkeyid("Keyid: "); + if (u_keyid == 0 || u_keyid > NTP_MAXKEY) { + (void)fprintf(fp, "Invalid key identifier\n"); return; } + info_auth_keyid = u_keyid; } - pass = getpass((info_auth_keytype == KEY_TYPE_DES) - ? "DES Password: " - : "MD5 Password: " - ); + pass = getpass("MD5 Password: "); 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); + } } @@ -2347,17 +2472,12 @@ ntpversion( static void warning( const char *fmt, - ... + const char *st1, + const char *st2 ) { - va_list ap; - (void) fprintf(stderr, "%s: ", progname); - - va_start(ap, fmt); - (void) vfprintf(stderr, fmt, ap); - va_end(ap); - + (void) fprintf(stderr, fmt, st1, st2); (void) fprintf(stderr, ": "); perror(""); } @@ -2369,19 +2489,11 @@ warning( static void error( const char *fmt, - ... + const char *st1, + const char *st2 ) { - va_list ap; - - (void) fprintf(stderr, "%s: ", progname); - - va_start(ap, fmt); - (void) vfprintf(stderr, fmt, ap); - va_end(ap); - - (void) fprintf(stderr, ": "); - perror(""); + warning(fmt, st1, st2); exit(1); } @@ -2409,7 +2521,7 @@ getkeyid( fprintf(stderr, "%s", keyprompt); fflush(stderr); for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) { if (p < &pbuf[18]) - *p++ = c; + *p++ = (char)c; } *p = '\0'; if (fi != stdin) @@ -2457,7 +2569,7 @@ atoascii( if (c < ' ') { *ocp++ = '^'; - *ocp++ = c + '@'; + *ocp++ = (u_char)(c + '@'); } else if (c == 0177) { *ocp++ = '^'; *ocp++ = '?'; @@ -2854,7 +2966,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 = ", "; @@ -2882,12 +2994,12 @@ cookedprint( register int varid; char *name; char *value; - int output_raw; + char output_raw; int fmt; struct ctl_var *varlist; l_fp lfp; long ival; - u_int32 hval; + struct sockaddr_storage hval; u_long uval; l_fp lfparr[8]; int narr; @@ -2966,10 +3078,11 @@ cookedprint( case NA: if (!decodenetnum(value, &hval)) output_raw = '?'; - else if (fmt == HA) - output(fp, name, nntohost(hval)); - else - output(fp, name, numtoa(hval)); + else if (fmt == HA){ + output(fp, name, nntohost(&hval)); + } else { + output(fp, name, stoa(&hval)); + } break; case ST: @@ -2977,9 +3090,14 @@ cookedprint( break; case RF: - if (decodenetnum(value, &hval)) - output(fp, name, nntohost(hval)); - else if ((int)strlen(value) <= 4) + if (decodenetnum(value, &hval)) { + if ((hval.ss_family == AF_INET) && + ISREFCLOCKADR(&hval)) + output(fp, name, + refnumtoa(&hval)); + else + output(fp, name, stoa(&hval)); + } else if ((int)strlen(value) <= 4) output(fp, name, value); else output_raw = '?'; @@ -3072,7 +3190,7 @@ sortassoc(void) #else (char *) #endif - assoc_cache, (unsigned)numassoc, + assoc_cache, (size_t)numassoc, sizeof(struct association), assoccmp); } diff --git a/dist/ntp/ntpq/ntpq.h b/dist/ntp/ntpq/ntpq.h index 15c87366cabb..deb5f74272be 100644 --- a/dist/ntp/ntpq/ntpq.h +++ b/dist/ntp/ntpq/ntpq.h @@ -1,4 +1,4 @@ -/* $NetBSD: ntpq.h,v 1.1.1.2 2003/12/04 16:05:32 drochner Exp $ */ +/* $NetBSD: ntpq.h,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * ntpq.h - definitions of interest to ntpq diff --git a/dist/ntp/ntpq/ntpq_ops.c b/dist/ntp/ntpq/ntpq_ops.c index 4a2729088353..56b72f2828e2 100644 --- a/dist/ntp/ntpq/ntpq_ops.c +++ b/dist/ntp/ntpq/ntpq_ops.c @@ -1,8 +1,9 @@ -/* $NetBSD: ntpq_ops.c,v 1.2 2002/12/06 15:13:56 thorpej Exp $ */ +/* $NetBSD: ntpq_ops.c,v 1.3 2003/12/04 16:23:38 drochner Exp $ */ /* - * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc + * ntpq_ops.c - subroutines which are called to perform operations by ntpq */ + #include #include #include @@ -57,12 +58,12 @@ static void radiostatus P((struct parse *, FILE *)); static void pstatus P((struct parse *, FILE *)); static long when P((l_fp *, l_fp *, l_fp *)); static char * prettyinterval P((char *, long)); -static int doprintpeers P((struct varlist *, int, int, int, char *, FILE *)); -static int dogetpeers P((struct varlist *, int, FILE *)); -static void dopeers P((int, FILE *)); +static int doprintpeers P((struct varlist *, int, int, int, char *, FILE *, int)); +static int dogetpeers P((struct varlist *, int, FILE *, int)); +static void dopeers P((int, FILE *, int)); static void peers P((struct parse *, FILE *)); static void lpeers P((struct parse *, FILE *)); -static void doopeers P((int, FILE *)); +static void doopeers P((int, FILE *, int)); static void opeers P((struct parse *, FILE *)); static void lopeers P((struct parse *, FILE *)); @@ -140,20 +141,20 @@ struct xcmd opcmds[] = { { "pstatus", pstatus, { UINT, NO, NO, NO }, { "assocID", "", "", "" }, "print status information returned for a peer" }, - { "peers", peers, { NO, NO, NO, NO }, - { "", "", "", "" }, - "obtain and print a list of the server's peers" }, - { "lpeers", lpeers, { NO, NO, NO, NO }, - { "", "", "", "" }, - "obtain and print a list of all peers and clients" }, - { "opeers", opeers, { NO, NO, NO, NO }, - { "", "", "", "" }, - "print peer list the old way, with dstadr shown rather than refid" }, - { "lopeers", lopeers, { NO, NO, NO, NO }, - { "", "", "", "" }, - "obtain and print a list of all peers and clients showing dstadr" }, + { "peers", peers, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "obtain and print a list of the server's peers [IP version]" }, + { "lpeers", lpeers, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "obtain and print a list of all peers and clients [IP version]" }, + { "opeers", opeers, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "print peer list the old way, with dstadr shown rather than refid [IP version]" }, + { "lopeers", lopeers, { OPT|IP_VERSION, NO, NO, NO }, + { "-4|-6", "", "", "" }, + "obtain and print a list of all peers and clients showing dstadr [IP version]" }, { 0, 0, { NO, NO, NO, NO }, - { "", "", "", "" }, "" } + { "-4|-6", "", "", "" }, "" } }; @@ -933,7 +934,7 @@ printassoc( (void) fprintf(fp, "===========================================================\n"); for (i = 0; i < numassoc; i++) { - statval = CTL_PEER_STATVAL(assoc_cache[i].status); + statval = (u_char) CTL_PEER_STATVAL(assoc_cache[i].status); if (!showall && !(statval & (CTL_PST_CONFIG|CTL_PST_REACH))) continue; event = CTL_PEER_EVENT(assoc_cache[i].status); @@ -1233,6 +1234,38 @@ prettyinterval( return buf; } +static char +decodeaddrtype( + struct sockaddr_storage *sock + ) +{ + char ch = '-'; + u_int32 dummy; + struct sockaddr_in6 *sin6; + + switch(sock->ss_family) { + case AF_INET: + dummy = ((struct sockaddr_in *)sock)->sin_addr.s_addr; + dummy = ntohl(dummy); + ch = (char)(((dummy&0xf0000000)==0xe0000000) ? 'm' : + ((dummy&0x000000ff)==0x000000ff) ? 'b' : + ((dummy&0xffffffff)==0x7f000001) ? 'l' : + ((dummy&0xffffffe0)==0x00000000) ? '-' : + 'u'); + break; + case AF_INET6: + sin6 = (struct sockaddr_in6 *)sock; + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + ch = 'm'; + else + ch = 'u'; + break; + default: + ch = '-'; + break; + } + return ch; +} /* * A list of variables required by the peers command @@ -1297,22 +1330,23 @@ doprintpeers( int rstatus, int datalen, char *data, - FILE *fp + FILE *fp, + int af ) { char *name; - char *value; + char *value = NULL; int i; int c; - u_int32 srcadr; - u_int32 dstadr; - u_long srcport; - const char *dstadr_refid = "0.0.0.0"; - u_long stratum; - long ppoll; - long hpoll; - u_long reach; + struct sockaddr_storage srcadr; + struct sockaddr_storage dstadr; + u_long srcport = 0; + char *dstadr_refid = "0.0.0.0"; + u_long stratum = 0; + long ppoll = 0; + long hpoll = 0; + u_long reach = 0; l_fp estoffset; l_fp estdelay; l_fp estjitter; @@ -1325,12 +1359,22 @@ doprintpeers( char type = '?'; char refid_string[10]; char whenbuf[8], pollbuf[8]; + char clock_name[LENHOSTNAME]; memset((char *)havevar, 0, sizeof(havevar)); get_systime(&ts); + + memset((char *)&srcadr, 0, sizeof(struct sockaddr_storage)); + memset((char *)&dstadr, 0, sizeof(struct sockaddr_storage)); + + /* Initialize by zeroing out estimate variables */ + memset((char *)&estoffset, 0, sizeof(l_fp)); + memset((char *)&estdelay, 0, sizeof(l_fp)); + memset((char *)&estjitter, 0, sizeof(l_fp)); + memset((char *)&estdisp, 0, sizeof(l_fp)); while (nextvar(&datalen, &data, &name, &value)) { - u_int32 dummy; + struct sockaddr_storage dum_store; i = findvar(name, peer_var); if (i == 0) @@ -1341,18 +1385,12 @@ doprintpeers( havevar[HAVE_SRCADR] = 1; break; case CP_DSTADR: - if (decodenetnum(value, &dummy)) { - dummy = ntohl(dummy); - type = ((dummy&0xf0000000)==0xe0000000) ? 'm' : - ((dummy&0x000000ff)==0x000000ff) ? 'b' : - ((dummy&0xffffffff)==0x7f000001) ? 'l' : - ((dummy&0xffffffe0)==0x00000000) ? '-' : - 'u'; - } + if (decodenetnum(value, &dum_store)) + type = decodeaddrtype(&dum_store); if (pvl == opeervarlist) { if (decodenetnum(value, &dstadr)) { havevar[HAVE_DSTADR] = 1; - dstadr_refid = numtoa(dstadr); + dstadr_refid = stoa(&dstadr); } } break; @@ -1362,10 +1400,15 @@ doprintpeers( if (*value == '\0') { dstadr_refid = "0.0.0.0"; } else if (decodenetnum(value, &dstadr)) { - if (dstadr == 0) + if (SOCKNUL(&dstadr)) dstadr_refid = "0.0.0.0"; + else if ((dstadr.ss_family == AF_INET) + && ISREFCLOCKADR(&dstadr)) + dstadr_refid = + refnumtoa(&dstadr); else - dstadr_refid = nntohost(dstadr); + dstadr_refid = + stoa(&dstadr); } else if ((int)strlen(value) <= 4) { refid_string[0] = '.'; (void) strcpy(&refid_string[1], value); @@ -1451,15 +1494,21 @@ doprintpeers( c = flash2[CTL_PEER_STATVAL(rstatus) & 0x3]; if (numhosts > 1) (void) fprintf(fp, "%-*s ", maxhostlen, currenthost); - (void) fprintf(fp, - "%c%-15.15s %-15.15s %2ld %c %4.4s %4.4s %3lo %7.7s %8.7s %7.7s\n", - c, nntohost(srcadr), dstadr_refid, stratum, type, - prettyinterval(whenbuf, when(&ts, &rec, &reftime)), - prettyinterval(pollbuf, (int)poll_sec), reach, - lfptoms(&estdelay, 3), lfptoms(&estoffset, 3), - havevar[HAVE_JITTER] ? lfptoms(&estjitter, 3) : - lfptoms(&estdisp, 3)); - return (1); + if (af == 0 || srcadr.ss_family == af){ + strcpy(clock_name, nntohost(&srcadr)); + + (void) fprintf(fp, + "%c%-15.15s %-15.15s %2ld %c %4.4s %4.4s %3lo %7.7s %8.7s %7.7s\n", + c, clock_name, dstadr_refid, stratum, type, + prettyinterval(whenbuf, when(&ts, &rec, &reftime)), + prettyinterval(pollbuf, (int)poll_sec), reach, + lfptoms(&estdelay, 3), lfptoms(&estoffset, 3), + havevar[HAVE_JITTER] ? lfptoms(&estjitter, 3) : + lfptoms(&estdisp, 3)); + return (1); + } + else + return(1); } #undef HAVE_SRCADR @@ -1487,7 +1536,8 @@ static int dogetpeers( struct varlist *pvl, int associd, - FILE *fp + FILE *fp, + int af ) { char *datap; @@ -1516,8 +1566,7 @@ dogetpeers( return 0; } - - return doprintpeers(pvl, associd, (int)rstatus, dsize, datap, fp); + return doprintpeers(pvl, associd, (int)rstatus, dsize, datap, fp, af); } @@ -1527,25 +1576,24 @@ dogetpeers( static void dopeers( int showall, - FILE *fp + FILE *fp, + int af ) { register int i; char fullname[LENHOSTNAME]; - u_int32 netnum; + struct sockaddr_storage netnum; if (!dogetassoc(fp)) return; - maxhostlen = 0; - if (numhosts > 1) { - for (i = 0; i < numhosts; ++i) - { if(getnetnum(chosts[i],&netnum,fullname)) + for (i = 0; i < numhosts; ++i) { + if (getnetnum(chosts[i], &netnum, fullname, af)) if ((int)strlen(fullname) > maxhostlen) - maxhostlen = strlen(fullname); - } - (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host"); + maxhostlen = strlen(fullname); } + if (numhosts > 1) + (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host"); (void) fprintf(fp, " remote refid st t when poll reach delay offset jitter\n"); if (numhosts > 1) @@ -1559,7 +1607,7 @@ dopeers( !(CTL_PEER_STATVAL(assoc_cache[i].status) & (CTL_PST_CONFIG|CTL_PST_REACH))) continue; - if (!dogetpeers(peervarlist, (int)assoc_cache[i].assid, fp)) { + if (!dogetpeers(peervarlist, (int)assoc_cache[i].assid, fp, af)) { return; } } @@ -1577,7 +1625,15 @@ peers( FILE *fp ) { - dopeers(0, fp); + int af = 0; + + if (pcmd->nargs == 1) { + if (pcmd->argval->ival == 6) + af = AF_INET6; + else + af = AF_INET; + } + dopeers(0, fp, af); } @@ -1591,7 +1647,15 @@ lpeers( FILE *fp ) { - dopeers(1, fp); + int af = 0; + + if (pcmd->nargs == 1) { + if (pcmd->argval->ival == 6) + af = AF_INET6; + else + af = AF_INET; + } + dopeers(1, fp, af); } @@ -1601,7 +1665,8 @@ lpeers( static void doopeers( int showall, - FILE *fp + FILE *fp, + int af ) { register int i; @@ -1619,7 +1684,7 @@ doopeers( !(CTL_PEER_STATVAL(assoc_cache[i].status) & (CTL_PST_CONFIG|CTL_PST_REACH))) continue; - if (!dogetpeers(opeervarlist, (int)assoc_cache[i].assid, fp)) { + if (!dogetpeers(opeervarlist, (int)assoc_cache[i].assid, fp, af)) { return; } } @@ -1637,7 +1702,15 @@ opeers( FILE *fp ) { - doopeers(0, fp); + int af = 0; + + if (pcmd->nargs == 1) { + if (pcmd->argval->ival == 6) + af = AF_INET6; + else + af = AF_INET; + } + doopeers(0, fp, af); } @@ -1651,5 +1724,13 @@ lopeers( FILE *fp ) { - doopeers(1, fp); + int af = 0; + + if (pcmd->nargs == 1) { + if (pcmd->argval->ival == 6) + af = AF_INET6; + else + af = AF_INET; + } + doopeers(1, fp, af); } diff --git a/dist/ntp/ntptrace/Makefile.am b/dist/ntp/ntptrace/Makefile.am deleted file mode 100644 index f7106ec23678..000000000000 --- a/dist/ntp/ntptrace/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies -AUTOMAKE_OPTIONS = ../util/ansi2knr -bin_PROGRAMS = ntptrace -INCLUDES = -I$(top_srcdir)/include -# LDADD might need RESLIB and ADJLIB -LDADD = version.o ../libntp/libntp.a -DISTCLEANFILES = .version version.c -noinst_HEADERS = ntptrace.h -#EXTRA_DIST = ntptrace.mak README TAGS save -ETAGS_ARGS = Makefile.am - -$(PROGRAMS): $(LDADD) - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - -version.o: $(ntptrace_OBJECTS) ../libntp/libntp.a Makefile - $(top_builddir)/scripts/mkver ntptrace - $(COMPILE) -c version.c diff --git a/dist/ntp/ntptrace/Makefile.in b/dist/ntp/ntptrace/Makefile.in deleted file mode 100644 index 27795d129d9e..000000000000 --- a/dist/ntp/ntptrace/Makefile.in +++ /dev/null @@ -1,374 +0,0 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 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. - -# 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. - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -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@ -AMDEP = @AMDEP@ -AMTAR = @AMTAR@ -AWK = @AWK@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CHUTEST = @CHUTEST@ -CLKTEST = @CLKTEST@ -CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DCFD = @DCFD@ -DEPDIR = @DEPDIR@ -LDFLAGS = @LDFLAGS@ -LIBPARSE = @LIBPARSE@ -LIBRSAREF = @LIBRSAREF@ -LN_S = @LN_S@ -MAKEINFO = @MAKEINFO@ -MAKE_ADJTIMED = @MAKE_ADJTIMED@ -MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@ -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@ -PACKAGE = @PACKAGE@ -PATH_PERL = @PATH_PERL@ -PATH_SH = @PATH_SH@ -PROPDELAY = @PROPDELAY@ -RANLIB = @RANLIB@ -RSAREF = @RSAREF@ -TESTDCF = @TESTDCF@ -U = @U@ -VERSION = @VERSION@ -install_sh = @install_sh@ - -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies - - -AUTOMAKE_OPTIONS = ../util/ansi2knr -bin_PROGRAMS = ntptrace -INCLUDES = -I$(top_srcdir)/include -# LDADD might need RESLIB and ADJLIB -LDADD = version.o ../libntp/libntp.a -DISTCLEANFILES = .version version.c -noinst_HEADERS = ntptrace.h -#EXTRA_DIST = ntptrace.mak README TAGS save -ETAGS_ARGS = Makefile.am -subdir = ntptrace -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I.. -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -ANSI2KNR = ../util/ansi2knr -ntptrace_SOURCES = ntptrace.c -ntptrace_OBJECTS = ntptrace$U.o -ntptrace_LDADD = $(LDADD) -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) - -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 - -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) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - -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; \ - 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)/'`"; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o - - -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) - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -mostlyclean-tags: - -clean-tags: - -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: - -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 $@ $< - -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-binPROGRAMS -install-exec: install-exec-am - -install-data-am: -install-data: install-data-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) - - -mostlyclean-generic: - -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: - -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-binPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-binPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am - -distclean: distclean-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." - -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 - - -$(PROGRAMS): $(LDADD) - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - -version.o: $(ntptrace_OBJECTS) ../libntp/libntp.a Makefile - $(top_builddir)/scripts/mkver ntptrace - $(COMPILE) -c version.c - -# 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. -.NOEXPORT: diff --git a/dist/ntp/ntptrace/README b/dist/ntp/ntptrace/README deleted file mode 100644 index 523f840fe181..000000000000 --- a/dist/ntp/ntptrace/README +++ /dev/null @@ -1,7 +0,0 @@ -README file for directory ./ntptrace of the NTP Version 4 distribution - -This directory contains the sources for the ntptrace utility program. See -the README and RELNOTES files in the parent directory for directions on -how to make and install this program. The current version number of this -program is in the version.c file. - diff --git a/dist/ntp/ntptrace/ntptrace.c b/dist/ntp/ntptrace/ntptrace.c deleted file mode 100644 index e41753753f4a..000000000000 --- a/dist/ntp/ntptrace/ntptrace.c +++ /dev/null @@ -1,796 +0,0 @@ -/* $NetBSD: ntptrace.c,v 1.1.1.1 2000/03/29 12:38:55 simonb Exp $ */ - -/* - * ntptrace - show the chain from an NTP host leading back to - * its source of time - * - * Jeffrey Mogul DECWRL 13 January 1993 - * - * Inspired by a script written by Glenn Trewitt - * - * Large portions stolen from ntpdate.c - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(SYS_HPUX) -#include -#endif - -#include "ntp_fp.h" -#include "ntp.h" -#include "ntp_io.h" -#include "ntp_unixtime.h" -#include "ntptrace.h" -#include "ntp_string.h" -#include "ntp_syslog.h" -#include "ntp_select.h" -#include "ntp_stdlib.h" -#include "recvbuff.h" -/* - * only 16 stratums, so this is more than enough. - */ -int maxhosts = 20; - -/* - * Debugging flag - */ -volatile int debug = 0; - -#ifndef SYS_VXWORKS -int nonames = 0; /* if set, don't print hostnames */ -#else -int nonames = 1; /* if set, don't print hostnames */ -#endif -/* - * Program name. - */ -char *progname; - -/* - * Systemwide parameters and flags - */ -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_version = NTP_OLDVERSION; /* version to poll with */ - - -/* - * File descriptor masks etc. for call to select - */ -int fd; -fd_set fdmask; - -/* - * Miscellaneous flags - */ -int verbose = 0; -int always_step = 0; - -int ntptracemain P((int, char **)); -static void DoTrace P((struct server *)); -static void DoTransmit P((struct server *)); -static int DoReceive P((struct server *)); -static int ReceiveBuf P((struct server *, struct recvbuf *)); -static struct server *addserver P((struct in_addr *)); -static struct server *addservbyname P((const char *)); -static void setup_io P((void)); -static void sendpkt P((struct sockaddr_in *, struct pkt *, int)); -static int getipaddr P((const char *, u_int32 *)); -static int decodeipaddr P((const char *, u_int32 *)); -static void printserver P((struct server *, FILE *)); -static void printrefid P((FILE *, struct server *)); -void input_handler P((l_fp * x)); - -#ifdef SYS_WINNT -int on = 1; -WORD wVersionRequested; -WSADATA wsaData; - -HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */ -void timer(void) { ; }; /* 1998/06/03 - Used in ntplib/machines.c */ -#endif /* SYS_WINNT */ - -void -input_handler(l_fp * x) -{ ; -} - -#ifdef NO_MAIN_ALLOWED -CALL(ntptrace,"ntptrace",ntptracemain); -#endif - -/* - * Main program. Initialize us and loop waiting for I/O and/or - * timer expiries. - */ -#ifndef NO_MAIN_ALLOWED -int -main( - int argc, - char *argv[] - ) -{ - return ntptracemain(argc, argv); -} -#endif - -int -ntptracemain( - int argc, - char *argv[] - ) -{ - struct server *firstserver; - int errflg; - int c; - - errflg = 0; - progname = argv[0]; - - /* - * Decode argument list - */ - while ((c = ntp_getopt(argc, argv, "dm:no:r:t:v")) != EOF) - switch (c) { - case 'd': - ++debug; - break; - case 'm': - maxhosts = atoi(ntp_optarg); - break; - case 'n': - nonames = 1; - break; - case 'o': - sys_version = atoi(ntp_optarg); - break; - case 'r': - sys_retries = atoi(ntp_optarg); - if (sys_retries < 1) { - (void)fprintf(stderr, - "%s: retries (%d) too small\n", - progname, sys_retries); - errflg++; - } - break; - case 't': - sys_timeout = atoi(ntp_optarg); - if (sys_timeout < 1) { - (void)fprintf(stderr, - "%s: timeout (%d) too short\n", - progname, sys_timeout); - errflg++; - } - break; - case 'v': - verbose = 1; - break; - case '?': - ++errflg; - break; - default: - break; - } - - if (errflg || (argc - ntp_optind) > 1) { - (void) fprintf(stderr, - "usage: %s [-dnv] [-m maxhosts] [-o version#] [-r retries] [-t timeout] [server]\n", - progname); - exit(2); - } - -#ifdef SYS_WINNT - wVersionRequested = MAKEWORD(1,1); - if (WSAStartup(wVersionRequested, &wsaData)) { - msyslog(LOG_ERR, "No useable winsock.dll: %m"); - exit(1); - } -#endif /* SYS_WINNT */ - - sys_servers = (struct server **) - emalloc(sys_maxservers * sizeof(struct server *)); - - if (debug) { -#ifdef HAVE_SETVBUF - static char buf[BUFSIZ]; - setvbuf(stdout, buf, _IOLBF, BUFSIZ); -#else - setlinebuf(stdout); -#endif - } - - if (debug || verbose) - msyslog(LOG_NOTICE, "%s", Version); - - if ((argc - ntp_optind) == 1) - firstserver = addservbyname(argv[ntp_optind]); - else - firstserver = addservbyname("localhost"); - - if (firstserver == NULL) { - /* a message has already been printed */ - exit(2); - } - - /* - * Initialize the time of day routines and the I/O subsystem - */ - setup_io(); - - DoTrace(firstserver); - -#ifdef SYS_WINNT - WSACleanup(); -#endif - return(0); -} /* main end */ - - -static void -DoTrace( - register struct server *server - ) -{ - 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)); - else - printf("%s: ", ntohost(&server->srcadr)); - fflush(stdout); - } - while (retries-- > 0) { - DoTransmit(server); - if (DoReceive(server)) - return; - } - if (verbose) { - if (nonames) - printf("%s:\t*Timeout*\n", ntoa(&server->srcadr)); - else - printf("%s:\t*Timeout*\n", ntohost(&server->srcadr)); - } - else - printf("\t*Timeout*\n"); -} - -/* - * Dotransmit - transmit a packet to the given server - */ -static void -DoTransmit( - register struct server *server - ) -{ - struct pkt xpkt; - - if (debug) - printf("DoTransmit(%s)\n", ntoa(&server->srcadr)); - - /* - * Fill in the packet and let 'er rip. - */ - xpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC, - sys_version, MODE_CLIENT); - xpkt.stratum = STRATUM_TO_PKT(STRATUM_UNSPEC); - xpkt.ppoll = NTP_MINPOLL; - xpkt.precision = NTPTRACE_PRECISION; - xpkt.rootdelay = htonl(NTPTRACE_DISTANCE); - xpkt.rootdispersion = htonl(NTPTRACE_DISP); - xpkt.refid = htonl(NTPTRACE_REFID); - L_CLR(&xpkt.reftime); - L_CLR(&xpkt.org); - L_CLR(&xpkt.rec); - - /* - * just timestamp packet and send it away. - */ - get_systime(&(server->xmt)); - HTONL_FP(&server->xmt, &xpkt.xmt); - sendpkt(&(server->srcadr), &xpkt, LEN_PKT_NOMAC); - - if (debug) - printf("DoTransmit to %s\n", ntoa(&(server->srcadr))); -} - -/* - * DoReceive - attempt to receive a packet from a specific server - */ -static int -DoReceive( - register struct server *server - ) -{ - register int n; - fd_set fds; - struct timeval timeout; - l_fp ts; - register struct recvbuf *rb; - int fromlen; - int status; - - /* - * Loop until we see the packet we want or until we time out - */ - for (;;) { - fds = fdmask; - timeout.tv_sec = sys_timeout; - timeout.tv_usec = 0; - n = select(fd+1, &fds, (fd_set *)0, (fd_set *)0, &timeout); - - if (n == 0) { /* timed out */ - if (debug) - printf("timeout\n"); - return(0); - } - else if (n == -1) { - msyslog(LOG_ERR, "select() error: %m"); - return(0); - } - get_systime(&ts); - - if (free_recvbuffs() == 0) { - msyslog(LOG_ERR, "no buffers"); - exit(1); - } - - rb = get_free_recv_buffer(); - - fromlen = sizeof(struct sockaddr_in); - rb->recv_length = recvfrom(fd, (char *)&rb->recv_pkt, - sizeof(rb->recv_pkt), 0, - (struct sockaddr *)&rb->recv_srcadr, &fromlen); - if (rb->recv_length == -1) { - freerecvbuf(rb); - continue; - } - - /* - * Got one. Mark how and when it got here, - * put it on the full list. - */ - rb->recv_time = ts; - add_full_recv_buffer(rb); - - status = ReceiveBuf(server, rb); - - freerecvbuf(rb); - - return(status); - } -} - -/* - * receive - receive and process an incoming frame - * Return 1 on success, 0 on failure - */ -static int -ReceiveBuf( - struct server *server, - struct recvbuf *rbufp - ) -{ - register struct pkt *rpkt; - register s_fp di; - l_fp t10, t23; - l_fp org; - l_fp rec; - l_fp ci; - struct server *nextserver; - struct in_addr nextia; - - - if (debug) { - printf("ReceiveBuf(%s, ", ntoa(&server->srcadr)); - printf("%s)\n", ntoa(&rbufp->recv_srcadr)); - } - - /* - * Check to see if the packet basically looks like something - * intended for us. - */ - if (rbufp->recv_length < LEN_PKT_NOMAC) { - if (debug) - printf("receive: packet length %d\n", - rbufp->recv_length); - return(0); /* funny length packet */ - } - if (rbufp->recv_srcadr.sin_addr.s_addr != server->srcadr.sin_addr.s_addr) { - if (debug) - printf("receive: wrong server\n"); - return(0); /* funny length packet */ - } - - rpkt = &(rbufp->recv_pkt); - - if (PKT_VERSION(rpkt->li_vn_mode) < NTP_OLDVERSION) { - if (debug) - printf("receive: version %d\n", PKT_VERSION(rpkt->li_vn_mode)); - return(0); - } - if (PKT_VERSION(rpkt->li_vn_mode) > NTP_VERSION) { - if (debug) - printf("receive: version %d\n", PKT_VERSION(rpkt->li_vn_mode)); - return(0); - } - - if ((PKT_MODE(rpkt->li_vn_mode) != MODE_SERVER - && PKT_MODE(rpkt->li_vn_mode) != MODE_PASSIVE) - || rpkt->stratum > NTP_MAXSTRATUM) { - if (debug) - printf("receive: mode %d stratum %d\n", - PKT_MODE(rpkt->li_vn_mode), rpkt->stratum); - return(0); - } - - /* - * Decode the org timestamp and make sure we're getting a response - * to our last request. - */ - NTOHL_FP(&rpkt->org, &org); - if (!L_ISEQU(&org, &server->xmt)) { - if (debug) - printf("receive: pkt.org and peer.xmt differ\n"); - return(0); - } - - /* - * Looks good. Record info from the packet. - */ - - server->leap = PKT_LEAP(rpkt->li_vn_mode); - server->stratum = PKT_TO_STRATUM(rpkt->stratum); - server->precision = rpkt->precision; - server->rootdelay = ntohl(rpkt->rootdelay); - server->rootdispersion = ntohl(rpkt->rootdispersion); - server->refid = rpkt->refid; - NTOHL_FP(&rpkt->reftime, &server->reftime); - NTOHL_FP(&rpkt->rec, &rec); - NTOHL_FP(&rpkt->xmt, &server->org); - - /* - * Make sure the server is at least somewhat sane. If not, try - * again. - */ - if (L_ISZERO(&rec) || !L_ISHIS(&server->org, &rec)) { - return(0); - } - - /* - * Calculate the round trip delay (di) and the clock offset (ci). - * We use the equations (reordered from those in the spec): - * - * d = (t2 - t3) - (t1 - t0) - * c = ((t2 - t3) + (t1 - t0)) / 2 - */ - t10 = server->org; /* pkt.xmt == t1 */ - L_SUB(&t10, &rbufp->recv_time); /* recv_time == t0*/ - - t23 = rec; /* pkt.rec == t2 */ - L_SUB(&t23, &org); /* pkt->org == t3 */ - - /* now have (t2 - t3) and (t0 - t1). Calculate (ci) and (di) */ - ci = t10; - L_ADD(&ci, &t23); - L_RSHIFT(&ci); - - /* - * Calculate di in t23 in full precision, then truncate - * to an s_fp. - */ - L_SUB(&t23, &t10); - di = LFPTOFP(&t23); - - server->offset = ci; - server->delay = di; - - printserver(server, stdout); - - /* - * End of recursion if we reach stratum 1 or a local refclock - */ - if ((server->stratum <= 1) || (--maxhosts <= 0) || ((server->refid & 0xff) == 127)) - return(1); - - nextia.s_addr = server->refid; - nextserver = addserver(&nextia); - if (nextserver) - DoTrace(nextserver); - return(1); -} - -/* XXX ELIMINATE addserver (almost) identical to ntpdate.c, ntptrace.c */ -/* - * addserver - Allocate a new structure for server. - * Returns a pointer to that structure. - */ -static struct server * -addserver( - struct in_addr *iap - ) -{ - register struct server *server; - static int toomany = 0; - - if (sys_numservers >= sys_maxservers) { - if (!toomany) { - toomany = 1; - msyslog(LOG_ERR, - "too many servers (> %d) specified, remainder not used", - sys_maxservers); - } - return(NULL); - } - - server = (struct server *)emalloc(sizeof(struct server)); - memset((char *)server, 0, sizeof(struct server)); - - server->srcadr.sin_family = AF_INET; - server->srcadr.sin_addr = *iap; - server->srcadr.sin_port = htons(NTP_PORT); - - sys_servers[sys_numservers++] = server; - - return(server); -} - - -/* - * addservbyname - determine a server's address and allocate a new structure - * for it. Returns a pointer to that structure. - */ -static struct server * -addservbyname( - const char *serv - ) -{ - u_int32 ipaddr; - struct in_addr ia; - - if (!getipaddr(serv, &ipaddr)) { - msyslog(LOG_ERR, "can't find host %s\n", serv); - return(NULL); - } - - ia.s_addr = ipaddr; - return(addserver(&ia)); -} - - -static void -setup_io(void) -{ - /* - * Init buffer free list and stat counters - */ - init_recvbuff(sys_maxservers + 2); - - /* create a datagram (UDP) socket */ - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) -#ifndef SYS_WINNT - < 0 -#else - == INVALID_SOCKET -#endif - ) { - msyslog(LOG_ERR, "socket() failed: %m"); - exit(1); - /*NOTREACHED*/ - } - - FD_ZERO(&fdmask); - FD_SET(fd, &fdmask); -} - - - -/* XXX ELIMINATE sendpkt similar in ntpq.c, ntpdc.c, ntp_io.c, ntptrace.c */ -/* - * sendpkt - send a packet to the specified destination - */ -static void -sendpkt( - struct sockaddr_in *dest, - struct pkt *pkt, - int len - ) -{ - int cc; - - cc = sendto(fd, (char *)pkt, len, 0, (struct sockaddr *)dest, - sizeof(struct sockaddr_in)); - if (cc == -1) { -#ifndef SYS_WINNT - if (errno != EWOULDBLOCK && errno != ENOBUFS) -#else /* SYS_WINNT */ - int iSockErr = WSAGetLastError(); - if (iSockErr != WSAEWOULDBLOCK && iSockErr != WSAENOBUFS) -#endif /* SYS_WINNT */ - msyslog(LOG_ERR, "sendto(%s): %m", ntoa(dest)); - } -} - -/* - * getipaddr - given a host name, return its host address - */ -static int -getipaddr( - const char *host, - u_int32 *num - ) -{ - struct hostent *hp; - - if (decodeipaddr(host, num)) { - return 1; - } else if ((hp = gethostbyname(host)) != 0) { - memmove((char *)num, hp->h_addr, sizeof(long)); - return 1; - } - return 0; -} - -/* - * decodeipaddr - return a host address (this is crude, but careful) - */ -static int -decodeipaddr( - const char *num, - u_int32 *ipaddr - ) -{ - register const char *cp; - register char *bp; - register int i; - register int temp; - char buf[80]; /* will core dump on really stupid stuff */ - - cp = num; - *ipaddr = 0; - for (i = 0; i < 4; i++) { - bp = buf; - while (isdigit((int)*cp)) - *bp++ = *cp++; - if (bp == buf) - break; - - if (i < 3) { - if (*cp++ != '.') - break; - } else if (*cp != '\0') - break; - - *bp = '\0'; - temp = atoi(buf); - if (temp > 255) - break; - *ipaddr <<= 8; - *ipaddr += temp; - } - - if (i < 4) - return 0; - *ipaddr = htonl(*ipaddr); - return 1; -} - - -/* XXX ELIMINATE printserver similar in ntptrace.c, ntpdate.c */ -/* - * printserver - print detail information for a server - */ -static void -printserver( - register struct server *pp, - FILE *fp - ) -{ - u_fp synchdist; - - synchdist = pp->rootdispersion + (pp->rootdelay/2); - - if (!verbose) { - (void) fprintf(fp, "stratum %d, offset %s, synch distance %s", - pp->stratum, lfptoa(&pp->offset, 6), ufptoa(synchdist, 5)); - if (pp->stratum == 1) { - (void) fprintf(fp, ", refid "); - printrefid(fp, pp); - } - (void) fprintf(fp, "\n"); - return; - } - - (void) fprintf(fp, "server %s, port %d\n", ntoa(&pp->srcadr), - ntohs(pp->srcadr.sin_port)); - - (void) fprintf(fp, "stratum %d, precision %d, leap %c%c\n", - pp->stratum, pp->precision, pp->leap & 0x2 ? '1' : '0', - pp->leap & 0x1 ? '1' : '0'); - - (void) fprintf(fp, "refid "); - printrefid(fp, pp); - - (void) fprintf(fp, " delay %s, dispersion %s ", fptoa(pp->delay, 5), - ufptoa(pp->dispersion, 5)); - (void) fprintf(fp, "offset %s\n", lfptoa(&pp->offset, 6)); - (void) fprintf(fp, "rootdelay %s, rootdispersion %s", - ufptoa(pp->rootdelay, 5), ufptoa(pp->rootdispersion, 5)); - (void) fprintf(fp, ", synch dist %s\n", ufptoa(synchdist, 5)); - - (void) fprintf(fp, "reference time: %s\n", - prettydate(&pp->reftime)); - (void) fprintf(fp, "originate timestamp: %s\n", - prettydate(&pp->org)); - (void) fprintf(fp, "transmit timestamp: %s\n", - prettydate(&pp->xmt)); - - (void) fprintf(fp, "\n"); - -} - -static void -printrefid( - FILE *fp, - struct server *pp - ) -{ - char junk[5]; - char *str; - - if (pp->stratum == 1) { - junk[4] = 0; - memmove(junk, (char *)&pp->refid, 4); - str = junk; - (void) fprintf(fp, "'%s'", str); - } else { - if (nonames) { - str = numtoa(pp->refid); - (void) fprintf(fp, "[%s]", str); - } - else { - str = numtohost(pp->refid); - (void) fprintf(fp, "%s", str); - } - } -} - -#if !defined(HAVE_VSPRINTF) -int -vsprintf( - char *str, - const char *fmt, - va_list ap - ) -{ - FILE f; - int len; - - f._flag = _IOWRT+_IOSTRG; - f._ptr = str; - f._cnt = 32767; - len = _doprnt(fmt, ap, &f); - *f._ptr = 0; - return (len); -} -#endif diff --git a/dist/ntp/ntptrace/ntptrace.h b/dist/ntp/ntptrace/ntptrace.h deleted file mode 100644 index 829a66b5b930..000000000000 --- a/dist/ntp/ntptrace/ntptrace.h +++ /dev/null @@ -1,38 +0,0 @@ -/* $NetBSD: ntptrace.h,v 1.1.1.1 2000/03/29 12:38:55 simonb Exp $ */ - -/* - * ntptrace.h - declarations for the ntptrace program - */ - -/* - * The server structure is a much simplified version of the - * peer structure, for ntptrace's use. Since we always send - * in client mode and expect to receive in server mode, this - * leaves only a very limited number of things we need to - * remember about the server. - */ -struct server { - struct sockaddr_in srcadr; /* address of remote host */ - u_char leap; /* leap indicator */ - u_char stratum; /* stratum of remote server */ - s_char precision; /* server's clock precision */ - u_fp rootdelay; /* distance from primary clock */ - u_fp rootdispersion; /* peer clock dispersion */ - u_int32 refid; /* peer reference ID */ - l_fp reftime; /* time of peer's last update */ - l_fp org; /* peer's originate time stamp */ - l_fp xmt; /* transmit time stamp */ - s_fp delay; /* filter estimated delay */ - u_fp dispersion; /* filter estimated dispersion */ - l_fp offset; /* filter estimated clock offset */ -}; - - -/* - * Since ntptrace isn't aware of some of the things that normally get - * put in an NTP packet, we fix some values. - */ -#define NTPTRACE_PRECISION (-6) /* use this precision */ -#define NTPTRACE_DISTANCE FP_SECOND /* distance is 1 sec */ -#define NTPTRACE_DISP FP_SECOND /* so is the dispersion */ -#define NTPTRACE_REFID (0) /* reference ID to use */ diff --git a/dist/ntp/parseutil/dcfd.c b/dist/ntp/parseutil/dcfd.c index b5082eb8aac5..9e5ec6fa0f24 100644 --- a/dist/ntp/parseutil/dcfd.c +++ b/dist/ntp/parseutil/dcfd.c @@ -1,4 +1,4 @@ -/* $NetBSD: dcfd.c,v 1.1.1.2 2003/12/04 16:05:32 drochner Exp $ */ +/* $NetBSD: dcfd.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * /src/NTP/ntp-4/parseutil/dcfd.c,v 4.9 1999/02/28 13:06:27 kardel RELEASE_19990228_A diff --git a/dist/ntp/parseutil/testdcf.c b/dist/ntp/parseutil/testdcf.c index 28bed6cac81f..98c810785158 100644 --- a/dist/ntp/parseutil/testdcf.c +++ b/dist/ntp/parseutil/testdcf.c @@ -1,4 +1,4 @@ -/* $NetBSD: testdcf.c,v 1.1.1.2 2003/12/04 16:05:32 drochner Exp $ */ +/* $NetBSD: testdcf.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * /src/NTP/REPOSITORY/v4/parseutil/testdcf.c,v 3.18 1996/12/01 16:05:04 kardel Exp diff --git a/dist/ntp/scripts/ntpsweep.in b/dist/ntp/scripts/ntpsweep.in index 9c50f9ba6bb1..7ccebab10660 100644 --- a/dist/ntp/scripts/ntpsweep.in +++ b/dist/ntp/scripts/ntpsweep.in @@ -1,6 +1,6 @@ #! @PATH_PERL@ -w # -# $Id: ntpsweep.in,v 1.1.1.2 2003/12/04 16:05:32 drochner Exp $ +# $Id: ntpsweep.in,v 1.2 2003/12/04 16:23:38 drochner Exp $ # # DISCLAIMER # diff --git a/dist/ntp/scripts/plot_summary.in b/dist/ntp/scripts/plot_summary.in index 8be0bcae63fd..a226de6cdd0a 100644 --- a/dist/ntp/scripts/plot_summary.in +++ b/dist/ntp/scripts/plot_summary.in @@ -1,5 +1,5 @@ #! @PATH_PERL@ -w -# $Id: plot_summary.in,v 1.1.1.2 2003/12/04 16:05:32 drochner Exp $ +# $Id: plot_summary.in,v 1.2 2003/12/04 16:23:38 drochner Exp $ # # Use Gnuplot to display data in summary files produced by summary.pl. # This script requires GNUPLOT 3.7! diff --git a/dist/ntp/scripts/summary.in b/dist/ntp/scripts/summary.in index 5531032a61d9..556f18a595b1 100644 --- a/dist/ntp/scripts/summary.in +++ b/dist/ntp/scripts/summary.in @@ -1,5 +1,5 @@ #! @PATH_PERL@ -w -# $Id: summary.in,v 1.1.1.2 2003/12/04 16:05:32 drochner Exp $ +# $Id: summary.in,v 1.2 2003/12/04 16:23:38 drochner Exp $ # Perl version of (summary.sh, loop.awk, peer.awk): # Create summaries from xntpd's loop and peer statistics. # diff --git a/dist/ntp/sntp/header.h b/dist/ntp/sntp/header.h index 96904ad69ef2..e8879f12c1ca 100644 --- a/dist/ntp/sntp/header.h +++ b/dist/ntp/sntp/header.h @@ -1,4 +1,4 @@ -/* $NetBSD: header.h,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: header.h,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996 N.M. Maclaren Copyright (C) 1996 The University of Cambridge diff --git a/dist/ntp/sntp/internet.c b/dist/ntp/sntp/internet.c index 12179f3fbf4a..4ab530a82ef4 100644 --- a/dist/ntp/sntp/internet.c +++ b/dist/ntp/sntp/internet.c @@ -1,4 +1,4 @@ -/* $NetBSD: internet.c,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: internet.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996 N.M. Maclaren Copyright (C) 1996 The University of Cambridge diff --git a/dist/ntp/sntp/internet.h b/dist/ntp/sntp/internet.h index 08b80b6dd782..826a4ac456aa 100644 --- a/dist/ntp/sntp/internet.h +++ b/dist/ntp/sntp/internet.h @@ -1,4 +1,4 @@ -/* $NetBSD: internet.h,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: internet.h,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996 N.M. Maclaren Copyright (C) 1996 The University of Cambridge diff --git a/dist/ntp/sntp/kludges.h b/dist/ntp/sntp/kludges.h index 8604e81f6567..75c95c767e26 100644 --- a/dist/ntp/sntp/kludges.h +++ b/dist/ntp/sntp/kludges.h @@ -1,4 +1,4 @@ -/* $NetBSD: kludges.h,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: kludges.h,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996, 2000 N.M. Maclaren Copyright (C) 1996, 2000 The University of Cambridge diff --git a/dist/ntp/sntp/main.c b/dist/ntp/sntp/main.c index a927eff803fe..70bc19da25fd 100644 --- a/dist/ntp/sntp/main.c +++ b/dist/ntp/sntp/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: main.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996, 1997, 2000 N.M. Maclaren Copyright (C) 1996, 1997, 2000 The University of Cambridge diff --git a/dist/ntp/sntp/socket.c b/dist/ntp/sntp/socket.c index 1d4c2d7f5134..36d892900b89 100644 --- a/dist/ntp/sntp/socket.c +++ b/dist/ntp/sntp/socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: socket.c,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: socket.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996, 2000 N.M. Maclaren Copyright (C) 1996, 2000 The University of Cambridge diff --git a/dist/ntp/sntp/timing.c b/dist/ntp/sntp/timing.c index 7aeaae77cc0b..776517faebcd 100644 --- a/dist/ntp/sntp/timing.c +++ b/dist/ntp/sntp/timing.c @@ -1,4 +1,4 @@ -/* $NetBSD: timing.c,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: timing.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996 N.M. Maclaren Copyright (C) 1996 The University of Cambridge diff --git a/dist/ntp/sntp/unix.c b/dist/ntp/sntp/unix.c index 0464c479f406..60ae92afd10c 100644 --- a/dist/ntp/sntp/unix.c +++ b/dist/ntp/sntp/unix.c @@ -1,4 +1,4 @@ -/* $NetBSD: unix.c,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: unix.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1996 N.M. Maclaren Copyright (C) 1996 The University of Cambridge diff --git a/dist/ntp/stamp-h.in b/dist/ntp/stamp-h.in deleted file mode 100644 index 9788f70238c9..000000000000 --- a/dist/ntp/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/dist/ntp/util/ansi2knr.c b/dist/ntp/util/ansi2knr.c index 5c0205397efb..34ba2e7e6b35 100644 --- a/dist/ntp/util/ansi2knr.c +++ b/dist/ntp/util/ansi2knr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ansi2knr.c,v 1.1.1.2 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: ansi2knr.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */ diff --git a/dist/ntp/util/audio-pcm.c b/dist/ntp/util/audio-pcm.c index 204345cff958..34c439aa0e01 100644 --- a/dist/ntp/util/audio-pcm.c +++ b/dist/ntp/util/audio-pcm.c @@ -1,4 +1,4 @@ -/* $NetBSD: audio-pcm.c,v 1.1.1.1 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: audio-pcm.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * audio-pcm.c - Scope out the PCM audio stuff diff --git a/dist/ntp/util/byteorder.c b/dist/ntp/util/byteorder.c index 19f9009413db..fc0063e8c211 100644 --- a/dist/ntp/util/byteorder.c +++ b/dist/ntp/util/byteorder.c @@ -1,4 +1,4 @@ -/* $NetBSD: byteorder.c,v 1.1.1.1 2000/03/29 12:38:59 simonb Exp $ */ +/* $NetBSD: byteorder.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * This works on: diff --git a/dist/ntp/util/hist.c b/dist/ntp/util/hist.c index cbac07dd8ef3..9ec1b710d2bd 100644 --- a/dist/ntp/util/hist.c +++ b/dist/ntp/util/hist.c @@ -1,4 +1,4 @@ -/* $NetBSD: hist.c,v 1.1.1.2 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: hist.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * This program can be used to calibrate the clock reading jitter of a diff --git a/dist/ntp/util/jitter.c b/dist/ntp/util/jitter.c index 435077d5a837..0bf50c864b00 100644 --- a/dist/ntp/util/jitter.c +++ b/dist/ntp/util/jitter.c @@ -1,4 +1,4 @@ -/* $NetBSD: jitter.c,v 1.1.1.2 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: jitter.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * This program can be used to calibrate the clock reading jitter of a diff --git a/dist/ntp/util/kern.c b/dist/ntp/util/kern.c index 997c81e2b85f..00c48e9dada1 100644 --- a/dist/ntp/util/kern.c +++ b/dist/ntp/util/kern.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern.c,v 1.1.1.2 2003/12/04 16:05:34 drochner Exp $ */ +/* $NetBSD: kern.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * This program simulates a first-order, type-II phase-lock loop using diff --git a/dist/ntp/util/longsize.c b/dist/ntp/util/longsize.c index 713ca0bef0a7..fb2073ce1c60 100644 --- a/dist/ntp/util/longsize.c +++ b/dist/ntp/util/longsize.c @@ -1,4 +1,4 @@ -/* $NetBSD: longsize.c,v 1.1.1.1 2000/03/29 12:38:59 simonb Exp $ */ +/* $NetBSD: longsize.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ #include diff --git a/dist/ntp/util/ntp-keygen.c b/dist/ntp/util/ntp-keygen.c index c378c5e2fe52..478c9fd4b2ed 100644 --- a/dist/ntp/util/ntp-keygen.c +++ b/dist/ntp/util/ntp-keygen.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp-keygen.c,v 1.1.1.1 2003/12/04 16:05:35 drochner Exp $ */ +/* $NetBSD: ntp-keygen.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * Program to generate cryptographic keys for NTP clients and servers diff --git a/dist/ntp/util/ntp_genkeys.c b/dist/ntp/util/ntp_genkeys.c deleted file mode 100644 index 6324fffa47bc..000000000000 --- a/dist/ntp/util/ntp_genkeys.c +++ /dev/null @@ -1,240 +0,0 @@ -/* $NetBSD: ntp_genkeys.c,v 1.1.1.1 2000/04/22 14:54:31 simonb Exp $ */ - -/* - * Program to generate MD5 and RSA keys for NTP clients and servers - */ -#include -#include -#include -#include -#include "ntpd.h" -#include "ntp_stdlib.h" -#include "ntp_string.h" -#include "ntp_crypto.h" - -/* - * Cryptodefines - */ -#define MAXKEYLEN 1024 /* maximum encoded key length */ -#define MODULUSLEN 512 /* length of RSA modulus */ -#define PRIMELEN 512 /* length of D_H prime, generator */ -#define GENLEN 256 /* length of D-H key and subprime */ - -/* - * This program generates 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, and 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 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 containing the - * generating system DNS name and the second the 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. - */ -int -main( - int argc, - char *argv[] - ) -{ - 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 */ - u_char encoded_key[MAXKEYLEN]; /* encoded PEM string buffer */ - u_int modulus; /* modulus length */ - struct timeval tv; /* initialization vector */ - u_char hostname[256]; /* DNS host name */ - u_char filename[256]; /* public key file name */ - u_char md5key[17]; /* generated MD5 key */ - FILE *str; /* file handle */ - int rval; /* return value */ - u_int temp, len; - int i, j; - - /* - * Generate the file "ntp.keys" containing 16 random MD5 keys in - * the format expected at daemon run time. - */ - gethostname(&hostname, sizeof hostname); - printf("Generating MD5 keys...\n"); - str = fopen("ntp.keys", "w"); - if (str == NULL) { - perror("MD5/DES key file"); - return (-1); - } - gettimeofday(&tv, 0); - srandom((u_int)tv.tv_sec); - fprintf(str, "# MD5/DES key file generated by %s\n# %s", - hostname, ctime(&tv.tv_sec)); - for (i = 1; i <= 16; i++) { - for (j = 0; j < 16; j++) { - while (1) { - temp = random() & 0xff; - if (temp > 0x20 && temp < 0x7f) - break; - } - md5key[j] = (u_char)temp; - } - md5key[16] = 0; - fprintf(str, "%2d M %16s # MD5 key\n", i, - md5key); - } - fclose(str); - - /* - * Roll a RSA public/private key pair. - */ - printf("Generating RSA public/private key pair %d bits...\n", - MODULUSLEN); - 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 = fopen("ntpkey", "w"); - if (str == NULL) { - perror("RSA private key file"); - return (-1); - } - len = sizeof(rsaref_private) - sizeof(rsaref_private.bits); - modulus = (u_int32)rsaref_private.bits; - fprintf(str, "# RSA private key file generated by %s\n# %s", - hostname, 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); - fclose(str); - - /* - * Generate the file "ntpkey_host" containing the RSA public key - * in printable ASCII format. - */ - snprintf(filename, sizeof filename, "ntpkey_%s", hostname); - str = fopen(filename, "w"); - if (str == NULL) { - perror("RSA public key file"); - return (-1); - } - len = sizeof(rsaref_public) - sizeof(rsaref_public.bits); - modulus = (u_int32)rsaref_public.bits; - fprintf(str, "# RSA public key file generated by %s\n# %s", - hostname, 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); - fclose(str); - - /* - * Roll the prime and generator for the Diffie-Hellman key - * agreement algorithm. - */ - printf("Generating Diffie-Hellman parameters %d bits...\n", - PRIMELEN); - str = fopen("ntpkey_dh", "w"); - if (str == NULL) { - perror("Diffie-Hellman parameters file"); - return (-1); - } - 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, GENLEN, - &randomstr); - if (rval) { - printf("R_GenerateDHParams error %x\n", rval); - return (-1); - } - fprintf(str, - "# Diffie-Hellman parameter file generated by %s\n# %s", - hostname, 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); - fclose(str); - - return (0); -} diff --git a/dist/ntp/util/ntptime.c b/dist/ntp/util/ntptime.c index 8873ef470d1a..d935109c57da 100644 --- a/dist/ntp/util/ntptime.c +++ b/dist/ntp/util/ntptime.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntptime.c,v 1.1.1.2 2003/12/04 16:05:35 drochner Exp $ */ +/* $NetBSD: ntptime.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * NTP test program diff --git a/dist/ntp/util/pps-api.c b/dist/ntp/util/pps-api.c index 1f635e614084..ed15af07348c 100644 --- a/dist/ntp/util/pps-api.c +++ b/dist/ntp/util/pps-api.c @@ -1,4 +1,4 @@ -/* $NetBSD: pps-api.c,v 1.1.1.1 2003/12/04 16:05:35 drochner Exp $ */ +/* $NetBSD: pps-api.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* diff --git a/dist/ntp/util/precision.c b/dist/ntp/util/precision.c index dfdc917ded07..980dd5ea5cf6 100644 --- a/dist/ntp/util/precision.c +++ b/dist/ntp/util/precision.c @@ -1,4 +1,4 @@ -/* $NetBSD: precision.c,v 1.1.1.2 2003/12/04 16:05:35 drochner Exp $ */ +/* $NetBSD: precision.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ #include "ntp_unixtime.h" diff --git a/dist/ntp/util/sht.c b/dist/ntp/util/sht.c index b6dbdda99001..9331b7f35dab 100644 --- a/dist/ntp/util/sht.c +++ b/dist/ntp/util/sht.c @@ -1,4 +1,4 @@ -/* $NetBSD: sht.c,v 1.1.1.2 2003/12/04 16:05:35 drochner Exp $ */ +/* $NetBSD: sht.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* * sht.c - Testprogram for shared memory refclock diff --git a/dist/ntp/util/testrs6000.c b/dist/ntp/util/testrs6000.c index c0508c386174..585aaed07b90 100644 --- a/dist/ntp/util/testrs6000.c +++ b/dist/ntp/util/testrs6000.c @@ -1,4 +1,4 @@ -/* $NetBSD: testrs6000.c,v 1.1.1.1 2000/03/29 12:38:59 simonb Exp $ */ +/* $NetBSD: testrs6000.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ /* Checks for the RS/6000 AIX adjtime() bug, in which if a negative * offset is given, the system gets messed up and never completes the diff --git a/dist/ntp/util/tickadj.c b/dist/ntp/util/tickadj.c index 7d039e8bad7d..6ee5e5abab37 100644 --- a/dist/ntp/util/tickadj.c +++ b/dist/ntp/util/tickadj.c @@ -1,4 +1,4 @@ -/* $NetBSD: tickadj.c,v 1.2 2001/04/06 11:13:55 wiz Exp $ */ +/* $NetBSD: tickadj.c,v 1.3 2003/12/04 16:23:38 drochner Exp $ */ /* * tickadj - read, and possibly modify, the kernel `tick' and @@ -15,15 +15,14 @@ # include #endif +#include "ntp_types.h" +#include "l_stdlib.h" + #include -#include #ifdef HAVE_UNISTD_H # include #endif /* HAVE_UNISTD_H */ -#include "ntp_types.h" -#include "l_stdlib.h" - #ifdef HAVE___ADJTIMEX /* Linux */ #include @@ -113,7 +112,7 @@ main( if (argc > 2) { fprintf(stderr, "Usage: %s [tick_value]\n", argv[0]); - exit(1); + exit(-1); } else if (argc == 2) { @@ -124,7 +123,7 @@ main( #endif { fprintf(stderr, "Silly value for tick: %s\n", argv[1]); - exit(1); + exit(-1); } #ifdef ADJ_TIMETICK txc.modes = ADJ_TIMETICK; @@ -180,7 +179,6 @@ main( #ifdef NLIST_STRUCT # include #else /* not NLIST_STRUCT */ /* was defined(SYS_AUX3) || defined(SYS_AUX2) */ -# include # include # include # include @@ -759,8 +757,8 @@ getoffsets( else { (void) fprintf(stderr, - "%s: nlist didn't find needed symbols from <%s>: %m\n", - progname, *kname); + "%s: nlist didn't find needed symbols from <%s>: %s\n", + progname, *kname, strerror(errno)); } } if (*kname == NULL) diff --git a/dist/ntp/util/timetrim.c b/dist/ntp/util/timetrim.c index 1834aa02034e..b3bc3a5669bf 100644 --- a/dist/ntp/util/timetrim.c +++ b/dist/ntp/util/timetrim.c @@ -1,4 +1,4 @@ -/* $NetBSD: timetrim.c,v 1.1.1.2 2003/12/04 16:05:35 drochner Exp $ */ +/* $NetBSD: timetrim.c,v 1.2 2003/12/04 16:23:38 drochner Exp $ */ #if defined(sgi) || defined(_UNICOSMP) /*