diff --git a/usr.sbin/xntpd/COPYRIGHT b/usr.sbin/xntpd/COPYRIGHT index 321bc565b6a0..b9ce773f163a 100644 --- a/usr.sbin/xntpd/COPYRIGHT +++ b/usr.sbin/xntpd/COPYRIGHT @@ -55,4 +55,6 @@ * Torsten Duwe (Linux Port) * Paul A Vixie (TrueTime GPS driver) * Jim Jagielski (A/UX port) + * Ray Schnitzler (First pass at a Unixware1 port.) + * Ajit Thyagarajan (IP multicast support) */ diff --git a/usr.sbin/xntpd/Config.local b/usr.sbin/xntpd/Config.local index 4c5095c164da..22c12a36e90a 100644 --- a/usr.sbin/xntpd/Config.local +++ b/usr.sbin/xntpd/Config.local @@ -78,7 +78,7 @@ DEFS_OPT=-DDEBUG # special distribution. # # Note: following line must always start with DEFS_LOCAL= $(DEFS_OPT) -DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DPPSPPS -DKERNEL_PLL +DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DKERNEL_PLL -DMCAST # # Radio clock support definitions (these only make sense if -DREFCLOCK @@ -182,7 +182,7 @@ DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DPPSPPS -DKERNEL_PLL # under Ultrix 4.2a/3. If the MX4200 is removed, all the rest compile on a DEC # OSF/1 Alpha. # -CLOCKDEFS= -DLOCAL_CLOCK -DAS2201PPS -DCHU -DGOES -DIRIG -DMX4200PPS -DOMEGA -DPSTCLK -DTPRO -DWWVBCLK -DMSFEESPPS -DLEITCH +CLOCKDEFS= -DLOCAL_CLOCK -DAS2201PPS -DCHUPPS -DGOES -DIRIG -DMX4200PPS -DOMEGA -DPSTCLK -DTPRO -DWWVBCLK -DLEITCH # # Directory into which binaries should be installed (default /usr/local) diff --git a/usr.sbin/xntpd/RELNOTES b/usr.sbin/xntpd/RELNOTES index 1b9d9c02c3b3..411ef452195b 100644 --- a/usr.sbin/xntpd/RELNOTES +++ b/usr.sbin/xntpd/RELNOTES @@ -31,6 +31,10 @@ this distribution. To make these programs: For custom tailored configuration copying Config.local.dist to Config.local and editing Config.local to suit the local needs is neccessary (at most 3 lines to change), or use one of the make's above and then tweak it. + Config.local can also be used to override common settings from the + machines/* files like the AUTHDEFS= to select very specific configurations. + Please use this feature with care and don't be disappointed if it doesn't + work the way you expect. (2) Type "make" to compile everything of general interest. Expect few or no warnings using cc and a moderate level of warnings using gcc. @@ -140,6 +144,7 @@ the meal. The converse is not always true. PC BSD/386 1.0 gcc LOCAL_CLOCK possibly see "build problems" PC Linux (pl14) gcc LOCAL_CLOCK (dw 93/10/30) PC Dell SVR4 v2.2 gcc ? (tl 93/12/30) + PC Unixware1/SVR4 cc no tickadj, ? (ras 93/04/11) NCR3445 NCR SVR4 cc LOCAL_CLOCK (tm 93/11/29) pb: Piete Brooks @@ -149,6 +154,7 @@ the meal. The converse is not always true. tl: Tony Lill tm: Tom Moore jmj: Jim Jagielski + ras: Ray Schnitzler Build Problems (and workaround): diff --git a/usr.sbin/xntpd/VERSION b/usr.sbin/xntpd/VERSION index 084bc1a0e6f8..c145b870451f 100644 --- a/usr.sbin/xntpd/VERSION +++ b/usr.sbin/xntpd/VERSION @@ -1 +1 @@ -version=3.3p (beta) +version=3.3s (beta multicast) diff --git a/usr.sbin/xntpd/authstuff/authspeed.c b/usr.sbin/xntpd/authstuff/authspeed.c index c83d5b24497e..ecddbcd96ba1 100644 --- a/usr.sbin/xntpd/authstuff/authspeed.c +++ b/usr.sbin/xntpd/authstuff/authspeed.c @@ -2,7 +2,7 @@ * authspeed - figure out how LONG it takes to do an NTP encryption */ -#if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) +#if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) || defined(SYS_UNIXWARE1) #define FAKE_RUSAGE #endif diff --git a/usr.sbin/xntpd/conf/Config.local b/usr.sbin/xntpd/conf/Config.local index 12a6dfece755..22c12a36e90a 100644 --- a/usr.sbin/xntpd/conf/Config.local +++ b/usr.sbin/xntpd/conf/Config.local @@ -78,7 +78,7 @@ DEFS_OPT=-DDEBUG # special distribution. # # Note: following line must always start with DEFS_LOCAL= $(DEFS_OPT) -DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DPPSPPS -DKERNEL_PLL +DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DKERNEL_PLL -DMCAST # # Radio clock support definitions (these only make sense if -DREFCLOCK @@ -182,7 +182,7 @@ DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DPPSPPS -DKERNEL_PLL # under Ultrix 4.2a/3. If the MX4200 is removed, all the rest compile on a DEC # OSF/1 Alpha. # -CLOCKDEFS= -DLOCAL_CLOCK -DAS2201PPS -DCHUPPS -DGOES -DIRIG -DMX4200PPS -DOMEGA -DPSTCLK -DTPRO -DWWVBCLK -DMSFEESPPS -DLEITCH +CLOCKDEFS= -DLOCAL_CLOCK -DAS2201PPS -DCHUPPS -DGOES -DIRIG -DMX4200PPS -DOMEGA -DPSTCLK -DTPRO -DWWVBCLK -DLEITCH # # Directory into which binaries should be installed (default /usr/local) diff --git a/usr.sbin/xntpd/conf/Config.plain b/usr.sbin/xntpd/conf/Config.plain index c57c57810bf8..67dd70ad50e6 100644 --- a/usr.sbin/xntpd/conf/Config.plain +++ b/usr.sbin/xntpd/conf/Config.plain @@ -78,7 +78,7 @@ DEFS_OPT=-DDEBUG # special distribution. # # Note: following line must always start with DEFS_LOCAL= $(DEFS_OPT) -DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DKERNEL_PLL +DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DKERNEL_PLL -DMCAST # # Radio clock support definitions (these only make sense if -DREFCLOCK diff --git a/usr.sbin/xntpd/doc/README.kern b/usr.sbin/xntpd/doc/README.kern index 4f8df168622e..aac26fa2e62b 100644 --- a/usr.sbin/xntpd/doc/README.kern +++ b/usr.sbin/xntpd/doc/README.kern @@ -1,1857 +1,1374 @@ -Network Working Group D.L. Mills -Request for Comments: xxxx University of Delaware -Obsoletes: none February 1994 - - - A Kernel Model for Precision Timekeeping - + Revised 3 April 1994 -Status of this Memorandum +Note: This memorandum is a substantial revision of RFC-1589, "A Kernel +Model for Precision Timekeeping," March, 1994. It includes several +changes to the daemon and user interfaces, as well as a new feature +which disciplines the CPU clock oscillator in both time and frequency to +a source of precision time signals. This memorandum is included in the +distributions for the SunOS, Ultrix and OSF/1 kernels and in the NTP +Version 3 distribution (xntp3.v.tar.Z) as the file README.kern, where v +is the version identifier. Availability of the kernel distributions, +which involve licensed code, will be announced separately. The NTP +Version 3 distribution can be obtained via anonymous ftp from +louie.udel.edu in the directory pub/ntp. In order to utilize all +features of this distribution, the NTP version identifier should be 3q +or later. - This memorandum 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 and - phase-lock loops (PLL) and frequency-lock loops (FLL) often found in - the engineering literature. It has been implemented in the Unix - kernel for several workstations, including those made by Sun - Microsystems and Digital Equipment. The model changes the way the - system clock is adjusted in time and frequency, as well as provides - mechanisms to discipline its frequency to an external precision - timing source. The model incorporates a generic system-call interface - for use with the Network Time Protocol (NTP) or similar time - synchronization protocol. The NTP Version 3 daemon xntpd operates - with this model to provide synchronization limited in principle only - by the accuracy and stability of the external timing source. +Overview - This memorandum does not obsolete or update any RFC. It does not - propose a standard protocol, specification or algorithm. It is - intended to provoke comment, refinement and implementations for - kernels not considered herein. While a working knowledge of NTP is - not required for an understanding of the design principles or - implementation of the model, it may be helpful in understanding how - the model behaves in a fully functional timekeeping system. The - architecture and design of NTP is described in [MIL91], while the - current NTP Version 3 protocol specification is given in RFC-1305 - [MIL92a] and a subset of the protocol, the Simple Network Time - Protocol (SNTP), is given in RFC-1361 [MIL92c]. +This memorandum 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 and phase-lock +loops (PLL) and frequency-lock loops (FLL) often found in the +engineering literature. It has been implemented in the Unix kernels for +several workstations, including those made by Sun Microsystems and +Digital Equipment. The model changes the way the system clock is +adjusted in time and frequency, as well as provides mechanisms to +discipline its frequency to an external precision timing source. The +model incorporates a generic system-call interface for use with the +Network Time Protocol (NTP) or similar time synchronization protocol. +The NTP Version 3 daemon xntpd operates with this model to provide +synchronization limited in principle only by the accuracy and stability +of the external timing source. - The model has been implemented in three Unix kernels for Sun - Microsystems and Digital Equipment workstations. In addition, for the - Digital machines the model provides improved precision to one - microsecond (us). Since these specific implementations involve - modifications to licensed code, they cannot be provided directly. - Inquiries should be directed to the manufacturer's representatives. - However, 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 anonymous FTP from - host louie.udel.edu in the directory pub/ntp and compressed tar - archive kernel.tar.Z. The NTP Version 3 distribution can be obtained - via anonymous ftp from the same host and directory in the compressed - tar archive xntp3.3l.tar.Z, where the version number shown as 3.3l - may be adjusted for new versions as they occur. +This memorandum does not obsolete or update any RFC. It does not propose +a standard protocol, specification or algorithm. It is intended to +provoke comment, refinement and implementations for kernels not +considered herein. While a working knowledge of NTP is not required for +an understanding of the design principles or implementation of the +model, it may be helpful in understanding how the model behaves in a +fully functional timekeeping system. The architecture and design of NTP +is described in [MIL91], while the current NTP Version 3 protocol +specification is given in RFC-1305 [MIL92a] and a subset of the +protocol, the Simple Network Time Protocol (SNTP), is given in RFC-1361 +[MIL92c]. - - -Mills [Page 1] - -RFC February 1994 +The model has been implemented in the Unix kernels for three Sun +Microsystems and Digital Equipment workstations. In addition, for the +Digital machines the model provides improved precision to one +microsecond (us). Since these specific implementations involve +modifications to licensed code, they cannot be provided directly. +Inquiries should be directed to the manufacturer's representatives. +However, 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 anonymous FTP from +host louie.udel.edu in the directory pub/ntp and compressed tar archive +kernel.tar.Z. The NTP Version 3 distribution can be obtained via +anonymous ftp from the same host and directory in the compressed tar +archive xntp3.3q.tar.Z, where the version number shown as 3.3q may be +adjusted for new versions as they occur. 1. Introduction - This memorandum describes a model and programming interface for - generic operating system software that manages the system clock and - timer functions. The model provides improved accuracy and stability - for most computers using the Network Time Protocol (NTP) or similar - time synchronization protocol. This memorandum describes the design - principles and implementations of the model, while related technical - reports discuss the design approach, engineering analysis and - performance evaluation of the model as implemented in Unix kernels - for modern workstations. The NTP Version 3 daemon xntpd operates with - these implementations to provide improved accuracy and stability, - together with diminished overhead in the operating system and - network. In addition, the model supports the use of external timing - sources, such as precision pulse-per-second (PPS) signals and the - industry standard IRIG timing signals. The NTP daemon automatically - detects the presence of the new features and utilizes them when - available. +This memorandum describes a model and programming interface for generic +operating system software that manages the system clock and timer +functions. The model provides improved accuracy and stability for most +computers using the Network Time Protocol (NTP) or similar time +synchronization protocol. This memorandum describes the design +principles and implementations of the model, while related technical +reports discuss the design approach, engineering analysis and +performance evaluation of the model as implemented in Unix kernels for +modern workstations. The NTP Version 3 daemon xntpd operates with these +implementations to provide improved accuracy and stability, together +with diminished overhead in the operating system and network. In +addition, the model supports the use of external timing sources, such as +precision pulse-per-second (PPS) signals and the industry standard IRIG +timing signals. The NTP daemon automatically detects the presence of the +new features and utilizes them when available. - There are three prototype implementations of the model presented in - this memorandum, one each for the Sun Microsystems SPARCstation with - the SunOS 4.1.x kernel, Digital Equipment DECstation 5000 with the - Ultrix 4.x kernel and Digital Equipment 3000 AXP Alpha with the OSF/1 - V1.x kernel. In addition, for the DECstation 5000/240 and 3000 AXP - Alpha machines, a special feature provides improved precision to 1 us - (stock Sun kernels already do provide this precision). Other than - improving the system clock accuracy, stability and precision, these - implementations do not change the operation of existing Unix system - calls which manage the system clock, such as gettimeofday(), - settimeofday() and adjtime(); however, if the new features are in - use, the operations of gettimeofday() and adjtime() can be controlled - instead by new system calls ntp_gettime() and ntp_adjtime() as - described below. +There are three prototype implementations of the model presented in this +memorandum, one each for the Sun Microsystems SPARCstation with the +SunOS 4.1.x kernel, Digital Equipment DECstation 5000 with the Ultrix +4.x kernel and Digital Equipment 3000 AXP Alpha with the OSF/1 V1.x +kernel. In addition, for the DECstation 5000/240 and 3000 AXP Alpha +machines, a special feature provides improved precision to 1 us (stock +Sun kernels already do provide this precision). Other than improving the +system clock accuracy, stability and precision, these implementations do +not change the operation of existing Unix system calls which manage the +system clock, such as gettimeofday(), settimeofday() and adjtime(); +however, if the new features are in use, the operations of +gettimeofday() and adjtime() can be controlled instead by new system +calls ntp_gettime() and ntp_adjtime() as described below. - A detailed description of the variables and algorithms that operate - upon them is given in the hope that similar functionality can be - incorporated in Unix kernels for other machines. The algorithms - involve only minor changes to the system clock and interval timer - routines and include interfaces for application programs to learn the - system clock status and certain statistics of the time - synchronization process. Detailed installation instructions are given - in a specific README files included in the kernel distributions. +A detailed description of the variables and algorithms that operate upon +them is given in the hope that similar functionality can be incorporated +in Unix kernels for other machines. The algorithms involve only minor +changes to the system clock and interval timer routines and include +interfaces for application programs to learn the system clock status and +certain statistics of the time synchronization process. Detailed +installation instructions are given in a specific README files included +in the kernel distributions. - In this memorandum, NTP Version 3 and the Unix implementation xntp3 - are used as an example application of the new system calls for use by - a synchronization daemon. In principle, the new system calls can be - used by other protocols and implementations as well. Even in cases - where the local time is maintained by periodic exchanges of messages - at relatively long intervals, such as using the NIST Automated - Computer Time Service [LEV89], the ability to precisely adjust the - system clock frequency simplifies the synchronization procedures and - allows the telephone call frequency to be considerably reduced. - - - - -Mills [Page 2] - -RFC February 1994 +In this memorandum, NTP Version 3 and the Unix implementation xntp3 are +used as an example application of the new system calls for use by a +synchronization daemon. In principle, these system calls can be used by +other protocols and implementations as well. Even in cases where the +local time is maintained by periodic exchanges of messages at relatively +long intervals, such as using the NIST Automated Computer Time Service +[LEV89], the ability to precisely adjust the system clock frequency +simplifies the synchronization procedures and allows the telephone call +frequency to be considerably reduced. 2. Design Approach - While not strictly necessary for an understanding or implementation - of the model, it may be helpful to briefly describe how NTP operates - to control the system clock in a client computer. As described in - [MIL91], the NTP protocol exchanges timestamps with one or more peers - sharing a synchronization subnet to calculate the time offsets - between peer clocks and the local clock. These offsets are processed - by several algorithms which refine and combine the offsets to produce - an ensemble average, which is then used to adjust the local clock - time and frequency. The manner in which the local clock is adjusted - represents the main topic of this memorandum. The goal in the - enterprise is the most accurate and stable system clock possible with - the available computer hardware and kernel software. +While not strictly necessary for an understanding or implementation of +the model, it may be helpful to briefly describe how NTP operates to +control the system clock in a client computer. As described in [MIL91], +the NTP protocol exchanges timestamps with one or more peers sharing a +synchronization subnet to calculate the time offsets between peer clocks +and the local clock. These offsets are processed by several algorithms +which refine and combine the offsets to produce an ensemble average, +which is then used to adjust the local clock time and frequency. The +manner in which the local clock is adjusted represents the main topic of +this memorandum. The goal in the enterprise is the most accurate and +stable system clock possible with the available computer hardware and +kernel software. - In order to understand how the new model works, it is useful to - review how most Unix kernels maintain the system time. In the Unix - design a hardware counter interrupts the kernel at a fixed rate: 100 - Hz in the SunOS kernel, 256 Hz in the Ultrix kernel and 1024 Hz in - the OSF/1 kernel. Since the Ultrix timer interval (reciprocal of the - rate) does not evenly divide one second in microseconds, the Ultrix - kernel adds 64 microseconds once each second, so the timescale - consists of 255 advances of 3906 us plus one of 3970 us. Similarly, - the OSF/1 kernel adds 576 us once each second, so its timescale - consists of 1023 advances of 976 us plus one of 1552 us. +In order to understand how the new model works, it is useful to review +how most Unix kernels maintain the system clock. In the Unix design a +hardware counter interrupts the kernel at a fixed rate: 100 Hz in the +SunOS kernel, 256 Hz in the Ultrix kernel and 1024 Hz in the OSF/1 +kernel. Since the Ultrix timer interval (reciprocal of the rate) does +not evenly divide one second in microseconds, the kernel adds 64 us once +each second, so the timescale consists of 255 advances of 3906 us plus +one of 3970 us. Similarly, the OSF/1 kernel adds 576 us once each +second, so its timescale consists of 1023 advances of 976 us plus one of +1552 us. - 2.1. Mechanisms to Adjust Time and Frequency +2.1. Mechanisms to Adjust Time and Frequency - In most Unix kernels it is possible to slew the system clock to a - new offset relative to the current time by using the adjtime() - system call. To do this the clock frequency is changed by adding - or subtracting a fixed amount (tickadj) at each timer interrupt - (tick) for a calculated number of interrupts. Since this - calculation involves dividing the requested offset by tickadj, it - is possible to slew to a new offset with a precision only of - tickadj, which is usually in the neighborhood of 5 us, but - sometimes much more. This results in a roundoff error which can - accumulate to an unacceptable degree, so that special provisions - must be made in the clock adjustment procedures of the - synchronization daemon. +In most Unix kernels it is possible to slew the system clock to a new +offset relative to the current time by using the adjtime() system call. +To do this the clock frequency is changed by adding or subtracting a +fixed amount (tickadj) at each timer interrupt (tick) for a calculated +number of timer interrupts. Since this calculation involves dividing the +requested offset by tickadj, it is possible to slew to a new offset with +a precision only of tickadj, which is usually in the neighborhood of 5 +us, but sometimes much larger. This results in a roundoff error which +can accumulate to an unacceptable degree, so that special provisions +must be made in the clock adjustment procedures of the synchronization +daemon. - In order to implement a frequency discipline function, it is - necessary to provide time offset adjustments to the kernel at - regular adjustment intervals using the adjtime() system call. In - order to reduce the system clock jitter to the regime consistent - with the model, it is necessary that the adjustment interval be - relatively small, in the neighborhood of 1 s. However, the Unix - adjtime() implementation requires each offset adjustment to - complete before another one can be begun, which means that large - adjustments must be amortized over possibly many adjustment - intervals. The requirement to implement the adjustment interval - and compensate for roundoff error considerably complicates the - synchronizing daemon implementation. +In order to implement a frequency discipline function, it is necessary +to provide time offset adjustments to the kernel at regular adjustment +intervals using the adjtime() system call. In order to reduce the system +clock jitter to the regime consistent with the model, it is necessary +that the adjustment interval be relatively small, in the neighborhood of +1 s. However, the Unix adjtime() implementation requires each offset +adjustment to complete before another one can be begun, which means that +large adjustments must be amortized over possibly many adjustment +intervals. The requirement to implement the adjustment interval and +compensate for roundoff error considerably complicates the synchronizing +daemon implementation. +In the new model this scheme is replaced by another that represents the +system clock as a multiple-word, precision-time variable in order to +provide very precise clock adjustments. At each timer interrupt a +precisely calibrated quantity is added to the kernel time variable and +overflows propagated as required. The quantity is computed as in the NTP +local clock model described in [MIL92b], which operates as an adaptive- +parameter, first-order, type-II phase-lock loop (PLL). In principle, +this PLL design can provide precision control of the system clock +oscillator within 1 us and frequency to within parts in 10^11. While +precisions of this order are surely well beyond the capabilities of the +CPU clock oscillator used in typical workstations, they are appropriate +using precision external oscillators, as described below. +The PLL design is identical to the one originally implemented in NTP and +described in [MIL92b]. In the original design the software daemon +simulates the PLL using the adjtime() system call; however, the daemon +implementation is considerably complicated by the considerations +described above. The modified kernel routines implement the PLL in the +kernel using precision time and frequency representations, so that these +complications are avoided. A new system call ntp_adjtime() is called +only as each new time update is determined, which in NTP occurs at +intervals of from 16 s to 1024 s. In addition, doing frequency +compensation in the kernel means that the system clock runs true even if +the daemon were to cease operation or the network paths to the primary +synchronization source fail. -Mills [Page 3] +In the new model the new ntp_adjtime() operates in a way similar to the +original adjtime() system call, but does so independently of adjtime(), +which continues to operate in its traditional fashion. When used with +NTP, it is the design intent that settimeofday() or adjtime() be used +only for system clock adjustments greater than +-128 ms, although the +dynamic range of the new model is much larger at +-512 ms. It has been +the Internet experience that the need to change the system clock in +increments greater than +-128 ms is extremely rare and is usually +associated with a hardware or software malfunction or system reboot. -RFC February 1994 +The easiest way to set the time is with the settimeofday() system call; +however, this can under some conditions cause the clock to jump +backwards. If this cannot be tolerated, adjtime() can be used to slew +the clock to the new value without running backward or affecting the +frequency discipline process. Once the system clock has been set within ++-128 ms, the ntp_adjtime() system call is used to provide periodic +updates including the time offset, maximum error, estimated error and +PLL time constant. With NTP the update interval and time constant depend +on the measured delay and dispersion; however, the scheme is quite +forgiving and neither moderate loss of updates nor variations in the +update interval are serious. - In the new model this scheme is replaced by another that - represents the system clock as a multiple-word, precision-time - variable in order to provide very precise clock adjustments. At - each timer interrupt a precisely calibrated quantity is added to - the kernel time variable and overflows propagated as required. The - quantity is computed as in the NTP local clock model described in - [MIL92b], which operates as an adaptive-parameter, first-order, - type-II phase-lock loop (PLL). In principle, this PLL design can - provide precision control of the system clock oscillator within 1 - us and frequency to within parts in 10^11. While precisions of - this order are surely well beyond the capabilities of the CPU - clock oscillator used in typical workstations, they are - appropriate using precision external oscillators as described - below. +2.2 Daemon and Application Interface - The PLL design is identical to the one originally implemented in - NTP and described in [MIL92b]. In this design the software daemon - simulates the PLL using the adjtime() system call; however, the - daemon implementation is considerably complicated by the - considerations described above. The modified kernel routines - implement the PLL in the kernel using precision time and frequency - representions, so that these complications are avoided. A new - system call ntp_adjtime() is called only as each new time update - is determined, which in NTP occurs at intervals of from 16 s to - 1024 s. In addition, doing frequency compensation in the kernel - means that the system time runs true even if the daemon were to - cease operation or the network paths to the primary - synchronization source fail. +Unix application programs can read the system clock using the +gettimeofday() system call, which returns only the system time and +timezone data. For some applications it is useful to know the maximum +error of the reported time due to all causes, including clock reading +errors, oscillator frequency errors and accumulated latencies on the +path to the primary synchronization source. However, in the new model +the PLL adjusts the system clock to compensate for its intrinsic +frequency error, so that the time error expected in normal operation +will usually be much less than the maximum error. The programming +interface includes a new system call ntp_gettime(), which returns the +system time, as well as the maximum error and estimated error. This +interface is intended to support applications that need such things, +including distributed file systems, multimedia teleconferencing and +other real-time applications. The programming interface also includes a +new system call ntp_adjtime(), which can be used to read and write +kernel variables for time and frequency adjustment, PLL time constant, +leap-second warning and related data. - In the new model the new ntp_adjtime() operates in a way similar - to the original adjtime() system call, but does so independently - of adjtime(), which continues to operate in its traditional - fashion. When used with NTP, it is the design intent that - settimeofday() or adjtime() be used only for system time - adjustments greater than +-128 ms, although the dynamic range of - the new model is much larger at +-512 ms. It has been the Internet - experience that the need to change the system time in increments - greater than +-128 ms is extremely rare and is usually associated - with a hardware or software malfunction or system reboot. +In addition, the kernel adjusts the indicated maximum error to grow by +an amount equal to the maximum oscillator frequency tolerance times the +elapsed time since the last update. The default engineering parameters +have been optimized for update intervals in the order of 64 s. As shown +in [MIL93], this is near the optimum interval for NTP used with ordinary +room-temperature quartz oscillators. For other intervals the PLL time +constant can be adjusted to optimize the dynamic response over intervals +of 16-1024 s. Normally, this is automatically done by NTP. In any case, +if updates are suspended, the PLL coasts at the frequency last +determined, which usually results in errors increasing only to a few +tens of milliseconds over a day using typical modern workstations. - The easiest way to set the time is with the settimeofday() system - call; however, this can under some conditions cause the clock to - jump backwards. If this cannot be tolerated, adjtime() can be used - to slew the clock to the new value without running backward or - affecting the frequency discipline process. Once the system clock - has been set within +-128 ms, the ntp_adjtime() system call is - used to provide periodic updates including the time offset, - maximum error, estimated error and PLL time constant. With NTP the - update interval and time constant depend on the measured delay and - dispersion; however, the scheme is quite forgiving and neither - moderate loss of updates nor variations in the update interval are - serious. +While any synchronization daemon can in principle be modified to use the +new system calls, the most likely will be users of the NTP Version 3 +daemon xntpd. The xntpd code determines whether the new system calls are +implemented and automatically reconfigures as required. When +implemented, the daemon reads the frequency offset from a system file +and provides it and the initial time constant via ntp_adjtime(). In +subsequent calls to ntp_adjtime(), only the time offset and time +constant are affected. The daemon reads the frequency from the kernel +using ntp_adjtime() at intervals of about one hour and writes it to a +system file. This information is recovered when the daemon is restarted +after reboot, for example, so the sometimes extensive training period to +learn the frequency separately for each oscillator can be avoided. +2.3. Precision Clocks for DECstation 5000/240 and 3000 AXP Alpha +The stock microtime() routine in the Ultrix kernel for Digital Equipment +MIPS-based workstations returns system time to the precision of the +timer interrupt interval, which is in the 1-4 ms range. However, in the +DECstation 5000/240 and possibly other machines of that family, there is +an undocumented IOASIC hardware register that counts system bus cycles +at a rate of 25 MHz. The new microtime() routine for the Ultrix kernel +uses this register to interpolate system time between timer interrupts. +This results in a precision of 1 us for all time values obtained via the +gettimeofday() and ntp_gettime() system calls. For the Digital Equipment +3000 AXP Alpha, the architecture provides a hardware Process Cycle +Counter and a machine instruction (rpcc) to read it. This counter +operates at the fundamental frequency of the CPU clock or some +submultiple of it, 133.333 MHz for the 3000/400 for example. The new +microtime() routine for the OSF/1 kernel uses this counter in the same +fashion as the Ultrix routine. Support for this feature is conditionally +compiled in the kernel only if the MICRO option is used in the kernel +configuration file. +In both the Ultrix and OSF/1 kernels the gettimeofday() and +ntp_gettime() system call use the new microtime() routine, which returns +the interpolated value to 1-us resolution, but does not change the +kernel time variable. Therefore, other routines that access the kernel +time variable directly and do not call either gettimeofday(), +ntp_gettime() or microtime() will continue their present behavior. The +microtime() feature is independent of other features described here and +is operative even if the kernel PLL or new system calls have not been +implemented. -Mills [Page 4] +The SunOS kernel already includes a system clock with 1-us resolution; +so, in principle, no microtime() routine is necessary. An existing +kernel routine uniqtime() implements this function, but it is coded in +the C language and is rather slow at 42-85 us per call on a SPARCstation +IPC. A replacement microtime() routine coded in assembler language is +available in the NTP Version 3 distribution and is much faster at about +3 us per call. Note that, as explained later, this routine should be +called at an interrupt priority level not greater than that of the timer +interrupt routine. Otherwise, it is possible to miss a tick increment, +with result the time returned can be late by one tick. This is always +true in the case of gettimeofday() and ntp_gettime(), but might not be +true in other cases, such as when using the PPS signal described later +in this memorandum. -RFC February 1994 +2.4. External Time and Frequency Discipline - 2.2 Daemon and Application Interface +The overall accuracy of a time synchronization subnet with respect to +Coordinated Universal Time (UTC) depends on the accuracy and stability +of the primary synchronization source, usually a radio or satellite +receiver, and the CPU clock oscillator of the primary server. As +discussed in [MIL93], the traditional interface using a ASCII serial +timecode and RS232 port precludes the full accuracy of most radio +clocks. In addition, the poor frequency stability of typical CPU clock +oscillators limits the accuracy, whether or not precision time sources +are available. There are, however, several ways in which the system +clock accuracy and stability can be improved to the degree limited only +by the accuracy and stability of the synchronization source and the +jitter of the interface and operating system. - Unix application programs can read the system clock using the - gettimeofday() system call, which returns only the system time and - timezone data. For some applications it is useful to know the - maximum error of the reported time due to all causes, including - clock reading errors, oscillator frequency errors and accumulated - latencies on the path to the primary synchronization source. - However, in the new model the PLL adjusts the system clock to - compensate for its intrinsic frequency error, so that the time - errors expected in normal operation will usually be much less than - the maximum error. The programming interface includes a new system - call ntp_gettime(), which returns the system time, as well as the - maximum error and estimated error. This interface is intended to - support applications that need such things, including distributed - file systems, multimedia teleconferencing and other real-time - applications. The programming interface also includes a new system - call ntp_adjtime(), which can be used to read and write kernel - variables for time and frequency adjustment, PLL time constant, - leap-second warning and related data. +Many radio clocks produce special signals that can be used by external +equipment to precisely synchronize time and frequency. Most produce a +pulse-per-second (PPS) signal that can be read via a modem-control lead +of a serial port and some produce a special IRIG signal that can be read +directly by a bus peripheral, such as the KSI/Odetics TPRO IRIG SBus +interface, or indirectly via the audio codec of some workstations, as +described in [MIL93]. In the NTP Version 3 daemon xntpd, the PPS signal +can be used to augment the less precise ASCII serial timecode to improve +accuracy to the order of a few tens of microseconds. Support is also +included in the NTP distribution for the TPRO interface, as well as the +audio codec; however, the latter requires a modified kernel audio driver +contained in the compressed tar archive bsd_audio.tar.Z in the same host +and directory as the NTP Version 3 distribution mentioned previously. +2.4.1. PPS Signal - In addition, the kernel adjusts the maximum error to grow by an - amount equal to the oscillator frequency tolerance times the - elapsed time since the last update. The default engineering - parameters have been optimized for update intervals in the order - of 64 s. As shown in [MIL93], this is near the optimum interval - for NTP used with ordinary room-temperature quartz oscillators. - For other intervals the PLL time constant can be adjusted to - optimize the dynamic response over intervals of 16-1024 s. - Normally, this is automatically done by NTP. In any case, if - updates are suspended, the PLL coasts at the frequency last - determined, which usually results in errors increasing only to a - few tens of milliseconds over a day using typical modern - workstations. +The most convenient way to interface a PPS signal to a computer is +usually with a serial port and RS232-compatible signal; however, the PPS +signal produced by most radio clocks and laboratory instruments is +usually a TTL pulse signal. Therefore, some kind of level +converter/pulse generator is necessary to adapt the PPS signal to a +serial port. An example design, including schematic and printed-circuit +board artwork, is in the compressed tar archive gadget.tar.Z in the same +host and directory as the NTP Version 3 distribution mentioned +previously. There are several ways the PPS signal can be used in +conjunction with the NTP Version 3 daemon xntpd, as described in [MIL93] +and in the documentation included in the distribution. - While any synchronization daemon can in principle be modified to - use the new system calls, the most likely will be users of the NTP - Version 3 daemon xntpd. The xntpd code determines whether the new - system calls are implemented and automatically reconfigures as - required. When implemented, the daemon reads the frequency offset - from a file and provides it and the initial time constant via - ntp_adjtime(). In subsequent calls to ntp_adjtime(), only the time - offset and time constant are affected. The daemon reads the - frequency from the kernel using ntp_adjtime() at intervals of - about one hour and writes it to a system file. This information is - recovered when the daemon is restarted after reboot, for example, - so the sometimes extensive training period to learn the frequency - separately for each system can be avoided. +The NTP Version 3 distribution includes a special ppsclock module for +the SunOS 4.1.x kernel that captures the PPS signal presented via a +modem-control lead of a serial port. Normally, the ppsclock module +produces a timestamp at each transition of the PPS signal and provides +it to the synchronization daemon for integration with the serial ASCII +timecode, also produced by the radio clock. With the conventional PLL +implementation in either the daemon or the kernel as described in +[MIL93], the accuracy of this scheme is limited by the intrinsic +stability of the CPU clock oscillator to a millisecond or two, depending +on environmental temperature variations. - 2.3. Precision Clocks for DECstation 5000/240 and 3000 AXP Alpha +The ppsclock module has been modified to in addition call a new kernel +routine hardpps() once each second. In addition, the Ultrix 4.3 kernel +has been modified to provide a similar functionality. The hardpps() +routine compares the timestamp with a sample of the CPU clock oscillator +in order to discipline the oscillator to the time and frequency of the +PPS signal. Using this method, the time accuracy is improved to +typically 20 us or less and frequency stability a few parts in 10^8, +which is about two orders of magnitude better than the undisciplined +oscillator. The new feature is conditionally compiled in the code +described below only if the PPS_SYNC option is used in the kernel +configuration file. - The stock microtime() routine in the Ultrix kernel returns system - time to the precision of the timer interrupt interval, which is in - the 1-4 ms range. However, in the DECstation 5000/240 and possibly +When using the PPS signal to adjust the time, there is a problem with +some kernels which is very difficult to fix. The serial port interrupt +routine often operates at an interrupt priority level above the timer +interrupt routine. Thus, as explained below, it is possible that a tick +increment can be missed and the time returned late by one tick. It may +happen that, if the CPU clock oscillator frequency is close to the PPS +oscillator frequency (less than a few ppm), this condition can persist +for two or more successive PPS interrupts. A useful workaround in the +code is to use a glitch detector and median filter to process the PPS +sample offsets. The glitch detector suppresses offset bursts greater +than half the tick interval and which last less than 30 successive PPS +interrupts. The median filter ranks the offsets in a moving window of +three samples and uses the median as the output and the difference +between the other two as a dispersion measure. +2.4.2. External Clocks -Mills [Page 5] +It is possible to replace the system clock function with an external bus +peripheral. The TPRO device mentioned previously can be used to provide +IRIG-synchronized time with a precision of 1 us. A driver for this +device tprotime.c and header file tpro.h are included in the +kernel.tar.Z distribution mentioned previously. Using this device, the +system clock is read directly from the interface; however, the device +does not record the year, so special provisions have been made to obtain +the year from the kernel time variable and initialize the driver +accordingly. Support for this feature is conditionally compiled in the +kernel only if the EXT_CLOCK and TPRO options are used in the kernel +configuration file. -RFC February 1994 +While the system clock function is provided directly by the microtime() +routine in the driver, the kernel time variable must be disciplined as +well, since not all system timing functions use the microtime() routine. +This is done by measuring the time difference between the microtime() +clock and kernel time variable and using it to adjust the kernel PLL as +if the adjustment were provided by an external peer and NTP. - other machines of that family, there is an undocumented IOASIC - hardware register that counts system bus cycles at a rate of 25 - MHz. The new microtime() routine for the Ultrix kernel uses this - register to interpolate system time between timer interrupts. This - results in a precision of 1 us for all time values obtained via - the gettimeofday() and ntp_gettime() system calls. For the Digital - Equipment 3000 AXP Alpha, the architecture provides a hardware - Process Cycle Counter and a machine instruction rpcc to read it. - This counter operates at the fundamental frequency of the CPU - clock or some submultiple of it, 133.333 MHz for the 3000/400 for - example. The new microtime() routine for the OSF/1 kernel uses - this counter in the same fashion as the Ultrix routine. +A good deal of error checking is done in the TPRO driver, since the +system clock is vulnerable to a misbehaving radio clock, IRIG signal +source, interface cables and TPRO device itself. Unfortunately, there is +no practical way to utilize the extensive diversity and redundancy +capabilities available in the NTP synchronization daemon. In order to +avoid disruptions that might occur if the TPRO time is far different +from the kernel time variable, the latter is used instead of the former +if the difference between the two exceeds 1000 s; presumably in that +case operator intervention is required. - In both the Ultrix and OSF/1 kernels the gettimeofday() and - ntp_gettime() system call use the new microtime() routine, which - returns the actual interpolated value, but does not change the - kernel time variable. Therefore, other routines that access the - kernel time variable directly and do not call either - gettimeofday(), ntp_gettime() or microtime() will continue their - present behavior. The microtime() feature is independent of other - features described here and is operative even if the kernel PLL or - new system calls have not been implemented. +2.4.2. External Oscillators - The SunOS kernel already includes a system clock with 1-us - resolution; so, in principle, no microtime() routine is necessary. - An existing kernel routine uniqtime() implements this function, - but it is coded in the C language and is rather slow at 42-85 us - per call on a SPARCstation IPC. A replacement microtime() routine - coded in assembler language is available in the NTP Version 3 - distribution and is much faster at about 3 us per call. Note that - this routine must be called at an interrupt priority level not - greater than that of the timer interrupt routine. Otherwise, it is - possible to miss a tick increment, with result the time returned - can be early by one tick. This is always true in the case of - gettimeofday() and ntp_gettime(), but might not be true in other - cases. +Even if a source of PPS or IRIG signals is not available, it is still +possible to improve the stability of the system clock through the use of +a specialized bus peripheral. In order to explore the benefits of such +an approach, a special SBus peripheral called HIGHBALL has been +constructed. The device includes a pair of 32-bit hardware counters in +Unix timeval format, together with a precision, oven-controlled quartz +oscillator with a stability of a few parts in 10^9. A driver for this +device hightime.c and header file high.h are included in the +kernel.tar.Z distribution mentioned previously. Support for this feature +is conditionally compiled in the kernel only if the EXT_CLOCK and +HIGHBALL options are used in the kernel configuration file. - 2.4. External Time and Frequency Discipline +Unlike the external clock case, where the system clock function is +provided directly by the microtime() routine in the driver, the HIGHBALL +counter offsets with respect to UTC must be provided first. This is done +using the ordinary kernel PLL, but controlling the counter offsets +directly, rather than the kernel time variable. At first, this might +seem to defeat the purpose of the design, since the jitter and wander of +the synchronization source will affect the counter offsets and thus the +accuracy of the time. However, the jitter is much reduced by the PLL and +the wander is small, especially if using a radio clock or another +primary server disciplined in the same way. In practice, the scheme +works to reduce the incidental wander to a few parts in 10^8, or about +the same as using the PPS signal. - The overall accuracy of a time synchronization subnet with respect - to Coordinated Universal Time (UTC) depends on the accuracy and - stability of the primary synchronization source, usually a radio - or satellite receiver, and the CPU clock oscillator of the primary - server. As discussed in [MIL93], the traditional interface using - an RS232 protocol and serial port precludes the full accuracy of - most radio clocks. In addition, the poor frequency stability of - typical CPU clock oscillators limits the accuracy, whether or not - precision time sources are available. There are, however, several - ways in which the system clock accuracy and stability can be - improved to the degree limited only by the accuracy and stability - of the synchronization source and the jitter of the operating - system. +As in the previous case, the kernel time variable must be disciplined as +well, since not all system timing functions use the microtime() routine. +However, the kernel PLL cannot be used for this, since it is already in +use providing offsets for the HIGHBALL counters. Therefore, a special +correction is calculated from the difference between the microtime() +clock and the kernel time variable and used to adjust the kernel time +variable at the next timer interrupt. This somewhat roundabout approach +is necessary in order that the adjustment does not cause the kernel time +variable to jump backwards and possibly lose or duplicate a timer event. +2.5 Other Features - - -Mills [Page 6] - -RFC February 1994 - - Many radio clocks produce special signals that can be used by - external equipment to precisely synchronize time and frequency. - Most produce a pulse-per-second (PPS) signal that can be read via - a modem-control lead of a serial port and some produce a special - IRIG signal that can be read directly by a bus peripheral, such as - the KSI/Odetics TPRO IRIG SBus interface, or indirectly via the - audio codec of some workstations, as described in [MIL93]. In the - NTP Version 3 daemon xntpd, the PPS signal can be used to augment - the less precise ASCII serial timecode to improve accuracy to the - order of a few tens of microseconds. Support is also included in - the NTP distribution for the TPRO interface, as well as the audio - codec; however, the latter requires a modified kernel audio driver - contained in the bsd_audio.tar.Z distribution in the same host and - directory as the NTP Version 3 distribution mentioned previously. - - 2.4.1. PPS Signal - - The NTP Version 3 distribution includes a special ppsclock - module for the SunOS 4.1.x kernel that captures the PPS signal - presented via a modem-control lead of a serial port. Normally, - the ppsclock module produces a timestamp at each transition of - the PPS signal and provides it to the synchronization daemon - for integration with the serial ASCII timecode, also produced - by the radio clock. With the conventional PLL implementation in - either the daemon or the kernel as described above, the - accuracy of this scheme is limited by the intrinsic stability - of the CPU clock oscillator to a millisecond or two, depending - on environmental temperature variations. - - The ppsclock module has been modified to in addition call a new - kernel routine hardpps() once each second. The kernel routine - compares the timestamp with a sample of the CPU clock - oscillator to develop a frequency offset estimate. This offset - is used to discipline the oscillator frequency, nominally to - within a few parts in 10^8, which is about two orders of - magnitude better than the undisciplined oscillator. The new - feature is conditionally compiled in the code described below - only if the PPS_SYNC option is used in the kernel configuration - file. - - When using the PPS signal to adjust the time, there is a - problem with the SunOS implementation which is very delicate to - fix. The Sun serial port interrupt routine operates at - interrupt priority level 12, while the timer interrupt routine - operates at priority 10. Thus, it is possible that the PPS - signal interrupt can occur during the timer interrupt routine, - with result that a tick increment can be missed and the - returned time early by one tick. It may happen that, if the CPU - clock oscillator is within a few ppm of the PPS oscillator, - this condition can persist for two or more successive PPS - interrupts. A useful workaround has been to use a median filter - to process the PPS sample offsets. In this filter the sample - offsets in a window of 20 samples are sorted by offset and the - - - -Mills [Page 7] - -RFC February 1994 - - six highest and six lowest outlyers discarded. The average of - the eight samples remaining becomes the output of the filter. - - The problem is not nearly so serious when using the PPS signal - to discipline the frequency of the CPU clock oscillator. In - this case the quantity of interest is the contents of the - microseconds counter only, which does not depend on the kernel - time variable. - - 2.4.2. External Clocks - - It is possible to replace the system clock function with an - external bus peripheral. The TPRO device mentioned previously - can be used to provide IRIG-synchronized time with a precision - of 1 us. A driver for this device tprotime.c and header file - tpro.h are included in the kernel.tar.Z distribution mentioned - previously. Using this device, the system clock is read - directly from the interface; however, the device does not - record the year, so special provisions have been made to obtain - the year from the kernel time variable and initialize the - driver accordingly. This feature is conditionally compiled in - the code described below only if the EXT_CLOCK and TPRO options - are used in the kernel configuration file. - - While the system clock function is provided directly by the - microtime() routine in the driver, the kernel time variable - must be disciplined as well, since not all system timing - functions use the microtime() routine. This is done by - measuring the difference between the microtime() clock and - kernel time variable and using the difference to adjust the - kernel PLL as if the adjustment were provided by an external - peer and NTP. - - A good deal of error checking is done in the TPRO driver, since - the system clock is vulnerable to a misbehaving radio clock, - IRIG signal source, interface cables and TPRO device itself. - Unfortunately, there is no easy way to utilize the extensive - diversity and redundancy capabilities available in the NTP - synchronization daemon. In order to avoid disruptions that - might occur if the TPRO time is far different from the kernel - time variable, the latter is used instead of the former if the - difference between the two exceeds 1000 s; presumably in that - case operator intervention is required. - - 2.4.2. External Oscillators - - Even if a source of PPS or IRIG signals is not available, it is - still possible to improve the stability of the system clock - through the use of a specialized bus peripheral. In order to - explore the benefits of such an approach, a special SBus - peripheral caled HIGHBALL has been constructed. The device - includes a pair of 32-bit hardware counters in Unix timeval - format, together with a precision, oven-controlled quartz - oscillator with a stability of a few parts in 10^9. A driver - - -Mills [Page 8] - -RFC February 1994 - - for this device hightime.c and header file high.h are included - in the kernel.tar.Z distribution mentioned previously. This - feature is conditionally compiled in the code described below - only if the EXT_CLOCK and HIGHBALL options are used in the - kernel configuration file. - - Unlike the external clock case, where the system clock function - is provided directly by the microtime() routine in the driver, - the HIGHBALL counter offsets with respect to UTC must be - provided first. This is done using the ordinary kernel PLL, but - controlling the counter offsets directly, rather than the - kernel time variable. At first, this might seem to defeat the - purpose of the design, since the jitter and wander of the - synchronization source will affect the counter offsets and thus - the accuracy of the time. However, the jitter is much reduced - by the PLL and the wander is small, especially if using a radio - clock or another primary server disciplined in the same way. In - practice, the scheme works to reduce the incidental wander to a - few parts in 10^8, or about the same as using the PPS signal. - - As in the previous case, the kernel time variable must be - disciplined as well, since not all system timing functions use - the microtime() routine. However, the kernel PLL cannot be used - for this, since it is already in use providing offsets for the - HIGHBALL counters. Therefore, a special correction is - calculated from the difference between the microtime() clock - and the kernel time variable and used to adjust the kernel time - variable at the next timer interrupt. This somewhat roundabout - approach is necessary in order that the adjustment does not - cause the kernel time variable to jump backwards and possibly - lose or duplicate a timer event. - - 2.5 Other Features - - It is a design feature of the NTP architecture that the system - clocks in a synchronization subnet are to read the same or nearly - the same values before during and after a leap-second event, as - declared by national standards bodies. The new model is designed - to implement the leap event upon command by an ntp_adjtime() - argument. The intricate and sometimes arcane details of the model - and implementation are discussed in [MIL91b] and [MIL93]. Further - details are given in the technical summary later in this - memorandum. - +It is a design feature of the NTP architecture that the system clocks in +a synchronization subnet are to read the same or nearly the same values +before during and after a leap-second event, as declared by national +standards bodies. The new model is designed to implement the leap event +upon command by an ntp_adjtime() argument. The intricate and sometimes +arcane details of the model and implementation are discussed in [MIL92b] +and [MIL93]. Further details are given in the technical summary later in +this memorandum. 3. Technical Summary - In order to more fully understand the workings of the model, a stand- - alone simulator kern.c and header file timex.h are included in the - kernel.tar.Z distribution mentioned previously. In addition, an - example kernel module kern_ntptime.c which implements the - ntp_gettime() and ntp_adjtime() system calls is included. Neither of - these programs incorporate licensed code. Since the distribution is - somewhat large, due to copious comments and ornamentation, it is - impractical to include a listing of these programs in this - - -Mills [Page 9] - -RFC February 1994 - - memorandum. In any case, implementors may choose to snip portions of - the simulator for use in new kernel designs, but, due to formatting - conventions, this would be difficult if included in this memorandum. - - The kern.c program is an implementation of an adaptive-parameter, - first-order, type-II phase-lock loop. The system clock is implemented - using a set of variables and algorithms defined in the simulator and - driven by explicit offsets generated by a driver program also - included in the program. The algorithms include code fragments almost - identical to those in the machine-specific kernel implementations and - operate in the same way, but the operations can be understood - separately from any licensed source code into which these fragments - may be integrated. The code fragments themselves are not derived from - any licensed code. The following discussion assumes that the - simulator code is available for inspection. - - 3.1. PLL Simulation - - The simulator operates in conformance with the analytical model - described in [MIL92b]. The main() program operates as a driver for - the fragments hardupdate(), hardclock(), second_overflow(), - hardpps() and microtime(), although not all functions implemented - in these fragments are simulated. The program simulates the PLL at - each timer interrupt and prints a summary of critical program - variables at each time update. - - There are three defined options in the kernel configuration file - specific to each implementation. The PPS_SYNC option provides - support for a pulse-per-second (PPS) signal, which is used to - discipline the frequency of the CPU clock oscillator. The - EXT_CLOCK option provides support for an external kernel-readable - clock, such as the KSI/Odetics TPRO IRIG interface or HIGHBALL - precision oscillator, both for the SBus. The TPRO option provides - support for the former, while the HIGHBALL option provides support - for the latter. External clocks are implemented as the microtime() - clock driver, with the specific source code selected by the kernel - configuration file. - - 3.1.1. The hardupdate() Fragment - - The hardupdate() fragment is called by ntp_adjtime() as each - update is computed to adjust the system clock phase and - frequency. Note that the time constant is in units of powers of - two, so that multiplies can be done by simple shifts. The phase - variable is computed as the offset divided by the time - constant. Then, the time since the last update is computed and - clamped to a maximum (for robustness) and to zero if - initializing. The offset is multiplied (sorry about the ugly - multiply) by the result and divided by the square of the time - constant and then added to the frequency variable. Note that - all shifts are assumed to be positive and that a shift of a - signed quantity to the right requires a little dance. - - - - -Mills [Page 10] - -RFC February 1994 - - With the defines given in the program and header file, the - maximum time offset is determined by the size in bits of the - long type (32 or 64) less the SHIFT_UPDATE scale factor (12) or - at least 20 bits (signed). The scale factor is chosen so that - there is no loss of significance in later steps, which may - involve a right shift up to SHIFT_UPDATE bits. This results in - a time adjustment range over +-512 ms. Since time_constant must - be greater than or equal to zero, the maximum frequency offset - is determined by the SHIFT_USEC scale factor (16) or at least - 16 bits (signed). This results in a frequency adjustment range - over +-31,500 ppm. - - In the addition step, the value of offset * mtemp is not - greater than MAXPHASE * MAXSEC = 31 bits (signed), which will - not overflow a long add on a 32-bit machine. There could be a - loss of precision due to the right shift of up to 12 bits, - since time_constant is bounded at 6. This results in a net - worst-case frequency resolution of about .063 ppm, which is not - significant for most quartz oscillators. The worst case could - be realized only if the NTP peer misbehaves according to the - protocol specification. - - The time_offset value is clamped upon entry. The time_phase - variable is an accumulator, so is clamped to the tolerance on - every call. This helps to damp transients before the oscillator - frequency has been determined, as well as to satisfy the - correctness assertions if the time synchronization protocol or - implementation misbehaves. - - 3.1.2. The hardclock() Fragment - - The hardclock() fragment is inserted in the hardware timer - interrupt routine at the point the system clock is to be - incremented by the value of tick. Previous to this fragment the - time_update variable has been initialized to the value computed - by the adjtime() system call in the stock Unix kernel, normally - plus/minus the tickadj value, which is usually in the order of - 5 us. The time_phase variable, which represents the - instantaneous phase of the system clock, is advanced by - time_adj, which is calculated in the second_overflow() fragment - described below. If the value of time_phase exceeds 1 us in - scaled units, time_update is increased by the (signed) excess - and time_phase retains the residue. - - Except in the case of an external oscillator such as the - HIGHBALL interface, the hardclock() fragment advances the - system clock by the value of tick plus time_update. However, in - the case of an external oscillator, the system clock is - obtained directly from the interface and time_update used to - discipline that interface instead. However, the system clock - must still be disciplined as explained previously, so the value - of clock_cpu computed by the second_overflow() fragment is used - instead. - - - -Mills [Page 11] - -RFC February 1994 - - 3.1.3. The second_overflow() Fragment - - The second_overflow() fragment is inserted at the point where - the microseconds field of the system time variable is being - checked for overflow. Upon overflow the maximum error - time_maxerror is increased by time_tolerance to reflect the - maximum time offset due to oscillator frequency error. Then, - the increment time_adj to advance the kernel time variable is - calculated from the (scaled) time_offset and time_freq - variables updated at the last call to the hardclock() fragment. - - The phase adjustment is calculated as a (signed) fraction of - the time_offset remaining, where the fraction is added to - time_adj, then subtracted from time_offset. This technique - provides a rapid convergence when offsets are high, together - with good resolution when offsets are low. The frequency - adjustment is the sum of the (scaled) time_freq variable, an - adjustment necessary when the tick interval does not evenly - divide one second fixtick and PPS frequency adjustment pps_ybar - (if configured). - - The scheme of approximating exact multiply/divide operations - with shifts produces good results, except when an exact - calculation is required, such as when the PPS signal is being - used to discipling the CPU clock oscillator frequency as - described below. As long as the actual oscillator frequency is - a power of two in Hz, no correction is required. However, in - the SunOS kernel the clock frequency is 100 Hz, which results - in an error factor of 0.78. In this case the code increases - time_adj by a factor of 1.25, which results in an overall error - less than three percent. - - On rollover of the day, the leap-second state machine described - below determines whether a second is to be inserted or deleted - in the timescale. The microtime() routine insures that the - reported time is always monotonically increasing. - - 3.1.4. The hardpps() Fragment - - The hardpps() fragment is operative only if the PPS_SYNC option - is specified in the kernel configuration file. It is called - from the serial port driver or equivalent interface at the on- - time transition of the PPS signal. The fragment operates as a - first-order, type-I, frequency-lock loop (FLL) controlled by - the difference between the frequency represented by the - pps_ybar variable and the frequency of the hardware clock - oscillator. - - In order to avoid calling the microtime() routine more than - once for each PPS transition, the interface requires the - calling program to capture the system time and hardware counter - contents at the on-time transition of the PPS signal and - provide a pointer to the timestamp (Unix timeval) and counter - contents as arguments to the hardpps() call. The hardware - - -Mills [Page 12] - -RFC February 1994 - - counter contents can be determined by saving the microseconds - field of the system time, calling the microtime() routine, and - subtracting the saved value. If a microseconds overflow has - occured during the process, the resulting microseconds value - will be negative, in which case the caller adds 1000000 to - normalize the microseconds field. - - The frequency of the hardware oscillator can be determined from - the difference in hardware counter readings at the beginning - and end of the calibration interval divided by the duration of - the interval. However, the oscillator frequency tolerance, as - much as 100 ppm, may cause the difference to exceed the tick - value, creating an ambiguity. In order to avoid this ambiguity, - the hardware counter value at the beginning of the interval is - increased by the current pps_ybar value once each second, but - computed modulo the tick value. At the end of the interval, the - difference between this value and the value computed from the - hardware counter is used as a control signal sample for the - FLL. - - Control signal samples which exceed the frequency tolerance are - discarded, as well as samples resulting from excessive interval - duration jitter. Surviving samples are then processed by a - three-stage median filter. The signal which drives the FLL is - derived from the median sample, while the average of the - differences between the other two samples is used as a measure - of dispersion. If the dispersion is below the threshold - pps_dispmax, the median is used to correct the pps_ybar value - with a weight expressed as a shift PPS_AVG (2). In addition to - the averaging function, pps_disp is increased by the amount - pps_dispinc once each second. The result is that, should the - dispersion be exceptionally high, or if the PPS signal fails - for some reason, the pps_disp will eventually exceed - pps_dispmax and raise an alarm. - - Initially, an approximate value for pps_ybar is not known, so - the duration of the calibration interval must be kept small to - avoid overflowing the tick. The time difference at the end of - the calibration interval is measured. If greater than tick/4, - the interval is reduced by half. If less than this fraction for - four successive calibration intervals, the interval is doubled. - This design automatically adapts to nominal jitter in the PPS - signal, as well as the value of tick. The duration of the - calibration interval is set by the pps_shift variable as a - shift in powers of two. The minimum value PPS_SHIFT (2) is - chosen so that with the highest CPU oscillator frequency 1024 - Hz and frequency tolerance 100 ppm the tick will not overflow. - The maximum value PPS_SHIFTMAX (8) is chosen such that the - maximum averaging time is about 1000 s as determined by - measurements of Allan variance [MIL93]. - - Should the PPS signal fail, the current frequency estimate - pps_ybar continues to be used, so the nominal frequency remains - correct subject only to the instability of the undisciplined - - -Mills [Page 13] - -RFC February 1994 - - oscillator. The procedure to save and restore the frequency - estimate works as follows. When setting the frequency from a - file, the time_freq value is set as the file value minus the - pps_ybar value; when retrieving the frequency, the two values - are added before saving in the file. This scheme provides a - seamless interface should the PPS signal fail or the kernel - configuration change. Note that the frequency discipline is - active whether or not the synchronization daemon is active. - Since all Unix systems take some time after reboot to build a - running system, usually by that time the discipline process has - already settled down and the initial transients due to - frequency discipline have damped out. - - 3.1.4. External Clock Interface - - The external clock driver interface is implemented with two - routines, microtime(), which returns the current clock time, - and clock_set(), which furnishes the apparent system time - derived from the kernel time variable. The latter routine is - called only when the clock is set using the settimeofday() - system call, but can be called from within the driver, such as - when the year rolls over, for example. - - In the stock SunOS kernel and modified Ultrix and OSF/1 - kernels, the microtime() routine returns the kernel time - variable plus an interpolation between timer interrupts based - on the contents of a hardware counter. In the case of an - external clock, such as described above, the system clock is - read directly from the hardware clock registers. Examples of - external clock drivers are in the tprotime.c and hightime.c - routines included in the kernel.tar.Z distribution. - - The external clock routines return a status code which - indicates whether the clock is operating correctly and the - nature of the problem, if not. The return code is interpreted - by the ntp_gettime() system call, which transitions the status - state machine to the TIME_ERR state if an error code is - returned. This is the only error checking implemented for the - external clock in the present version of the code. - - The simulator has been used to check the PLL operation over the - design envelope of +-512 ms in time error and +-100 ppm in - frequency error. This confirms that no overflows occur and that - the loop initially converges in about 15 minutes for timer - interrupt rates from 50 Hz to 1024 Hz. The loop has a normal - overshoot of a few percent and a final convergence time of several - hours, depending on the initial time and frequency error. - - 3.2. Leap Seconds - - It does not seem generally useful in the user application - interface to provide additional details private to the kernel and - synchronization protocol, such as stratum, reference identifier, - reference timestamp and so forth. It would in principle be - - -Mills [Page 14] - -RFC February 1994 - - possible for the application to independently evaluate the quality - of time and project into the future how long this time might be - "valid." However, to do that properly would duplicate the - functionality of the synchronization protocol and require - knowledge of many mundane details of the platform architecture, - such as the subnet configuration, reachability status and related - variables. For the curious, the ntp_adjtime() system call can be - used to reveal some of these mysteries. - - However, the user application may need to know whether a leap - second is scheduled, since this might affect interval calculations - spanning the event. A leap-warning condition is determined by the - synchronization protocol (if remotely synchronized), by the - timecode receiver (if available), or by the operator (if awake). - This condition is set by the synchronization daemon on the day the - leap second is to occur (30 June or 31 December, as announced) by - specifying in a ntp_adjtime() system call a clock status of either - TIME_DEL, if a second is to be deleted, or TIME_INS, if a second - is to be inserted. Note that, on all occasions since the inception - of the leap-second scheme, there has never been a deletion - occasion, nor is there likely to be one in future. If the value is - TIME_DEL, the kernel adds one second to the system time - immediately following second 23:59:58 and resets the clock status - to TIME_OK. If the value is TIME_INS, the kernel subtracts one - second from the system time immediately following second 23:59:59 - and resets the clock status to TIME_OOP, in effect causing system - time to repeat second 59. Immediately following the repeated - second, the kernel resets the clock status to TIME_OK. - - Depending upon the system call implementation, the reported time - during a leap second may repeat (with the TIME_OOP return code set - to advertise that fact) or be monotonically adjusted until system - time "catches up" to reported time. With the latter scheme the - reported time will be correct before and shortly after the leap - second (depending on the number of microtime() calls during the - leap second), but freeze or slowly advance during the leap second - itself. However, Most programs will probably use the ctime() - library routine to convert from timeval (seconds, microseconds) - format to tm format (seconds, minutes,...). If this routine is - modified to use the ntp_gettime() system call and inspect the - return code, it could simply report the leap second as second 60. - - 3.3. Clock Status State Machine - - The various options possible with the system clock model described - in this memorandum require a careful examination of the state - transitions, status indications and recovery procedures should a - crucial signal or interface fail. In this section is presented a - prototype state machine designed to support leap second insertion - and deletion, as well as reveal various kinds of errors in the - synchronization process. The states of this machine are decoded as - follows: - - - - -Mills [Page 15] - -RFC February 1994 - - TIME_OK If an external clock is present, it is working properly - and the system clock is derived from it. If no external - clock is present, the synchronization daemon is working - properly and the system clock is synchronized to a radio - clock or one or more peers. - - TIME_INS An insertion of one second in the system clock has been - declared following the last second of the current day, - but has not yet been executed. - - TIME_DEL A deletion of the last second of the current day has - been declared, but not yet executed. - - TIME_OOP An insertion of one second in the system clock has been - declared following the last second of the current day. - The second is in progress, but not yet completed. - Library conversion routines should interpret this second - as 23:59:60. - - TIME_BAD Either (a) the synchronization daemon has declared the - protocol is not working properly, (b) all sources of - outside synchronization have been lost or (c) an - external clock is present and it has just become - operational following a non-operational condition. - - TIME_ERR An external clock is present, but is in a non- - operational condition. - - In all except the TIME_ERR state the system clock is derived from - either an external clock, if present, or the kernel time variable, - if not. In the TIME_ERR state the external clock is present, but - not working properly, so the system clock may be derived from the - kernel time variable. The following diagram indicates the normal - transitions of the state machine. Not all valid transitions are - shown. - - +--------+ +--------+ +--------+ +--------+ - | | | | | | | | - |TIME_BAD|---->|TIME_OK |<----|TIME_OOP|<----|TIME_INS| - | | | | | | | | - +--------+ +--------+ +--------+ +--------+ - A A - | | - | | - +--------+ +--------+ - | | | | - |TIME_ERR| |TIME_DEL| - | | | | - +--------+ +--------+ - - The state machine makes a transition once each second at an - instant where the microseconds field of the kernel time variable - overflows and one second is added to the seconds field. However, - this condition is checked at each timer interrupt, which may not - - -Mills [Page 16] - -RFC February 1994 - - exactly coincide with the actual instant of overflow. This may - lead to some interesting anomalies, such as a status indication of - a leap second in progress (TIME_OOP) when actually the leap second - had already expired. - - The following state transitions are executed automatically by the - kernel: - - any state -> TIME_ERR This transition occurs when an external - clock is present and an attempt is made to - read it when in a non-operational - condition. - - TIME_INS -> TIME_OOP This transition occurs immediately - following second 86,400 of the current day - when an insert-second event has been - declared. - - TIME_OOP -> TIME_OK This transition occurs immediately - following second 86,401 of the current - day; that is, one second after entry to - the TIME_OOP state. - - TIME_DEL -> TIME_OK This transition occurs immediately - following second 86,399 of the current day - when a delete-second event has been - declared. - - The following state transitions are executed by specific - ntp_adjtime() system calls: - - TIME_OK -> TIME_INS This transition occurs as the result of a - ntp_adjtime() system call to declare an - insert-second event. - - TIME_OK -> TIME_DEL This transition occurs as the result of a - ntp_adjtime() system call to declare a - delete-second event. - - any state -> TIME_BAD This transition occurs as the result of a - ntp_adjtime() system call to declare loss - of all sources of synchronization or in - other cases of error. - - The following table summarizes the actions just before, during and - just after a leap-second event. Each line in the table shows the - UTC and NTP times at the beginning of the second. The left column - shows the behavior when no leap event is to occur. In the middle - column the state machine is in TIME_INS at the end of UTC second - 23:59:59 and the NTP time has just reached 400. The NTP time is - set back one second to 399 and the machine enters TIME_OOP. At the - end of the repeated second the machine enters TIME_OK and the UTC - and NTP times are again in correspondence. In the right column the - state machine is in TIME_DEL at the end of UTC second 23:59:58 and - - -Mills [Page 17] - -RFC February 1994 - - the NTP time has just reached 399. The NTP time is incremented, - the machine enters TIME_OK and both UTC and NTP times are again in - correspondence. - - No Leap Leap Insert Leap Delete - UTC NTP UTC NTP UTC NTP - --------------------------------------------- - 23:59:58|398 23:59:58|398 23:59:58|398 - | | | - 23:59:59|399 23:59:59|399 00:00:00|400 - | | | - 00:00:00|400 23:59:60|399 00:00:01|401 - | | | - 00:00:01|401 00:00:00|400 00:00:02|402 - | | | - 00:00:02|402 00:00:01|401 00:00:03|403 - | | | - - To determine local midnight without fuss, the kernel code simply - finds the residue of the time.tv_sec (or time.tv_sec + 1) value - mod 86,400, but this requires a messy divide. Probably a better - way to do this is to initialize an auxiliary counter in the - settimeofday() routine using an ugly divide and increment the - counter at the same time the time.tv_sec is incremented in the - timer interrupt routine. For future embellishment. +In order to more fully understand the workings of the model, a stand- +alone simulator kern.c and header file timex.h are included in the +kernel.tar.Z distribution mentioned previously. In addition, an example +kernel module kern_ntptime.c which implements the ntp_gettime() and +ntp_adjtime() system calls is included. Neither of these programs +incorporate licensed code. Since the distribution is somewhat large, due +to copious comments and ornamentation, it is impractical to include a +listing of these programs in this memorandum. In any case, implementors +may choose to snip portions of the simulator for use in new kernel +designs; but, due to formatting conventions, this would be difficult if +included in this memorandum. + +The kern.c program is an implementation of an adaptive-parameter, first- +order, type-II phase-lock loop. The system clock is implemented using a +set of variables and algorithms defined in the simulator and driven by +explicit offsets generated by the main() routine in the program. The +algorithms include code fragments almost identical to those in the +machine-specific kernel implementations and operate in the same way, but +the operations can be understood separately from any licensed source +code into which these fragments may be integrated. The code fragments +themselves are not derived from any licensed code. The following +discussion assumes that the simulator code is available for inspection. + +3.1. PLL Simulation + +The simulator operates in conformance with the analytical model +described in [MIL92b]. The main() program operates as a driver for the +fragments hardupdate(), hardclock(), second_overflow(), hardpps() and +microtime(), although not all functions implemented in these fragments +are simulated. The program simulates the PLL at each timer interrupt and +prints a summary of critical program variables at each time update. + +There are three defined options in the kernel configuration file +specific to each implementation. The PPS_SYNC option provides support +for a pulse-per-second (PPS) signal, which is used to discipline the +frequency of the CPU clock oscillator. The EXT_CLOCK option provides +support for an external kernel-readable clock, such as the KSI/Odetics +TPRO IRIG interface or HIGHBALL precision oscillator, both for the SBus. +The TPRO option provides support for the former, while the HIGHBALL +option provides support for the latter. External clocks are implemented +as the microtime() clock driver, with the specific source code selected +by the kernel configuration file. + +The PPS signal is carefully monitored for error conditions which can +affect accuracy, stability and reliability. The time_status kernel +variable contains bits that both control the use of the PPS signal and +reveal its operational status. The function of each bit is described in +a later section of this memo. + +3.1.1. The hardupdate() Fragment + +The hardupdate() fragment is called by ntp_adjtime() as each update is +computed to adjust the system clock phase and frequency. Note that the +time constant is in units of powers of two, so that multiplies can be +done by simple shifts. The phase variable is computed as the offset +divided by the time constant, but clamped to a maximum (for robustness). +Then, the time since the last update is computed and clamped to a +maximum and to zero if initializing. The offset is multiplied (sorry +about the ugly multiply) by the result and divided by the square of the +time constant and then added to the frequency variable. Note that all +shifts are assumed to be positive and that a shift of a signed quantity +to the right requires a little dance. + +The STA_PLL and STA_PPSTIME status bits, which are set by the +ntp_adjtime() system call, serve to enable or inhibit the kernel PLL and +PPS time-discipline functions. The STA_PPSSIGNAL status bit is set by +the hardpps() code fragment when the PPS signal is present and operating +within nominal bounds. Time discipline from the PPS signal operates only +if both the STA_PPSTIME and STA_PPSSIGNAL bits are set; otherwise, the +discipline operates from the offset given in the ntp_adjtime() system +call. In the intended mode of operation, the synchronization daemon sets +STA_PLL to enable the PLL when first initialized, then sets STA_PPSTIME +when reliable synchronization to within +-128 ms has been achieved with +either a radio clock or external peer. The daemon can detect and +indicate this condition for monitoring purposes by noting that both +STA_PPSTIME and STA_PPSSIGNAL are set. + +With the defines given in the program and header files, the maximum time +offset is determined by the size in bits of the long type (32 or 64) +less the SHIFT_UPDATE scale factor (12) or at least 20 bits (signed). +The scale factor is chosen so that there is no loss of significance in +later steps, which may involve a right shift up to SHIFT_UPDATE bits. +This results in a time adjustment range over +-512 ms. Since +time_constant must be greater than or equal to zero, the maximum +frequency offset is determined by the SHIFT_USEC scale factor (16) or at +least 16 bits (signed). This results in a frequency adjustment range +over +-31,500 ppm. + +In the addition step, the value of offset * mtemp is not greater than +MAXPHASE * MAXSEC = 31 bits (signed), which will not overflow a long add +on a 32-bit machine. There could be a loss of precision due to the right +shift of up to 12 bits, since time_constant is bounded at 6. This +results in a net worst-case frequency resolution of about .063 ppm, +which is not significant for most quartz oscillators. The worst case +could be realized only if the NTP peer misbehaves according to the +protocol specification. + +The time_offset value is clamped upon entry. The time_phase variable is +an accumulator, so is clamped to the tolerance on every call. This helps +to damp transients before the oscillator frequency has been stabilized, +as well as to satisfy the correctness assertions if the time +synchronization protocol or implementation misbehaves. + +3.1.2. The hardclock() Fragment + +The hardclock() fragment is inserted in the hardware timer interrupt +routine at the point the system clock is to be incremented by the value +of tick. Previous to this fragment the time_update variable has been +initialized to the tick increment plus the value computed by the +adjtime() system call in the stock Unix kernel, normally plus/minus the +tickadj value, which is usually in the order of 5 us. The time_phase +variable, which represents the instantaneous phase of the system clock, +is advanced by time_adj, which is calculated in the second_overflow() +fragment described below. If the value of time_phase exceeds 1 us in +scaled units, time_update is increased by the (signed) excess and +time_phase retains the residue. + +In those cases where a PPS signal is connected by a serial port +operating at an interrupt priority level greater than the timer +interrupt, special consideration should be given the location of the +hardclock() fragment in the timer interrupt routine. The system clock +should be advanced as early in the routine as possible, preferably +before the hardware timer interrupt flag is cleared. This reduces or +eliminates the possibility that the microtime() routine may latch the +time after the flag is cleared, but before the system clock is advanced, +which results in a returned time late by one tick. + +Except in the case of an external oscillator such as the HIGHBALL +interface, the hardclock() fragment advances the system clock by the +value of tick plus time_update. However, in the case of an external +oscillator, the system clock is obtained directly from the interface and +time_update used to discipline that interface instead. However, the +system clock must still be disciplined as explained previously, so the +value of clock_cpu computed by the second_overflow() fragment is used +instead. + +3.1.3. The second_overflow() Fragment + +The second_overflow() fragment is inserted at the point where the +microseconds field of the system time variable is being checked for +overflow. Upon overflow the maximum error time_maxerror is increased by +time_tolerance to reflect the maximum time offset due to oscillator +frequency error. Then, the increment time_adj to advance the kernel time +variable is calculated from the (scaled) time_offset and time_freq +variables updated at the last call to the hardclock() fragment. + +The phase adjustment is calculated as a (signed) fraction of the +time_offset remaining, where the fraction is added to time_adj, then +subtracted from time_offset. This technique provides a rapid convergence +when offsets are high, together with good resolution when offsets are +low. The frequency adjustment is the sum of the (scaled) time_freq +variable, an adjustment necessary when the tick interval does not evenly +divide one second fixtick and PPS frequency adjustment pps_freq (if +configured). + +The scheme of approximating exact multiply/divide operations with shifts +produces good results, except when an exact calculation is required, +such as when the PPS signal is being used to discipline the CPU clock +oscillator frequency as described below. As long as the actual +oscillator frequency is a power of two in Hz, no correction is required. +However, in the SunOS kernel the clock frequency is 100 Hz, which +results in an error factor of 0.78. In this case the code increases +time_adj by a factor of 1.25, which results in an overall error less +than three percent. + +On rollover of the day, the leap-second state machine described below +determines whether a second is to be inserted or deleted in the +timescale. The microtime() routine insures that the reported time is +always monotonically increasing. + +3.1.4. The hardpps() Fragment + +The hardpps() fragment is operative only if the PPS_SYNC option is +specified in the kernel configuration file. It is called from the serial +port driver or equivalent interface at the on-time transition of the PPS +signal. The code operates as a first-order, type-I, frequency-lock loop +(FLL) controlled by the difference between the frequency represented by +the pps_freq variable and the frequency of the hardware clock +oscillator. It also provides offsets to the hardupdate() fragment in +order to discipline the system clock time. + +In order to avoid calling the microtime() routine more than once for +each PPS transition, the interface requires the calling program to +capture the system time and hardware counter contents at the on-time +transition of the PPS signal and provide a pointer to the timestamp +(Unix timeval) and counter contents as arguments to the hardpps() call. +The hardware counter contents are determined by saving the microseconds +field of the system time, calling the microtime() routine, and +subtracting the saved value. If a microseconds overflow has occurred +during the process, the resulting microseconds value will be negative, +in which case the caller adds 1000000 to normalize the microseconds +field. + +In order to avoid large jitter when the PPS interrupt occurs during the +timer interrupt routine before the system clock is advanced, a glitch +detector is used. The detector latches when an offset exceeds a +threshold tick/2 and stays latched until either a subsequent offset is +less than the threshold or a specified interval MAXGLITCH (30 s) has +elapsed. As long as the detector remains latched, it outputs the offset +immediately preceding the latch, rather than the one received. + +A three-stage median filter is used to suppress jitter less than the +glitch threshold. The median sample drives the PLL, while the difference +between the other two samples represents the time dispersion. Time +dispersion samples are averaged and used as a jitter estimate. If this +estimate exceeds a threshold MAXTIME/2 (100 us), an error bit +STA_PPSJITTER is raised in the status word. + +The frequency of the hardware oscillator is determined from the +difference in hardware counter readings at the beginning and end of the +calibration interval divided by the duration of the interval. However, +the oscillator frequency tolerance, as much as 100 ppm, may cause the +difference to exceed the tick value, creating an ambiguity. In order to +avoid this ambiguity, the hardware counter value at the beginning of the +interval is increased by the current pps_freq value once each second, +but computed modulo the tick value. At the end of the interval, the +difference between this value and the value computed from the hardware +counter is the control signal for the FLL. + +Control signal samples which exceed the frequency tolerance MAXFREQ (100 +ppm) are discarded, as well as samples resulting from excessive interval +duration jitter. In these cases an error bit STA_PPSERROR is raised in +the status word. Surviving samples are then processed by a three-stage +median filter. The median sample drives the FLL, while the difference +between the other two samples represents the frequency dispersion. +Frequency dispersion samples are averaged and used as a stabiity +estimate. If this estimate is below a threshold MAXFREQ/4 (25 ppm), the +median sample is used to correct the oscillator frequency pps_freq with +a weight expressed as a shift PPS_AVG (2). + +Initially, an approximate value for the oscillator frequency is not +known, so the duration of the calibration interval must be kept small to +avoid overflowing the tick. The time difference at the end of the +calibration interval is measured. If greater than tick/4, the interval +is reduced by half. If less than this fraction for four successive +calibration intervals, the interval is doubled. This design +automatically adapts to nominal jitter in the PPS signal, as well as the +value of tick. The duration of the calibration interval is set by the +pps_shift variable as a shift in powers of two. The minimum value +PPS_SHIFT (2) is chosen so that with the highest CPU oscillator +frequency 1024 Hz and frequency tolerance 100 ppm the tick will not +overflow. The maximum value PPS_SHIFTMAX (8) is chosen such that the +maximum averaging time is about 1000 s as determined by measurements of +Allan variance [MIL93]. + +Should the PPS signal fail, the current frequency estimate pps_freq +continues to be used, so the nominal frequency remains correct subject +only to the instability of the undisciplined oscillator. The procedure +to save and restore the frequency estimate works as follows. When +setting the frequency from a file, the time_freq value is set as the +file value minus the pps_freq value; when retrieving the frequency, the +two values are added before saving in the file. This scheme provides a +seamless interface should the PPS signal fail or the kernel +configuration change. Note that the frequency discipline is active +whether or not the synchronization daemon is active. Since all Unix +systems take some time after reboot to build a running system, usually +by that time the discipline process has already settled down and the +initial transients due to frequency discipline have damped out. +3.1.4. External Clock Interface + +The external clock driver interface is implemented with two routines, +microtime(), which returns the current clock time, and clock_set(), +which furnishes the apparent system time derived from the kernel time +variable. The latter routine is called only when the clock is set using +the settimeofday() system call, but can be called from within the +driver, such as when the year rolls over, for example. + +In the stock SunOS kernel and modified Ultrix and OSF/1 kernels, the +microtime() routine returns the kernel time variable plus an +interpolation between timer interrupts based on the contents of a +hardware counter. In the case of an external clock, such as described +above, the system clock is read directly from the hardware clock +registers. Examples of external clock drivers are in the tprotime.c and +hightime.c routines included in the kernel.tar.Z distribution. + +The external clock routines return a status code which indicates whether +the clock is operating correctly and the nature of the problem, if not. +The return code is interpreted by the ntp_gettime() system call, which +transitions the status state machine to the TIME_ERR state if an error +code is returned. This is the only error checking implemented for the +external clock in the present version of the code. + +The simulator has been used to check the PLL operation over the design +envelope of +-512 ms in time error and +-100 ppm in frequency error. +This confirms that no overflows occur and that the loop initially +converges in about 15 minutes for timer interrupt rates from 50 Hz to +1024 Hz. The loop has a normal overshoot of a few percent and a final +convergence time of several hours, depending on the initial time and +frequency error. + +3.2. Leap Seconds + +It does not seem generally useful in the user application interface to +provide additional details private to the kernel and synchronization +protocol, such as stratum, reference identifier, reference timestamp and +so forth. It would in principle be possible for the application to +independently evaluate the quality of time and project into the future +how long this time might be "valid." However, to do that properly would +duplicate the functionality of the synchronization protocol and require +knowledge of many mundane details of the platform architecture, such as +the subnet configuration, reachability status and related variables. For +the curious, the ntp_adjtime() system call can be used to reveal some of +these mysteries. + +However, the user application may need to know whether a leap second is +scheduled, since this might affect interval calculations spanning the +event. A leap-warning condition is determined by the synchronization +protocol (if remotely synchronized), by the timecode receiver (if +available), or by the operator (if awake). This condition is set by the +synchronization daemon on the day the leap second is to occur (30 June +or 31 December, as announced) by specifying in a ntp_adjtime() system +call a status bit of either STA_DEL, if a second is to be deleted, or +STA_INS, if a second is to be inserted. Note that, on all occasions +since the inception of the leap-second scheme, there has never been a +deletion, nor is there likely to be one in future. If the bit is +STA_DEL, the kernel adds one second to the system time immediately +following second 23:59:58 and resets the clock state to TIME_WAIT. If +the bit is STA_INS, the kernel subtracts one second from the system time +immediately following second 23:59:59 and resets the clock stateto +TIME_OOP, in effect causing system time to repeat second 59. Immediately +following the repeated second, the kernel resets the clock status to +TIME_WAIT. + +Following the leap operations, the clock remains in the TIME_WAIT state +until both the STA_DEL and STA_INS status bits are reset. This provides +both an unambiguous indication that a leap recently occured, as well as +time for the daemon or operator to clear the warning condition. + +Depending upon the system call implementation, the reported time during +a leap second may repeat (with the TIME_OOP return code set to advertise +that fact) or be monotonically adjusted until system time "catches up" +to reported time. With the latter scheme the reported time will be +correct before and shortly after the leap second (depending on the +number of microtime() calls during the leap second), but freeze or +slowly advance during the leap second itself. However, Most programs +will probably use the ctime() library routine to convert from timeval +(seconds, microseconds) format to tm format (seconds, minutes,...). If +this routine is modified to use the ntp_gettime() system call and +inspect the return code, it could simply report the leap second as +second 60. + +3.3. Clock Status State Machine + +The various options possible with the system clock model described in +this memorandum require a careful examination of the state transitions, +status indications and recovery procedures should a crucial signal or +interface fail. In this section is presented a prototype state machine +designed to support leap second insertion and deletion, as well as +reveal various kinds of errors in the synchronization process. The +states of this machine are decoded as follows: + + TIME_OK If a PPS signal or external clock is present, it is + working properly and the system clock is derived + from it. If not, the synchronization daemon is + working properly and the system clock is + synchronized to a radio clock or one or more peers. + + TIME_INS An insertion of one second in the system clock has + been declared following the last second of the + current day, but has not yet been executed. + + TIME_DEL A deletion of the last second of the current day has + been declared, but not yet executed. + + TIME_OOP An insertion of one second in the system clock has + been declared following the last second of the + current day. The second is in progress, but not yet + completed. Library conversion routines should + interpret this second as 23:59:60. + + TIME_WAIT The scheduled leap event has occurred, but the + STA_DEL and STA_INS status bits have not yet been + cleared. + + TIME_ERROR Either (a) the synchronization daemon has declared + the protocol is not working properly, (b) all + sources of outside synchronization have been lost or + (c) a PPS signal or external clock is present, but + not working properly. + +In all states the system clock is derived from either a PPS signal or +external clock, if present, or the kernel time variable, if not. If a +PPS error condition is recognized, the PPS signal is disabled and +ntp_adjtime() updates are used instead. If an external clock error +condition is recognized, the external clock is disabled and the kernel +time variable is used instead. + +The state machine makes a transition once each second at an instant +where the microseconds field of the kernel time variable overflows and +one second is added to the seconds field. However, this condition is +checked when the timer overflows, which may not coincide with the actual +seconds increment. This may lead to some interesting anomalies, such as +a status indication of a leap second in progress (TIME_OOP) when the +leap second has already expired. This ambiguity is unavoidable, unless +the timer interrupt is made synchronous with the system clock. + +The following state transitions are executed automatically by the kernel +at rollover of the microseconds field: + + any state -> TIME_ERROR This transition occurs when an error + condition is recognized and continues as long + as the condition persists. The error indication + overrides the normal state indication, but does + not affect the actual clock state. Therefore, + when the condition is cleared, the normal state + indication resumes. + + TIME_OK->TIME_DEL This transition occurs if the STA_DEL bit is + set in the status word. + + TIME_OK->TIME_INS This transition occurs if the STA_INS bit is + set in the status word. + + TIME_INS->TIME_OOP This transition occurs immediately following + second 86,400 of the current day when an + insert-second event has been declared. + + TIME_OOP->TIME_WAIT This transition occurs immediately following + second 86,401 of the current day; that is, one + second after entry to the TIME_OOP state. + + TIME_DEL->TIME_WAIT This transition occurs immediately following + second 86,399 of the current day when a delete- + second event has been declared. + + TIME_WAIT->TIME_OK This transition occurs when the STA_DEL and + STA_INS bits are cleared by an ntp_adjtime() + call. + +The following table summarizes the actions just before, during and just +after a leap-second event. Each line in the table shows the UTC and NTP +times at the beginning of the second. The left column shows the behavior +when no leap event is to occur. In the middle column the state machine +is in TIME_INS at the end of UTC second 23:59:59 and the NTP time has +just reached 400. The NTP time is set back one second to 399 and the +machine enters TIME_OOP. At the end of the repeated second the machine +enters TIME_OK and the UTC and NTP times are again in correspondence. In +the right column the state machine is in TIME_DEL at the end of UTC +second 23:59:58 and the NTP time has just reached 399. The NTP time is +incremented, the machine enters TIME_OK and both UTC and NTP times are +again in correspondence. + + No Leap Leap Insert Leap Delete + UTC NTP UTC NTP UTC NTP + --------------------------------------------- + 23:59:58|398 23:59:58|398 23:59:58|398 + | | | + 23:59:59|399 23:59:59|399 00:00:00|400 + | | | + 00:00:00|400 23:59:60|399 00:00:01|401 + | | | + 00:00:01|401 00:00:00|400 00:00:02|402 + | | | + 00:00:02|402 00:00:01|401 00:00:03|403 + | | | +To determine local midnight without fuss, the kernel code simply finds +the residue of the time.tv_sec (or time.tv_sec + 1) value mod 86,400, +but this requires a messy divide. Probably a better way to do this is to +initialize an auxiliary counter in the settimeofday() routine using an +ugly divide and increment the counter at the same time the time.tv_sec +is incremented in the timer interrupt routine. For future embellishment. 4. Programming Model and Interfaces - This section describes the programming model for the synchronization - daemon and user application programs. The ideas are based on - suggestions from Jeff Mogul and Philip Gladstone and a similar - interface designed by the latter. It is important to point out that - the functionality of the original Unix adjtime() system call is - preserved, so that the modified kernel will work as the unmodified - one, should the new features not be in use. In this case the - ntp_adjtime() system call can still be used to read and write kernel - variables that might be used by a synchronization daemon other than - NTP, for example. +This section describes the programming model for the synchronization +daemon and user application programs. The ideas are based on suggestions +from Jeff Mogul and Philip Gladstone and a similar interface designed by +the latter. It is important to point out that the functionality of the +original Unix adjtime() system call is preserved, so that the modified +kernel will work as the unmodified one, should the new features not be +in use. In this case the ntp_adjtime() system call can still be used to +read and write kernel variables that might be used by a synchronization +daemon other than NTP, for example. - 4.1. The ntp_gettime() System Call +The kernel routines use the clock state variable time_state, which +records whether the clock is synchronized, waiting for a leap second, +etc. The value of this variable is returned as the result code by both +the ntp_gettime() and ntp_adjtime() system calls. It is set implicitly +by the STA_DEL and STA_INS status bits, as described previously. Values +presently defined in the timex.h header file are as follows: - The syntax and semantics of the ntp_gettime() call are given in - the following fragment of the timex.h header file. This file is - identical, except for the SHIFT_HZ define, in the SunOS, Ultrix - and OSF/1 kernel distributions. (The SHIFT_HZ define represents - the logarithm to the base 2 of the clock oscillator frequency - specific to each system type.) Note that the timex.h file calls - the syscall.h system header file, which must be modified to define - the SYS_ntp_gettime system call specific to each system type. The - kernel distributions include directions on how to do this. + TIME_OK 0 no leap second warning + TIME_INS 1 insert leap second warning + TIME_DEL 2 delete leap second warning + TIME_OOP 3 leap second in progress + TIME_WAIT 4 leap second has occured + TIME_ERROR 5 clock not synchronized - /* - * This header file defines the Network Time Protocol (NTP) - * interfaces for user and daemon application programs. These are +In case of a negative result code, the kernel has intercepted an invalid +address or (in case of the ntp_adjtime() system call), a superuser +violation. +4.1. The ntp_gettime() System Call -Mills [Page 18] +The syntax and semantics of the ntp_gettime() call are given in the +following fragment of the timex.h header file. This file is identical, +except for the SHIFT_HZ define, in the SunOS, Ultrix and OSF/1 kernel +distributions. (The SHIFT_HZ define represents the logarithm to the base +2 of the clock oscillator frequency specific to each system type.) Note +that the timex.h file calls the syscall.h system header file, which must +be modified to define the SYS_ntp_gettime system call specific to each +system type. The kernel distributions include directions on how to do +this. -RFC February 1994 + /* + * This header file defines the Network Time Protocol (NTP) + * interfaces for user and daemon application programs. These are + * implemented using private system calls and data structures and + * require specific kernel support. + * + * NAME + * ntp_gettime - NTP user application interface + * + * SYNOPSIS + * #include + * + * int system call(SYS_ntp_gettime, tptr) + * + * int SYS_ntp_gettime defined in syscall.h header file + * struct ntptimeval *tptr pointer to ntptimeval structure + * + * NTP user interface - used to read kernel clock values + * Note: maximum error = NTP synch distance = dispersion + delay / + * 2 + * estimated error = NTP dispersion. + */ + struct ntptimeval { + struct timeval time; /* current time (ro) */ + long maxerror; /* maximum error (us) (ro) */ + long esterror; /* estimated error (us) (ro) */ + }; - * implemented using private system calls and data structures and - * require specific kernel support. - * - * NAME - * ntp_gettime - NTP user application interface - * - * SYNOPSIS - * #include - * - * int system call(SYS_ntp_gettime, tptr) - * - * int SYS_ntp_gettime defined in syscall.h header file - * struct ntptimeval *tptr pointer to ntptimeval structure - * - * NTP user interface - used to read kernel clock values - * Note: maximum error = NTP synch distance = dispersion + delay / - * 2 - * estimated error = NTP dispersion. - */ - struct ntptimeval { - struct timeval time; /* current time */ - long maxerror; /* maximum error (us) */ - long esterror; /* estimated error (us) */ - }; +The ntp_gettime() system call returns three read-only (ro) values in the +ntptimeval structure: the current time in unix timeval format plus the +maximum and estimated errors in microseconds. While the 32-bit long data +type limits the error quantities to something more than an hour, in +practice this is not significant, since the protocol itself will declare +an unsynchronized condition well below that limit. In the NTP Version 3 +specification, if the protocol computes either of these values in excess +of 16 seconds, they are clamped to that value and the system clock +declared unsynchronized. - The ntp_gettime() system call returns three values in the - ntptimeval structure: the current time in unix timeval format plus - the maximum and estimated errors in microseconds. While the 32-bit - long data type limits the error quantities to something more than - an hour, in practice this is not significant, since the protocol - itself will declare an unsynchronized condition well below that - limit. In the NTP Version 3 specification, if the protocol - computes either of these values in excess of 16 seconds, they are - clamped to that value and the system clock declared - unsynchronized. +Following is a detailed description of the ntptimeval structure members. - Following is a detailed description of the ntptimeval structure - members. +struct timeval time (ro) - struct timeval time; /* current time */ + This member is the current system time expressed as a Unix timeval + structure. The timeval structure consists of two 32-bit words; the + first is the number of seconds past 1 January 1970 assuming no + intervening leap-second insertions or deletions, while the second + is the number of microseconds within the second. - This member returns the current system time, expressed as a - Unix timeval structure. The timeval structure consists of two - 32-bit words; the first returns the number of seconds past 1 - January 1970, while the second returns the number of - microseconds. +long maxerror (ro) - long maxerror; /* maximum error (us) */ + This member is the value of the time_maxerror kernel variable, + which represents the maximum error of the indicated time relative + to the primary synchronization source, in microseconds. For NTP, + the value is initialized by a ntp_adjtime() call to the + synchronization distance, which is equal to the root dispersion + plus one-half the root delay. It is increased by a small amount + (time_tolerance) each second to reflect the maximum clock frequency + error. This variable is provided bu a ntp-adjtime() system call and + modified by the kernel, but is otherwise not used by the kernel. - This member returns the time_maxerror kernel variable in - microseconds. See the entry for this variable in section 5 for - additional information. +long esterror (ro) + This member is the value of the time_esterror kernel variable, + which represents the expected error of the indicated time relative + to the primary synchronization source, in microseconds. For NTP, + the value is determined as the root dispersion, which represents + the best estimate of the actual error of the system clock based on + its past behavior, together with observations of multiple clocks + within the peer group. This variable is provided bu a ntp-adjtime() + system call, but is otherwise not used by the kernel. +4.2. The ntp_adjtime() System Call +The syntax and semantics of the ntp_adjtime() call are given in the +following fragment of the timex.h header file. Note that, as in the +ntp_gettime() system call, the syscall.h system header file must be +modified to define the SYS_ntp_adjtime system call specific to each +system type. In the fragment, rw = read/write, ro = read-only, wo = +write-only. -Mills [Page 19] - -RFC February 1994 - - long esterror; /* estimated error (us) */ - - This member returns the time_esterror kernel variable in - microseconds. See the entry for this variable in section 5 for - additional information. - - 4.2. The ntp_adjtime() System Call - - The syntax and semantics of the ntp_adjtime() call are given in - the following fragment of the timex.h header file. Note that, as - in the ntp_gettime() system call, the syscall.h system header file - must be modified to define the SYS_ntp_adjtime system call - specific to each system type. - - /* - * NAME - * ntp_adjtime - NTP daemon application interface - * - * SYNOPSIS - * #include - * - * int system call(SYS_ntp_adjtime, mode, tptr) - * - * int SYS_ntp_adjtime defined in syscall.h header file - * struct timex *tptr pointer to timex structure - * - * NTP daemon interface - used to discipline kernel clock - * oscillator - */ - struct timex { - int mode; /* mode selector */ - long offset; /* time offset (us) */ - long frequency; /* frequency offset (scaled ppm) */ - long maxerror; /* maximum error (us) */ - long esterror; /* estimated error (us) */ - int status; /* clock command/status */ - long time_constant; /* pll time constant */ - long precision; /* clock precision (us) (read only) + /* + * NAME + * ntp_adjtime - NTP daemon application interface + * + * SYNOPSIS + * #include + * + * int system call(SYS_ntp_adjtime, mode, tptr) + * + * int SYS_ntp_adjtime defined in syscall.h header file + * struct timex *tptr pointer to timex structure + * + * NTP daemon interface - used to discipline kernel clock + * oscillator + */ + struct timex { + unsigned int mode; /* mode selector (wo) */ + long offset; /* time offset (us) (rw) */ + long frequency; /* frequency offset (scaled ppm) (rw) */ + long maxerror; /* maximum error (us) (rw) */ + long esterror; /* estimated error (us) (rw) */ + int status; /* clock status bits (rw) */ + long constant; /* pll time constant (rw) */ + long precision; /* clock precision (us) (ro) */ long tolerance; /* clock frequency tolerance (scaled - * ppm) (read only) */ + * ppm) (ro) */ /* * The following read-only structure members are implemented * only if the PPS signal discipline is configured in the * kernel. */ - long ybar; /* frequency estimate (scaled ppm) */ - long disp; /* dispersion estimate (scaled ppm) + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ - int shift; /* interval duration (s) (shift) */ - long calcnt; /* calibration intervals */ - long jitcnt; /* jitter limit exceeded */ - long discnt; /* dispersion limit exceeded */ - }; + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + }; + +The ntp_adjtime() system call is used to read and write certain time- +related kernel variables summarized below. Writing these variables can +only be done in superuser mode. To write a variable, the mode structure +member is set with one or more bits, one of which is assigned each of +the following variables in turn. The current values for all variables +are returned in any case; therefore, a mode argument of zero means to +return these values without changing anything. + +Following is a description of the timex structure members. + +mode (wo) + + This is a bit-coded variable selecting one or more structure + members, with one bit assigned each member. If a bit is set, the + value of the associated member variable is copied to the + corresponding kernel variable; if not, the member is ignored. The + bits are assigned as given in the following, with the variable name + indicated in parens. Note that the precision, tolerance and PPS + variables are determined by the kernel and cannot be changed by + ntp_adjtime(). + + MOD_OFFSET 0x0001 time offset (offset) + MOD_FREQUENCY 0x0002 frequency offset (frequency) + MOD_MAXERROR 0x0004 maximum time error (maxerror) + MOD_ESTERROR 0x0008 estimated time error (esterror) + MOD_STATUS 0x0010 clock status (status) + MOD_TIMECONST 0x0020 pll time constant (constant) + MOD_CLKB 0x4000 set clock B + MOD_CLKA 0x8000 set clock A + + Note that the MOD_CLK0 and MOD_CLK1 bits are intended for those + systems where more than one hardware clock is available for backup, + such as in Tandem Non-Stop computers. Presumably, in such cases + each clock would have its own oscillator and require a separate PLL + for each. Refinements to this model are for further study. The + interpretation of these bits is as follows: + +offset (rw) + + If selected, this member specifies the time adjustment, in + microseconds. The absolute value must be less than MAXPHASE + (128000) microseconds defined in the timex.h header file. On + return, this member contains the residual offset remaining between + a previously specified offset and the current system time, in + microseconds. + +frequency (rw) + + If selected, this member replaces the value of the time_frequency + kernel variable. The value is in ppm, with the integer part in the + high order 16 bits and fraction in the low order 16 bits. The + absolute value must be in the range less than MAXFREQ (100) ppm + defined in the timex.h header file. + + The time_freq variable represents the frequency offset of the CPU + clock oscillator. It is recalculated as each update to the system + clock is determined by the offset member of the timex structure. It + is usually set from a value stored in a file when the + synchronization daemon is first started. The current value is + usually retrieved via this member and written to the file about + once per hour. + +maxerror (rw) + + If selected, this member replaces the value of the time_maxerror + kernel variable, in microseconds. This is the same variable as in + the ntp_getime() system call. + +esterror (rw) + + If selected, this member replaces the value of the time_esterror + kernel variable, in microseconds. This is the same variable as in + the ntp_getime() system call. + +int status (rw) + + If selected, this member replaces the value of the time_status + kernel variable. This variable controls the state machine used to + insert or delete leap seconds and shows the status of the + timekeeping system, PPS signal and external oscillator, if + configured. + + STA_PLL 0x0001 enable PLL updates (r/w) + STA_PPSFREQ 0x0002 enable PPS freq discipline (r/w) + STA_PPSTIME 0x0004 enable PPS time discipline (r/w) + STA_INS 0x0010 insert leap (r/w) + STA_DEL 0x0020 delete leap (r/w) + STA_UNSYNC 0x0040 clock unsynchronized (r/w) + STA_PPSSIGNAL 0x0100 PPS signal present (r) + STA_PPSJITTER 0x0200 PPS signal jitter exceeded (r) + STA_PPSWANDER 0x0400 PPS signal wander exceeded (r) + STA_PPSERROR 0x0800 PPS signal calibration error (r) + STA_CLOCKERR 0x1000 clock hardware fault (r) + + The interpretation of these bits is as follows: + + STA_PLL set/cleared by the caller to enable PLL updates + + STA_PPSFREQ set/cleared by the caller to enable PPS frequency + discipline + + STA_PPSTIME set/cleared by the caller to enable PPS time + discipline + + STA_INS set by the caller to insert a leap second at the end + of the current day; cleared by the caller after the + event + + STA_DEL set by the caller to delete a leap second at the end + of the current day; cleared by the caller after the + event + + STA_UNSYNC set/cleared by the caller to indicate clock + unsynchronized (e.g., when no peers are reachable) + + STA_PPSSIGNAL set/cleared by the hardpps() fragment to indicate + PPS signal present + + STA_PPSJITTER set/cleared by the hardpps() fragment to indicates + PPS signal jitter exceeded + + STA_PPSWANDER set/cleared by the hardpps() fragment to indicates + PPS signal wander exceeded + + STA_PPSERROR set/cleared by the hardpps() fragment to indicates + PPS signal calibration error + + STA_CLOCKERR set/cleared by the external hardware clock driver to + indicate hardware fault + + An error condition is raised when (a) either STA_UNSYNC or + STA_CLOCKERR is set (loss of synchronization), (b) STA_PPSFREQ or + STA_PPSTIME is set and STA_PPSSIGNAL is clear (loss of PPS signal), + (c) STA_PPSTIME and STA_PPSJITTER are both set (jitter exceeded), + (d) STA_PPSFREQ is set and either STA_PPSWANDER or STA_PPSERROR is + set (wander exceeded). An error condition results in a system call + return code of TIME_ERROR. + +constant (rw) + + If selected, this member replaces the value of the time_constant + kernel variable. The value must be between zero and MAXTC (6) + defined in the timex.h header file. + + The time_constant variable determines the bandwidth or "stiffness" + of the PLL. The value is used as a shift between zero and MAXTC + (6), with the effective PLL time constant equal to a multiple of (1 + << time_constant), in seconds. For room-temperature quartz + oscillators, the recommended default value is 2, which corresponds + to a PLL time constant of about 900 s and a maximum update interval + of about 64 s. The maximum update interval scales directly with the + time constant, so that at the maximum time constant of 6, the + update interval can be as large as 1024 s. + + Values of time_constant between zero and 2 can be used if quick + convergence is necessary; values between 2 and 6 can be used to + reduce network load, but at a modest cost in accuracy. Values above + 6 are appropriate only if an precision external oscillator is + present. + +precision (ro) + This is the current value of the time_precision kernel variable in + microseconds. + + The time_precision variable represents the maximum error in reading + the system clock, in microseconds. It is usually based on the + number of microseconds between timer interrupts (tick), 10000 us + for the SunOS kernel, 3906 us for the Ultrix kernel, 976 us for the + OSF/1 kernel. However, in cases where the time can be interpolated + between timer interrupts with microsecond resolution, such as in + the stock SunOS kernel and modified Ultrix and OSF/1 kernels, the + precision is specified as 1 us. In cases where a PPS signal or + external oscillator is available, the precision can depend on the + operating condition of the signal or oscillator. This variable is + determined by the kernel for use by the synchronization daemon, but + is otherwise not used by the kernel. + +tolerance (ro) + + This is the current value of the time_tolerance kernel variable. + The value is in ppm, with the integer part in the high order 16 + bits and fraction in the low order 16 bits. + + The time_tolerance variable represents the maximum frequency error + in ppm of the particular CPU clock oscillator and is a property of + the hardware; however, in principle it could change as result of + the presence of external discipline signals, for instance. -Mills [Page 20] + The recommended value for time_tolerance MAXFREQ (200) ppm is + appropriate for room-temperature quartz oscillators used in typical + workstations. However, it can change due to the operating condition + of the PPS signal and/or external oscillator. With either the PPS + signal or external oscillator, the recommended value for MAXFREQ is + 100 ppm. -RFC February 1994 +The following members are defined only if the PPS_SYNC option is +specified in the kernel configuration file. These members are useful +primarily as a monitoring and evalutation tool. These variables can be +written only by the kernel. - The ntp_adjtime() system call is used to read and write certain - time-related kernel variables summarized in this and subsequent - sections. Writing these variables can only be done in superuser - mode. To write a variable, the mode structure member is set with - one or more bits, one of which is assigned each of the following - variables in turn. The current values for all variables are - returned in any case; therefore, a mode argument of zero means to - return these values without changing anything. - - Following is a description of the timex structure members. - - int mode; /* mode selector */ - - This is a bit-coded variable selecting one or more structure - members, with one bit assigned each member. If a bit is set, - the value of the associated member variable is copied to the - corresponding kernel variable; if not, the member is ignored. - The bits are assigned as given in the following fragment of the - timex.h header file. Note that the precision and tolerance are - determined by the kernel and cannot be changed by - ntp_adjtime(). - - /* - * Mode codes (timex.mode) - */ - #define ADJ_OFFSET 0x0001 /* time offset */ - #define ADJ_FREQUENCY 0x0002 /* frequency offset */ - #define ADJ_MAXERROR 0x0004 /* maximum time error */ - #define ADJ_ESTERROR 0x0008 /* estimated time error */ - #define ADJ_STATUS 0x0010 /* clock status */ - #define ADJ_TIMECONST 0x0020 /* pll time constant */ - - long offset; /* time offset (us) */ - - If selected, this member replaces the value of the time_offset - kernel variable in microseconds. The absolute value must be - less than MAXPHASE microseconds defined in the timex.h header - file. See the entry for this variable in section 5 for - additional information. - - If within range and the PPS signal and/or external oscillator - are configured and operating properly, the clock status is - automatically set to TIME_OK. - - long time_constant; /* pll time constant */ - - If selected, this member replaces the value of the - time_constant kernel variable. The value must be between zero - and MAXTC defined in the timex.h header file. See the entry for - this variable in section 5 for additional information. - - - - - - -Mills [Page 21] - -RFC February 1994 - - long frequency; /* frequency offset (scaled ppm) */ - - If selected, this member replaces the value of the - time_frequency kernel variable. The value is in ppm, with the - integer part in the high order 16 bits and fraction in the low - order 16 bits. The absolute value must be in the range less - than MAXFREQ ppm defined in the timex.h header file. See the - entry for this variable in section 5 for additional - information. - - long maxerror; /* maximum error (us) */ - - If selected, this member replaces the value of the - time_maxerror kernel variable in microseconds. See the entry - for this variable in section 5 for additional information. - - long esterror; /* estimated error (us) */ - - If selected, this member replaces the value of the - time_esterror kernel variable in microseconds. See the entry - for this variable in section 5 for additional information. - - int status; /* clock command/status */ - - If selected, this member replaces the value of the time_status - kernel variable. See the entry for this variable in section 5 - for additional information. - - In order to set this variable by ntp_adjtime(), either (a) the - current clock status must be TIME_OK or (b) the member value is - TIME_BAD; that is, the ntp_adjtime() call can always set the - clock to the unsynchronized state or, if the clock is running - correctly, can set it to any state. In any case, the - ntp_adjtime() call always returns the current state in this - member, so the caller can determine whether or not the request - succeeded. - - long time_constant; /* pll time constant */ - - If selected, this member replaces the value of the - time_constant kernel variable. The value must be between zero - and MAXTC defined in the timex.h header file. See the entry for - this variable in section 5 for additional information. - - long precision; /* clock precision (us) (read only) */ - - This member returns the time_precision kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - - - - - -Mills [Page 22] - -RFC February 1994 - - long tolerance; /* clock frequency tolerance (scaled ppm) - */ - - This member returns the time_tolerance kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - long ybar; /* frequency estimate (scaled ppm) */ - - This member returns the pps_ybar kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - long disp; /* dispersion estimate (scaled ppm) */ - - This member returns the pps_disp kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - int shift; /* interval duration (s) (shift) */ - - This member returns the pps_shift kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - long calcnt; /* calibration intervals */ - - This member returns the pps_calcnt kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - long jitcnt; /* jitter limit exceeded */ - - This member returns the pps_jittcnt kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - long discnt; /* dispersion limit exceeded */ - - This member returns the pps_discnt kernel variable in - microseconds. The variable can be written only by the kernel. - See the entry for this variable in section 5 for additional - information. - - 4.3. Command/Status Codes - - The kernel routines use the system clock status variable - time_status, which records whether the clock is synchronized, - - -Mills [Page 23] - -RFC February 1994 - - waiting for a leap second, etc. The value of this variable is - returned as the result code by both the ntp_gettime() and - ntp_adjtime() system calls. In addition, it can be explicitly read - and written using the ntp_adjtime() system call, but can be - written only in superuser mode. Values presently defined in the - timex.h header file are as follows: - - /* - * Clock command/status codes (timex.status) - */ - #define TIME_OK 0 /* clock synchronized */ - #define TIME_INS 1 /* insert leap second */ - #define TIME_DEL 2 /* delete leap second */ - #define TIME_OOP 3 /* leap second in progress */ - #define TIME_BAD 4 /* kernel clock not synchronized */ - #define TIME_ERR 5 /* external oscillator not - synchronized */ - - A detailed description of these codes as used by the leap-second - state machine is given later in this memorandum. In case of a - negative result code, the kernel has intercepted an invalid - address or (in case of the ntp_adjtime() system call), a superuser - violation. - -5. Kernel Variables - - This section contains a list of kernel variables and a detailed - description of their function, initial value, scaling and limits. - - 5.1. Interface Variables - - The following variables are read and set by the ntp_adjtime() - system call. Additional automatic variables are used as - temporaries as described in the code fragments. - - int time_status = TIME_BAD; - - This variable controls the state machine used to insert or - delete leap seconds and show the status of the timekeeping - system, PPS signal and external oscillator, if configured. - - long time_offset = 0; - - This variable is used by the PLL to adjust the system time in - small increments. It is scaled by (1 << SHIFT_UPDATE) (12) in - microseconds. The maximum value that can be represented is - about +-512 ms and the minimum value or precision is a few - parts in 10^10 s. - - long time_constant = 0; /* pll time constant */ - - This variable determines the bandwidth or "stiffness" of the - PLL. The value is used as a shift between zero and MAXTC (6), - with the effective PLL time constant equal to a multiple of (1 - - -Mills [Page 24] - -RFC February 1994 - - << time_constant) in seconds. For room-temperature quartz - oscillator the recommended default value is 2, which - corresponds to a PLL time constant of about 900 s and a maximum - update interval of about 64 s. The maximum update interval - scales directly with the time constant, so that at the maximum - time constant of 6, the update interval can be as large as 1024 - s. - - Values of time_constant between zero and 2 can be used if quick - convergence is necessary; values between 2 and 6 can be used to - reduce network load, but at a modest cost in accuracy. Values - above 6 are appropriate only if an external oscillator is - present. - - long time_tolerance = MAXFREQ; /* frequency tolerance (ppm) */ - - This variable represents the maximum frequency error or - tolerance in ppm of the particular CPU clock oscillator and is - a property of the architecture; however, in principle it could - change as result of the presence of external discipline - signals, for instance. It is expressed as a positive number - greater than zero in parts-per-million (ppm). - - The recommended value of MAXFREQ is 200 ppm is appropriate for - room-temperature quartz oscillators used in typical - workstations. However, it can change due to the operating - condition of the PPS signal and/or external oscillator. With - either the PPS signal or external oscillator, the recommended - value for MAXFREQ is 100 ppm. - - long time_precision = 1000000 / HZ; /* clock precision (us) */ - - This variable represents the maximum error in reading the - system clock in microseconds. It is usually based on the number - of microseconds between timer interrupts, 10000 us for the - SunOS kernel, 3906 us for the Ultrix kernel, 976 us for the - OSF/1 kernel. However, in cases where the time can be - interpolated between timer interrupts with microsecond - resolution, such as in the unmodified SunOS kernel and modified - Ultrix and OSF/1 kernels, the precision is specified as 1 us. - In cases where a PPS signal or external oscillator is - available, the precision can depend on the operating condition - of the signal or oscillator. This variable is determined by the - kernel for use by the synchronization daemon, but is otherwise - not used by the kernel. - - long time_maxerror = MAXPHASE; /* maximum error */ - - This variable establishes the maximum error of the indicated - time relative to the primary synchronization source in - microseconds. For NTP, the value is initialized by a - ntp_adjtime() call to the synchronization distance, which is - equal to the root dispersion plus one-half the root delay. It - is increased by a small amount (time_tolerance) each second to - - -Mills [Page 25] - -RFC February 1994 - - reflect the clock frequency tolerance. This variable is - computed by the synchronization daemon and the kernel, but is - otherwise not used by the kernel. - - long time_esterror = MAXPHASE; /* estimated error */ - - This variable establishes the expected error of the indicated - time relative to the primary synchronization source in - microseconds. For NTP, the value is determined as the root - dispersion, which represents the best estimate of the actual - error of the system clock based on its past behavior, together - with observations of multiple clocks within the peer group. - This variable is computed by the synchronization daemon and - returned in system calls, but is otherwise not used by the - kernel. - - 5.2. Phase-Lock Loop Variables - - The following variables establish the state of the PLL and the - residual time and frequency offset of the system clock. Additional - automatic variables are used as temporaries as described in the - code fragments. - - long time_phase = 0; /* phase offset (scaled us) */ - - The time_phase variable represents the phase of the kernel time - variable at each tick of the clock. This variable is scaled by - (1 << SHIFT_SCALE) (23) in microseconds, giving a maximum - adjustment of about +-256 us/tick and a resolution less than - one part in 10^12. - - long time_offset = 0; /* time offset (scaled us) */ - - The time_offset variable represents the time offset of the CPU - clock oscillator. It is recalculated as each update to the - system clock is received via the hardupdate() routine and at - each second in the seconds_overflow routine. This variable is - scaled by (1 << SHIFT_UPDATE) (12) in microseconds, giving a - maximum adjustment of about +-512 ms and a resolution of a few - parts in 10^10 s. - - long time_freq = 0; /* frequency offset (scaled ppm) */ - - The time_freq variable represents the frequency offset of the - CPU clock oscillator. It is recalculated as each update to the - system clock is received via the hardupdate() routine. It can - also be set via ntp_adjtime() from a value stored in a file - when the synchronization daemon is first started. It can be - retrieved via ntp_adjtime() and written to the file about once - per hour by the daemon. The time_freq variable is scaled by (1 - << SHIFT_KF) (16) ppm, giving it a maximum value well in excess - of the limit of +-256 ppm imposed by other constraints. The - precision of this representation (frequency resolution) is - - - -Mills [Page 26] - -RFC February 1994 - - parts in 10^11, which is adequate for all but the best external - oscillators. - - time_adj = 0; /* tick adjust (scaled 1 / HZ) */ - - The time_adj variable is the adjustment added to the value of - tick at each timer interrupt. It is computed once each second - from the time_offset, time_freq and, if the PPS signal is - present, the ps_ybar variable once each second. - - long time_reftime = 0; /* time at last adjustment (s) */ - - This variable is the seconds portion of the system time on the - last update received by the hardupdate() routine. It is used to - compute the time_freq variable as the time since the last - update increases. - - int fixtick = 1000000 % HZ; /* amortization factor */ - - In the Ultrix and OSF/1 kernels, the interval between timer - interrupts does not evenly divide the number of microseconds in - the second. In order that the clock runs at a precise rate, it - is necessary to introduce an amortization factor into the local - timescale. In the original Unix code, the value of fixtick is - amortized once each second, introducing an additional source of - jitter; in the new model the value is amortized at each tick of - the system clock, reducing the jitter by the reciprocal of the - clock oscillator frequency. This is not a new kernel variable, - but a new use of an existing kernel variable. - - 5.3. Pulse-per-second (PPS) Frequency-Lock Loop Variables - - The following variables are used only if a pulse-per-second (PPS) - signal is available and connected via a modem-control lead, such - as produced by the optional ppsclock feature incorporated in the - serial port driver. They establish the design parameters of the - PPS frequency-lock loop used to discipline the CPU clock - oscillator to an external PPS signal. Additional automatic - variables are used as temporaries as described in the code - fragments. - - long pps_usec; /* microseconds at last pps */ - - The pps_usec variable is latched from a high resolution counter - or external oscillator at each PPS interrupt. In determining - this value, only the hardware counter contents are used, not - the contents plus the kernel time variable, as returned by the - microtime() routine. - - long pps_ybar = 0; /* pps frequency offset estimate */ - - The pps_ybar variable is the average CPU clock oscillator - frequency offset relative to the PPS disciplining signal. It is - scaled in the same units as the time_freq variable. - - -Mills [Page 27] - -RFC February 1994 - - pps_disp = MAXFREQ; /* dispersion estimate (scaled ppm) */ - - The pps_disp variable represents the average sample dispersion - measured over the last three samples. It is scaled in the same - units as the time_freq variable. - - pps_dispmax = MAXFREQ / 2; /* dispersion threshold */ - - The pps_dispmax variable is used as a dispersion threshold. If - pps_disp is less than this threshold, the median sample is used - to update the pps_ybar estimate; if not, the sample is - discarded. - - pps_dispinc = MAXFREQ >> (PPS_SHIFT + 4); /* pps dispersion - increment/sec */ - - The pps_dispinc variable is the increment to add to pps_disp - once each second. It is computed such that, if no PPS samples - have arrived for several calibration intervals, the value of - pps_disp will exceed the pps_dispmax threshold and raise an - alarm. - - int pps_mf[] = {0, 0, 0}; /* pps median filter */ - - The pps-mf[] array is used as a median filter to detect and - discard jitter in the PPS signal. - - int pps_count = 0; /* pps calibrate interval counter */ - - The pps_count variable measures the length of the calibration - interval used to calculate the frequency. It normally counts - from zero to the value 1 << pps_shift. - - pps_shift = PPS_SHIFT; /* interval duration (s) (shift) */ - - The pps_shift variable determines the duration of the - calibration interval, 1 << pps_shift s. - - pps_intcnt = 0; /* intervals at current duration */ - - The pps_intcnt variable counts the number of calibration - intervals at the current interval duration. It is reset to zero - after four intervals and when the interval duration is changed. - - 5.4. External Oscillator Variables - - The following variables are used only if an external oscillator - (HIGHBALL or TPRO) is present. Additional automatic variables are - used as temporaries as described in the code fragments. - - - - - - - -Mills [Page 28] - -RFC February 1994 - - int clock_count = 0; /* CPU clock counter */ - - The clock_count variable counts the seconds between adjustments - to the kernel time variable to discipline it to the external - clock. - - struct timeval clock_offset; /* HIGHBALL clock offset */ - - The clock_offset variable defines the offset between system - time and the HIGHBALL counters. - - long clock_cpu = 0; /* CPU clock adjust */ - - The clock_cpu variable contains the offset between the system - clock and the HIGHBALL clock for use in disciplining the kernel - time variable. - -6. Architecture Constants - - Following is a list of the important architecture constants that - establish the response and stability of the PLL and provide maximum - bounds on behavior in order to satisfy correctness assertions made in - the protocol specification. Additional definitions are given in the - timex.h header file. - - 6.1. Phase-lock loop (PLL) definitions - - The following defines establish the performance envelope of the - PLL. They establish the maximum phase error (MAXPHASE), maximum - frequency error (MAXFREQ), minimum interval between updates - (MINSEC) and maximum interval between updates (MAXSEC). The intent - of these bounds is to force the PLL to operate within predefined - limits in order to satisfy correctness assertions of the - synchronization protocol. An excursion which exceeds these bounds - is clamped to the bound and operation proceeds normally. In - practice, this can occur only if something has failed or is - operating out of tolerance, but otherwise the PLL continues to - operate in a stable mode. - - MAXPHASE must be set greater than or equal to CLOCK.MAX (128 ms), - as defined in the NTP specification. CLOCK.MAX establishes the - maximum time offset allowed before the system time is reset, - rather than incrementally adjusted. Here, the maximum offset is - clamped to MAXPHASE only in order to prevent overflow errors due - to defective programming. - - MAXFREQ reflects the manufacturing frequency tolerance of the CPU - oscillator plus the maximum slew rate allowed by the protocol. It - should be set to at least the intrinsic frequency tolerance of the - oscillator plus 100 ppm for vernier frequency adjustments. If the - kernel frequency discipline code is installed (PPS_SYNC), the CPU - oscillator frequency is disciplined to an external source, - presumably with negligible frequency error. - - - -Mills [Page 29] - -RFC February 1994 - - #define MAXPHASE 512000 /* max phase error (us) */ - #ifdef PPS_SYNC - #define MAXFREQ 100 /* max frequency error (ppm) */ - #else - #define MAXFREQ 200 /* max frequency error (ppm) */ - #endif /* PPS_SYNC */ - #define MINSEC 16 /* min interval between updates (s) - */ - #define MAXSEC 1200 /* max interval between updates (s) - */ - - 6.2. Pulse-per-second (PPS) Frequency-lock Loop (FLL) Definitions - - The following defines and declarations are used only if a pulse- - per-second (PPS) signal is available and connected via a modem- - control lead, such as produced by the optional ppsclock feature - incorporated in the serial port driver. They establish the design - parameters of the frequency-lock loop (FLL) used to discipline the - CPU clock oscillator to the PPS oscillator. - - PPS_AVG is the averaging constant used to update the FLL from - frequency samples measured for each calibration interval. - PPS_SHIFT and PPS_SHIFTMAX are the minimum and maximem, - respectively, of the calibration interval represented as a power - of two. The PPS_DISPINC is the initial increment to pps_disp at - each second. - - #define PPS_AVG 2 /* pps averaging constant (shift) */ - #define PPS_SHIFT 2 /* min interval duration (s) (shift) - */ - #define PPS_SHIFTMAX 6 /* max interval duration (s) (shift) - */ - #define PPS_DISPINC 0 /* dispersion increment (us/s) */ - - 6.3. External Oscillator Definitions - - The following definitions and declarations are used only if an - external oscillator (HIGHBALL or TPRO) is configured on the - system. - - #define CLOCK_INTERVAL 30 /* CPU clock update interval (s) */ +ppsfreq (ro) + + This is the current value of the pps_freq kernel variable, which is + the CPU clock oscillator frequency offset relative to the PPS + discipline signal. The value is in ppm, with the integer part in + the high order 16 bits and fraction in the low order 16 bits. + +jitter (ro) + + This is the current value of the pps_jitter kernel variable, which + is the average PPS time dispersion measured by the time-offset + median filter, in microseconds. + +shift (ro) + + This is the current value of the pps_shift kernel variable, which + determines the duration of the calibration interval as the value of + 1 << pps_shift, in seconds. +stabil (ro) + + This is the current value of the pps_stabil kernel variable, which + is the average PPS frequency dispersion measured by the frequency- + offset median filter. The value is in ppm, with the integer part in + the high order 16 bits and fraction in the low order 16 bits. + +jitcnt (ro) + + This is the current value of the pps_jitcnt kernel variable, counts + the number of PPS signals where the average jitter exceeds the + threshold MAXTIME (200 us). + +calcnt (ro) + + This is the current value of the pps_calcnt kernel variable, which + counts the number of frequency calibration intervals. The duration + of these intervals can range from 4 to 256 seconds, as determined + by the pps_shift kernel variable. + +errcnt (ro) + + This is the current value of the pps_errcnt kernel variable, which + counts the number of frequency calibration cycles where (a) the + apparent frequency offset is greater than MAXFREQ (100 ppm) or (b) + the interval jitter exceeds tick * 2. + +stbcnt (ro) + + This is the current value of the pps_discnt kernel variable, which + counts the number of calibration intervals where the average + stability exceeds the threshold MAXFREQ / 4 (25 ppm). 7. References - [LEV89] Levine, J., M. Weiss, D.D. Davis, D.W. Allan, and D.B. - Sullivan. The NIST automated computer time service. J. Research - National Institute of Standards and Technology 94, 5 (September- - October 1989), 311-321. +[MIL91] 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. - [MIL91] 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. +[MIL92a] Mills, D.L. Network Time Protocol (Version 3) specification, +implementation and analysis, RFC 1305, University of Delaware, March +1992, 113 pp. +[MIL92b] Mills, D.L. Modelling and analysis of computer network clocks, +Electrical Engineering Department Report 92-5-2, University of Delaware, +May 1992, 29 pp. +[MIL92c] Mills, D.L. Simple Network Time Protocol (SNTP), RFC 1361, +University of Delaware, August 1992, 10 pp. -Mills [Page 30] +[MIL93] Mills, D.L. Precision synchronizatin of computer network clocks, +Electrical Engineering Department Report 93-11-1, University of +Delaware, November 1993, 66 pp. -RFC February 1994 +[LEV89] Levine, J., M. Weiss, D. Davis, D. Allan, and D. Sullivan. The +NIST automated computer time service. J. Research National Institute of +Standards and Technology 94, 5 (September-October 1989), 311-321. - [MIL92a] Mills, D.L. Network Time Protocol (Version 3) specification, - implementation and analysis. DARPA Network Working Group Report RFC- - 1305, University of Delaware, March 1992, 113 pp. - - [MIL92b] Mills, D.L. Modelling and analysis of computer network - clocks. Electrical Engineering Department Report 92-5-2, University - of Delaware, May 1992, 29 pp. - - [MIL92c] Mills, D.L. Simple Network Time Protocol (SNTP). DARPA - Network Working Group Report RFC-1361, University of Delaware, August - 1992, 10 pp. - - [MIL93] Mills, D.L. Precision synchronizatin of computer network - clocks. Electrical Engineering Department Report 93-11-1, University - of Delaware, November 1993, 66 pp. - -Author's Address - - David L. Mills - Electrical Engineering Department - University of Delaware - Newark, DE 19716 - - Phone: (302) 831-8247 - - EMail: mills@udel.edu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Mills [Page 31] +David L. Mills +Electrical Engineering Department +University of Delaware +Newark, DE 19716 +302 831 8247 fax 302 831 4316 +3 April 1994 diff --git a/usr.sbin/xntpd/doc/xntpd.8 b/usr.sbin/xntpd/doc/xntpd.8 index c141df9bd151..84b785bd54f0 100644 --- a/usr.sbin/xntpd/doc/xntpd.8 +++ b/usr.sbin/xntpd/doc/xntpd.8 @@ -137,6 +137,9 @@ on this computer specify the location of the drift file .Ip -k 8 specify the location of the file which contains the NTP authentication keys +.Ip -m 8 +listen for multicast NTP and sync to this if available (requires multicast +kernel) .Ip -p 8 specify the name of the file to record the daemon's process id .Ip -r 8 @@ -215,7 +218,10 @@ the remote host synchronize to your own time. The .B broadcast statement requests your local daemon to transmit broadcast NTP to the specified address. The latter is usually the broadcast address -on [one of] your local network[s]. +on [one of] your local network[s] or a multicast address assigned to +NTP. The Numbers Czar has assigned the address 224.0.1.1 to NTP; this +is presently the only number that should be used. Note that the use +of multicast requires a multicast kernel. .PP The .B key @@ -273,7 +279,7 @@ must have write permission for the directory the drift file is located in, and that file system links, symbolic or otherwise, should probably be avoided. .PP -.B "monitor yes|no" +.B monitor yes|no .PP Indicates whether the .I xntpd @@ -297,10 +303,23 @@ is primarily intended for very popular servers which exchange time with large numbers of peers, though it may also be useful for access monitoring of local servers if you are willing to accept the overhead. .PP -.B "broadcastclient yes|no" +.B broadcastclient .PP -This indicates whether the local server should listen for, and attempt to -synchonize to, broadcast NTP. The default is \*(L"no\*(R". +This directs the local server should listen for, and attempt to +synchonize to, broadcast NTP. Note that authentication is required in +this mode. +.PP +.B multicastclient +[ +.I IP address ... +] +.PP +This directs the local server should listen for, and attempt to +synchonize to, multicast NTP. This function requires a multicast kernel +and the use of authentication. +If one or more IP addresses are given, the server joins the respective +multicast group. If none are given, the default address assigned to +NTP (224.0.1.1) is assumed. .PP .B broadcastdelay .I seconds @@ -311,7 +330,7 @@ typically (for ethernet) a number between 0.007 and 0.015 seconds. This initial estimate may be improved by polling each server to determine a more accurate value. Defaults to 0.008 seconds. .PP -.B "authenticate yes|no" +.B authenticate yes|no .PP Indicates whether the local server should operate in authenticate mode or not. If \*(L"yes\*(R", only peers which include an authentication field diff --git a/usr.sbin/xntpd/doc/xntpdc.8 b/usr.sbin/xntpd/doc/xntpdc.8 index 65450e354b3a..80979e2675b4 100644 --- a/usr.sbin/xntpd/doc/xntpdc.8 +++ b/usr.sbin/xntpd/doc/xntpdc.8 @@ -382,6 +382,12 @@ other clock performance information. Obtain debugging information for a clock peer. This information is provided only by some clock drivers and is mostly undecodable without a copy of the driver source in hand. +.PP +.B kerninfo +.PP +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. .SH RUNTIME CONFIGURATION REQUESTS .PP All requests which cause state changes in the server are authenticated @@ -494,15 +500,16 @@ deleted. When appropriate, however, the association may persist in an unconfigured mode if the remote peer is willing to continue on in this fashion. .PP -.B set bclient|auth +.B set bclient|mclient|auth [ .I ... ] .PP -Allows the setting of the broadcast client and/or authenticate system -flags. Setting the former causes the server to listen for broadcast -NTP to to synchronize to broadcasts when appropriate. Setting the -latter flag causes the server to only synchronize with peers which +Allows the setting of the broadcast/multicast client and/or authenticate +system flags. Setting bclient causes the server to listen for broadcast +NTP to to synchronize to broadcasts when appropriate. Setting mclient +causes the same thing, but using multicast facilities, when available. +Setting auth causes the server to only synchronize with peers which include an authentication field encrypted with one of the local server's trusted keys. .PP @@ -511,9 +518,9 @@ trusted keys. .I ... ] .PP -Allows the broadcast client and/or authenticate system flags to be -cleared. Clearing the former causes incoming broadcast NTP packets -to be ignored. Clearing the latter allows peers which have not included +Allows the broadcast/multicast client and/or authenticate system flags to be +cleared. Clearing bclient causes incoming broadcast and multicast NTP packets +to be ignored. Clearing auth allows peers which have not included an authentication field, or which have included one but have encrypted it with an untrusted key, to be considered synchronization candidates. .PP @@ -663,14 +670,6 @@ done. .PP Sets the precision which the server advertises to the specified value. This should be a negative integer in the range -4 through -20. -.PP -.B setselect -.I algorithm_number -.PP -Sets the selection weight algorithm to that indicated by the specified number. -This should be an integer value between 1 and 5 inclusive. Algorithm 1 -is that specified in RFC 1119, the other 4 algorithms are experimental -and should be used with caution. .SH SEE ALSO .PP .IR xntpd (8) diff --git a/usr.sbin/xntpd/include/l_stdlib.h b/usr.sbin/xntpd/include/l_stdlib.h index 89a8092853b5..e0b7c474095c 100644 --- a/usr.sbin/xntpd/include/l_stdlib.h +++ b/usr.sbin/xntpd/include/l_stdlib.h @@ -70,11 +70,11 @@ extern int getppid P((void)); extern int close P((int)); extern int ioctl P((int, int, char *)); -extern int read P((int, char *, unsigned)); +extern int read P((int, void *, unsigned)); extern int rename P((char *, char *)); -extern int write P((int, char *, int)); -extern int unlink P((char *)); -extern int link P((char *, char *)); +extern int write P((int, const void *, unsigned)); +extern int unlink P((const char *)); +extern int link P((const char *, const char *)); #ifdef FILE extern int fclose P((FILE *)); diff --git a/usr.sbin/xntpd/include/ntp.h b/usr.sbin/xntpd/include/ntp.h index b3fd0ce792f2..01bfa16a7ad8 100644 --- a/usr.sbin/xntpd/include/ntp.h +++ b/usr.sbin/xntpd/include/ntp.h @@ -173,6 +173,7 @@ struct interface { #define INT_BROADCAST 1 /* can broadcast out this interface */ #define INT_BCASTOPEN 2 /* broadcast socket is open */ #define INT_LOOPBACK 4 /* the loopback interface */ +#define INT_MULTICAST 8 /* multicasting enabled */ /* * Define flasher bits (tests 1 through 8 in packet procedure) @@ -222,7 +223,7 @@ struct peer { U_LONG keyid; /* encription key ID */ U_LONG pkeyid; /* keyid used to encrypt last message */ u_short associd; /* association ID, a unique integer */ - u_char unused; + u_char ttl; /* time to live (multicast) */ /* **Start of clear-to-zero area.*** */ /* Everything that is cleared to zero goes below here */ u_char valid; /* valid counter */ @@ -248,12 +249,6 @@ struct peer { s_fp soffset; /* fp version of above */ s_fp synch; /* synch distance from above */ u_fp selectdisp; /* select dispersion */ - - /* - * Stuff related to the experimental broadcast delay - * determination code. The registers will probably go away - * later. - */ U_LONG estbdelay; /* broadcast delay, as a ts fraction */ /* @@ -579,8 +574,8 @@ struct recvbuf { #define PROTO_AUTHENTICATE 3 #define PROTO_BROADDELAY 4 #define PROTO_AUTHDELAY 5 -#define PROTO_MAXSKEW 6 -#define PROTO_SELECT 7 +#define PROTO_MULTICAST_ADD 6 +#define PROTO_MULTICAST_DEL 7 /* * Configuration items for the loop filter @@ -603,7 +598,7 @@ struct recvbuf { */ #define DEFPRECISION (-5) /* conservatively low */ #define DEFBROADDELAY (0x020c49ba) /* 8 ms. This is round trip delay */ - +#define INADDR_NTP 0xe0000101 /* NTP multicast address 224.0.1.1 */ /* * Structure used optionally for monitoring when this is turned on. */ diff --git a/usr.sbin/xntpd/include/ntp_control.h b/usr.sbin/xntpd/include/ntp_control.h index 74f75f17f51a..1e193835660d 100644 --- a/usr.sbin/xntpd/include/ntp_control.h +++ b/usr.sbin/xntpd/include/ntp_control.h @@ -68,6 +68,7 @@ struct ntp_control { #define CTL_SST_TS_UDPTIME 7 /* time source UDP/TIME */ #define CTL_SST_TS_WRSTWTCH 8 /* time source is wristwatch */ #define CTL_SST_TS_TELEPHONE 9 /* time source is telephone modem */ +#define CTL_SST_TS_PPS 0x20 /* time source is PPS signal */ #define CTL_SYS_MAXEVENTS 15 diff --git a/usr.sbin/xntpd/include/ntp_if.h b/usr.sbin/xntpd/include/ntp_if.h index 1a76ca02da4b..45a70c51bcd5 100644 --- a/usr.sbin/xntpd/include/ntp_if.h +++ b/usr.sbin/xntpd/include/ntp_if.h @@ -16,6 +16,10 @@ #include #endif +#if defined(SYS_UNIXWARE1) +#include +#endif + #if defined(SYS_PTX) || defined(SYS_SINIXM) #include #include diff --git a/usr.sbin/xntpd/include/ntp_in.h b/usr.sbin/xntpd/include/ntp_in.h new file mode 100755 index 000000000000..80aa45151fc6 --- /dev/null +++ b/usr.sbin/xntpd/include/ntp_in.h @@ -0,0 +1,259 @@ +/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +#ifndef _netinet_in_h +#define _netinet_in_h +#define _NETINET_IN_H_ +#define _SYS_IN_INCLUDED +#define __IN_HEADER + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group control protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_ST 5 /* st */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ +#define IPPROTO_OSPF 89 /* Open SPF IGP */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Internet address + * This definition contains obsolete fields for compatibility + * with SunOS 3.x and 4.2bsd. The presence of subnets renders + * divisions into fixed fields misleading at best. New code + * should use only the s_addr field. + */ +struct in_addr { + union { + struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { u_short s_w1,s_w2; } S_un_w; + u_long S_addr; + } S_un; +#define s_addr S_un.S_addr /* should be used for all code */ +#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ +#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ +#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ +#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ +#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ + +#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define IP_OPTIONS 1 /* set/get IP per-packet options */ +#define IP_MULTICAST_IF 2 /* set/get IP multicast interface */ +#define IP_MULTICAST_TTL 3 /* set/get IP multicast timetolive */ +#define IP_MULTICAST_LOOP 4 /* set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 5 /* add an IP group membership */ +#define IP_DROP_MEMBERSHIP 6 /* drop an IP group membership */ + +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +#if !defined(vax) && !defined(ntohl) && !defined(i386) +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) +#endif + +#if !defined(ntohl) && (defined(vax) || defined(i386)) +u_short ntohs(), htons(); +u_long ntohl(), htonl(); +#endif + +#ifdef KERNEL +extern struct domain inetdomain; +extern struct protosw inetsw[]; +struct in_addr in_makeaddr(); +u_long in_netof(), in_lnaof(); +#endif + +#ifndef BYTE_ORDER +/* + * Definitions for byte order, + * according to byte significance from low address to high. + */ +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ + +#if defined(vax) || defined(i386) +#define BYTE_ORDER LITTLE_ENDIAN +#else +#define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ +#endif +#endif BYTE_ORDER + +/* + * Macros for number representation conversion. + */ +#if BYTE_ORDER==LITTLE_ENDIAN +#define NTOHL(d) ((d) = ntohl((d))) +#define NTOHS(d) ((d) = ntohs((d))) +#define HTONL(d) ((d) = htonl((d))) +#define HTONS(d) ((d) = htons((d))) +#else +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) +#define NTOHL(d) +#define NTOHS(d) +#define HTONL(d) +#define HTONS(d) +#endif + +#endif /*!_netinet_in_h*/ diff --git a/usr.sbin/xntpd/include/ntp_io.h b/usr.sbin/xntpd/include/ntp_io.h index c3b79be0616c..d60f08359b84 100644 --- a/usr.sbin/xntpd/include/ntp_io.h +++ b/usr.sbin/xntpd/include/ntp_io.h @@ -3,6 +3,7 @@ * SEEK_SET symbol form . */ #if defined(NTP_POSIX_SOURCE) + /* * POSIX way */ diff --git a/usr.sbin/xntpd/include/ntp_machine.h b/usr.sbin/xntpd/include/ntp_machine.h index 4c7c3eadbd1c..abc0acb0c61a 100644 --- a/usr.sbin/xntpd/include/ntp_machine.h +++ b/usr.sbin/xntpd/include/ntp_machine.h @@ -525,6 +525,40 @@ typedef unsigned long u_long; #endif #endif +/* + * (Univel/Novell) Unixware1 SVR4 on intel x86 processor + */ +#if defined(SYS_UNIXWARE1) +/* #define _POSIX_SOURCE */ +#undef HAVE_ATT_SETPGRP +#define USE_PROTOTYPES +#define NTP_POSIX_SOURCE +#define HAVE_ATT_NICE +#define HAVE_READKMEM +#define USE_TTY_SIGPOLL +#define USE_UDP_SIGPOLL +#define UDP_WILDCARD_DELIVERY +#undef HAVE_SIGNALED_IO +#define STREAM +#define STREAMS +#ifndef STREAMS_TLI +/*#define STREAMS_TLI*/ +#endif +/* #define USE_STREAMS_DEVICE_FOR_IF_CONFIG */ +#undef STEP_SLEW /* TWO step */ +#define LOCK_PROCESS +#define NO_SIGNED_CHAR_DECL +#undef SYSV_TIMEOFDAY +#define SIZE_RETURNED_IN_BUFFER +#define RETSIGTYPE void +#include +#include +#include +#ifndef STR_SYSTEM +#define STR_SYSTEM "UNIX/Unixware1" +#endif +#endif + /* * DomainOS */ diff --git a/usr.sbin/xntpd/include/ntp_request.h b/usr.sbin/xntpd/include/ntp_request.h index b791c189072b..b1a947291316 100644 --- a/usr.sbin/xntpd/include/ntp_request.h +++ b/usr.sbin/xntpd/include/ntp_request.h @@ -254,9 +254,8 @@ struct resp_pkt { #define REQ_GET_LEAPINFO 35 /* get leap information */ #define REQ_GET_CLOCKINFO 36 /* get clock information */ #define REQ_SET_CLKFUDGE 37 /* set clock fudge factors */ -#define REQ_SET_MAXSKEW 38 /* set the maximum skew factor */ +#define REQ_GET_KERNEL 38 /* get kernel pll/pps information */ #define REQ_GET_CLKBUGINFO 39 /* get clock debugging info */ -#define REQ_SET_SELECT_CODE 40 /* set selection algorithm */ #define REQ_SET_PRECISION 41 /* set clock precision */ @@ -267,8 +266,9 @@ struct resp_pkt { #define INFO_FLAG_SYSPEER 0x2 #define INFO_FLAG_MINPOLL 0x4 #define INFO_FLAG_REFCLOCK 0x8 +#define INFO_FLAG_MCLIENT 0x8 /* danger */ #define INFO_FLAG_BCLIENT 0x10 -#define INFO_FLAG_PREFER 0x10 /* SHARES BCLIENT bit - ok since mutually exclusive - Oh why ist flags a u_char ? */ +#define INFO_FLAG_PREFER 0x10 /* danger */ #define INFO_FLAG_AUTHENABLE 0x20 #define INFO_FLAG_SEL_CANDIDATE 0x40 #define INFO_FLAG_SHORTLIST 0x80 @@ -323,10 +323,10 @@ struct info_peer { u_char valid; /* peer.valid */ u_char reach; /* peer.reach */ u_char unreach; /* peer.unreach */ - u_char trust; /* peer.trust */ - u_char unused1; - u_char unused2; - u_char unused3; + u_char flash; /* peer.flash */ + u_char ttl; /* peer.ttl */ + u_char unused8; /* (obsolete) */ + u_char unused9; u_short associd; /* association ID */ U_LONG keyid; /* auth key in use */ U_LONG pkeyid; /* peer.pkeyid */ @@ -344,7 +344,14 @@ struct info_peer { s_fp delay; /* peer.estdelay */ u_fp dispersion; /* peer.estdisp */ l_fp offset; /* peer.estoffset */ - U_LONG bdelay[NTP_SHIFT]; /* broadcast delay filters */ + u_fp selectdisp; /* peer select dispersion */ + LONG unused1; /* (obsolete) */ + LONG unused2; + LONG unused3; + LONG unused4; + LONG unused5; + LONG unused6; + LONG unused7; U_LONG estbdelay; /* broadcast delay */ }; @@ -406,12 +413,13 @@ struct info_sys { U_LONG refid; /* reference ID of sync source */ l_fp reftime; /* system reference time */ U_LONG poll; /* system poll interval */ - u_short flags; /* system flags */ - u_char selection; /* selection algorithm code */ - u_char unused; - l_fp bdelay; /* default broadcast delay, a ts fraction */ + u_char flags; /* system flags */ + u_char unused1; /* unused */ + u_char unused2; /* unused */ + u_char unused3; /* unused */ + l_fp bdelay; /* default broadcast delay */ l_fp authdelay; /* default authentication delay */ - u_fp maxskew; /* maximum skew parameter (obsolete) */ + u_fp maxskew; /* (obsolete) */ }; @@ -428,7 +436,7 @@ struct info_sys_stats { U_LONG badlength; /* packets with bad length */ U_LONG processed; /* packets processed */ U_LONG badauth; /* packets dropped because of authorization */ - U_LONG wanderhold; + U_LONG wanderhold; /* (obsolete) */ U_LONG limitrejected; /* rejected because of client limitation */ }; @@ -504,7 +512,8 @@ struct conf_peer { u_char minpoll; /* min host poll interval */ u_char maxpoll; /* max host poll interval */ u_char flags; /* flags for this request */ - u_char unused; + u_char ttl; /* time to live (multicast) */ + u_short unused; /* unused */ U_LONG keyid; /* key to use for this association */ }; @@ -534,6 +543,7 @@ struct conf_sys_flags { */ #define SYS_FLAG_BCLIENT 0x1 #define SYS_FLAG_AUTHENTICATE 0x2 +#define SYS_FLAG_MCLIENT 0x4 /* * Structure used for returning restrict entries @@ -742,3 +752,29 @@ struct info_clkbug { U_LONG values[NUMCBUGVALUES]; l_fp times[NUMCBUGTIMES]; }; + +/* + * Structure used for returning kernel pll/PPS information + */ +struct info_kernel { + LONG offset; + LONG freq; + LONG maxerror; + LONG esterror; + u_short status; + u_short shift; + LONG constant; + LONG precision; + LONG tolerance; + +/* + * Variables used only if PPS signal discipline is implemented + */ + LONG ppsfreq; + LONG jitter; + LONG stabil; + LONG jitcnt; + LONG calcnt; + LONG errcnt; + LONG stbcnt; +}; diff --git a/usr.sbin/xntpd/include/ntp_timex.h b/usr.sbin/xntpd/include/ntp_timex.h index 43b6ae73ec7a..cb8396ac23fe 100644 --- a/usr.sbin/xntpd/include/ntp_timex.h +++ b/usr.sbin/xntpd/include/ntp_timex.h @@ -17,6 +17,10 @@ /* * Modification history timex.h * + * 19 Mar 94 David L. Mills + * Moved defines from kernel routines to header file and added new + * defines for PPS phase-lock loop. + * * 20 Feb 94 David L. Mills * Revised status codes and structures for external clock and PPS * signal discipline. @@ -24,7 +28,7 @@ * 28 Nov 93 David L. Mills * Adjusted parameters to improve stability and increase poll * interval. - * + * * 17 Sep 93 David L. Mills * Created file */ @@ -57,98 +61,213 @@ * struct timex *tptr pointer to timex structure * */ +#ifndef MSDOS /* Microsoft specific */ #include +#endif /* MSDOS */ /* - * The following defines establish the engineering parameters of the PLL - * model. The hz variable is defined in the kernel build environment. It + * The following defines establish the engineering parameters of the + * phase-lock loop (PLL) model used in the kernel implementation. These + * parameters have been carefully chosen by analysis for good stability + * and wide dynamic range. + * + * The hz variable is defined in the kernel build environment. It * establishes the timer interrupt frequency, 100 Hz for the SunOS * kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the OSF/1 - * kernel. The SHIFT_HZ define expresses the same value as the nearest - * power of two in order to avoid hardware multiply operations. + * kernel. SHIFT_HZ expresses the same value as the nearest power of two + * in order to avoid hardware multiply operations. + * + * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen + * for a slightly underdamped convergence characteristic. + * + * MAXTC establishes the maximum time constant of the PLL. With the + * SHIFT_KG and SHIFT_KF values given and a time constant range from + * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, + * respectively. */ #define SHIFT_HZ 7 /* log2(hz) */ - -/* - * The SHIFT_KG and SHIFT_KF defines establish the damping of the PLL - * and are chosen by analysis for a slightly underdamped convergence - * characteristic. The MAXTC define establishes the maximum time - * constant of the PLL. With the parameters given and the minimum time - * constant of zero, the PLL will converge in about 15 minutes. - */ #define SHIFT_KG 6 /* phase factor (shift) */ #define SHIFT_KF 16 /* frequency factor (shift) */ #define MAXTC 6 /* maximum time constant (shift) */ /* + * The following defines establish the scaling of the various variables + * used by the PLL. They are chosen to allow the greatest precision + * possible without overflow of a 32-bit word. + * * SHIFT_SCALE defines the scaling (shift) of the time_phase variable, * which serves as a an extension to the low-order bits of the system - * clock variable time.tv_usec. SHIFT_UPDATE defines the scaling (shift) - * of the time_offset variable, which represents the current time offset - * with respect to standard time. SHIFT_USEC defines the scaling (shift) - * of the time_freq and time_tolerance variables, which represent the - * current frequency offset and frequency tolerance. FINEUSEC is 1 us in - * SHIFT_UPDATE units of the time_phase variable. + * clock variable time.tv_usec. + * + * SHIFT_UPDATE defines the scaling (shift) of the time_offset variable, + * which represents the current time offset with respect to standard + * time. + * + * SHIFT_USEC defines the scaling (shift) of the time_freq and + * time_tolerance variables, which represent the current frequency + * offset and maximum frequency tolerance. + * + * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable. */ #define SHIFT_SCALE 23 /* phase scale (shift) */ #define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */ #define SHIFT_USEC 16 /* frequency offset scale (shift) */ -#define FINEUSEC (1 << SHIFT_SCALE) /* 1 us in phase units */ +#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */ /* - * Mode codes (timex.mode) + * The following defines establish the performance envelope of the PLL. + * They insure it operates within predefined limits, in order to satisfy + * correctness assertions. An excursion which exceeds these bounds is + * clamped to the bound and operation proceeds accordingly. In practice, + * this can occur only if something has failed or is operating out of + * tolerance, but otherwise the PLL continues to operate in a stable + * mode. + * + * MAXPHASE must be set greater than or equal to CLOCK.MAX (128 ms), as + * defined in the NTP specification. CLOCK.MAX establishes the maximum + * time offset allowed before the system time is reset, rather than + * incrementally adjusted. Here, the maximum offset is clamped to + * MAXPHASE only in order to prevent overflow errors due to defective + * protocol implementations. + * + * MAXFREQ is the maximum frequency tolerance of the CPU clock + * oscillator plus the maximum slew rate allowed by the protocol. It + * should be set to at least the frequency tolerance of the oscillator + * plus 100 ppm for vernier frequency adjustments. If the kernel + * PPS discipline code is configured (PPS_SYNC), the oscillator time and + * frequency are disciplined to an external source, presumably with + * negligible time and frequency error relative to UTC, and MAXFREQ can + * be reduced. + * + * MAXTIME is the maximum jitter tolerance of the PPS signal if the + * kernel PPS discipline code is configured (PPS_SYNC). + * + * MINSEC and MAXSEC define the lower and upper bounds on the interval + * between protocol updates. */ -#define ADJ_OFFSET 0x0001 /* time offset */ -#define ADJ_FREQUENCY 0x0002 /* frequency offset */ -#define ADJ_MAXERROR 0x0004 /* maximum time error */ -#define ADJ_ESTERROR 0x0008 /* estimated time error */ -#define ADJ_STATUS 0x0010 /* clock status */ -#define ADJ_TIMECONST 0x0020 /* pll time constant */ +#define MAXPHASE 128000L /* max phase error (us) */ +#ifdef PPS_SYNC +#define MAXFREQ (100L << SHIFT_USEC) /* max freq error (100 ppm) */ +#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ +#else +#define MAXFREQ (200L << SHIFT_USEC) /* max freq error (200 ppm) */ +#endif /* PPS_SYNC */ +#define MINSEC 16L /* min interval between updates (s) */ +#define MAXSEC 1200L /* max interval between updates (s) */ + +#ifdef PPS_SYNC +/* + * The following defines are used only if a pulse-per-second (PPS) + * signal is available and connected via a modem control lead, such as + * produced by the optional ppsclock feature incorporated in the Sun + * asynch driver. They establish the design parameters of the frequency- + * lock loop used to discipline the CPU clock oscillator to the PPS + * signal. + * + * PPS_AVG is the averaging factor for the frequency loop, as well as + * the time and frequency dispersion. + * + * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum + * calibration intervals, respectively, in seconds as a power of two. + * + * PPS_VALID is the maximum interval before the PPS signal is considered + * invalid and protocol updates used directly instead. + * + * MAXGLITCH is the maximum interval before a time offset of more than + * MAXTIME is believed. + */ +#define PPS_AVG 2 /* pps averaging constant (shift) */ +#define PPS_SHIFT 2 /* min interval duration (s) (shift) */ +#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ +#define PPS_VALID 120 /* pps signal watchdog max (s) */ +#define MAXGLITCH 30 /* pps signal glitch max (s) */ +#endif /* PPS_SYNC */ /* - * Clock command/status codes (timex.status) + * The following defines and structures define the user interface for + * the ntp_gettime() and ntp_adjtime() system calls. + * + * Control mode codes (timex.modes) */ -#define TIME_OK 0 /* clock synchronized */ -#define TIME_INS 1 /* insert leap second */ -#define TIME_DEL 2 /* delete leap second */ +#define MOD_OFFSET 0x0001 /* set time offset */ +#define MOD_FREQUENCY 0x0002 /* set frequency offset */ +#define MOD_MAXERROR 0x0004 /* set maximum time error */ +#define MOD_ESTERROR 0x0008 /* set estimated time error */ +#define MOD_STATUS 0x0010 /* set clock status bits */ +#define MOD_TIMECONST 0x0020 /* set pll time constant */ +#define MOD_CLKB 0x4000 /* set clock B */ +#define MOD_CLKA 0x8000 /* set clock A */ + +/* + * Status codes (timex.status) + */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ + +/* + * Clock states (time_state) + */ +#define TIME_OK 0 /* no leap second warning */ +#define TIME_INS 1 /* insert leap second warning */ +#define TIME_DEL 2 /* delete leap second warning */ #define TIME_OOP 3 /* leap second in progress */ -#define TIME_BAD 4 /* kernel clock not synchronized */ -#define TIME_ERR 5 /* external clock not synchronized */ +#define TIME_WAIT 4 /* leap second has occured */ +#define TIME_ERROR 5 /* clock not synchronized */ + /* - * NTP user interface - used to read kernel clock values + * NTP user interface (ntp_gettime()) - used to read kernel clock values + * * Note: maximum error = NTP synch distance = dispersion + delay / 2; * estimated error = NTP dispersion. */ struct ntptimeval { - struct timeval time; /* current time */ - long maxerror; /* maximum error (us) */ - long esterror; /* estimated error (us) */ + struct timeval time; /* current time (ro) */ + LONG maxerror; /* maximum error (us) (ro) */ + LONG esterror; /* estimated error (us) (ro) */ }; /* - * NTP daemon interface - used to discipline kernel clock oscillator + * NTP daemon interface - (ntp_adjtime()) used to discipline CPU clock + * oscillator */ struct timex { - int mode; /* mode selector */ - long offset; /* time offset (us) */ - long frequency; /* frequency offset (scaled ppm) */ - long maxerror; /* maximum error (us) */ - long esterror; /* estimated error (us) */ - int status; /* clock command/status */ - long time_constant; /* pll time constant */ - long precision; /* clock precision (us) (read only) */ - long tolerance; /* clock frequency tolerance (scaled - * ppm) (read only) */ + unsigned int modes; /* clock mode bits (wo) */ + LONG offset; /* time offset (us) (rw) */ + LONG freq; /* frequency offset (scaled ppm) (rw) */ + LONG maxerror; /* maximum error (us) (rw) */ + LONG esterror; /* estimated error (us) (rw) */ + int status; /* clock status bits (rw) */ + LONG constant; /* pll time constant (rw) */ + LONG precision; /* clock precision (us) (ro) */ + LONG tolerance; /* clock frequency tolerance (scaled + * ppm) (ro) */ /* * The following read-only structure members are implemented * only if the PPS signal discipline is configured in the * kernel. */ - long ybar; /* frequency estimate (scaled ppm) */ - long disp; /* dispersion estimate (scaled ppm) */ - int shift; /* interval duration (s) (shift) */ - long calcnt; /* calibration intervals */ - long jitcnt; /* jitter limit exceeded */ - long discnt; /* dispersion limit exceeded */ + LONG ppsfreq; /* pps frequency (scaled ppm) (ro) */ + LONG jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + LONG stabil; /* pps stability (scaled ppm) (ro) */ + LONG jitcnt; /* jitter limit exceeded (ro) */ + LONG calcnt; /* calibration intervals (ro) */ + LONG errcnt; /* calibration errors (ro) */ + LONG stbcnt; /* stability limit exceeded (ro) */ }; diff --git a/usr.sbin/xntpd/include/ntpd.h b/usr.sbin/xntpd/include/ntpd.h index 590aaae08abb..037e8cb366f4 100644 --- a/usr.sbin/xntpd/include/ntpd.h +++ b/usr.sbin/xntpd/include/ntpd.h @@ -63,6 +63,9 @@ 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_LONG)); +extern void io_multicast_del P((U_LONG)); + extern void sendpkt P((struct sockaddr_in *, struct interface *, struct pkt *, int)); #ifdef HAVE_SIGNALED_IO extern void wait_for_signal P((void)); @@ -102,10 +105,10 @@ extern void init_peer P((void)); extern struct peer *findexistingpeer P((struct sockaddr_in *, struct peer *)); extern struct peer *findpeer P((struct sockaddr_in *, struct interface *)); extern struct peer *findpeerbyassoc P((int)); -extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, U_LONG)); +extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, int, U_LONG)); 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, U_LONG, int)); +extern struct peer *peer_config P((struct sockaddr_in *, struct interface *, int, int, int, int, int, int, U_LONG)); extern void peer_reset P((struct peer *)); extern int peer_unconfig P((struct sockaddr_in *, struct interface *)); extern void unpeer P((struct peer *)); @@ -131,7 +134,7 @@ extern void clock_select P((void)); extern void clock_combine P((struct peer **, int)); extern void fast_xmit P((struct recvbuf *, int, int)); extern void init_proto P((void)); -extern void proto_config P((int, LONG)); +extern void proto_config P((int, U_LONG)); extern void proto_clr_stats P((void)); #ifdef REFCLOCK diff --git a/usr.sbin/xntpd/kernel/tty_chu_STREAMS.c b/usr.sbin/xntpd/kernel/tty_chu_STREAMS.c index 68661457156c..f46e25d2ab51 100644 --- a/usr.sbin/xntpd/kernel/tty_chu_STREAMS.c +++ b/usr.sbin/xntpd/kernel/tty_chu_STREAMS.c @@ -1,7 +1,7 @@ /* * CHU STREAMS module for SunOS * - * Version 2.3 + * Version 2.6 * * Copyright 1991-1994, Nick Sayer * @@ -44,9 +44,22 @@ * * The OS will load it for you automagically when it is first pushed. * + * If you get syntax errors from (really references + * to types that weren't typedef'd in gcc's version of types.h), + * add -D_SYS_TIMER_H to blot out the miscreants. + * + * Under Solaris 2.2 and previous, do not attempt to modunload the + * module unless you're SURE it's not in use. I haven't tried it, but + * I've been told it won't do the right thing. Under Solaris 2.3 (and + * presumably future revs) an attempt to unload the module when it's in + * use will properly refuse with a "busy" message. + * * * HISTORY: * + * v2.6 - Mutexed the per-instance chucode just to be safe. + * v2.5 - Fixed show-stopper bug in Solaris 2.x - qprocson(). + * v2.4 - Added dynamic allocation support for Solaris 2.x. * v2.3 - Added support for Solaris 2.x. * v2.2 - Added SERVICE IMMEDIATE hack. * v2.1 - Added 'sixth byte' heuristics. @@ -58,9 +71,9 @@ #ifdef SOLARIS2 # ifndef NCHU -# define NCHU 3 -# define _KERNEL -# endif +# define NCHU 1 +# endif +# define _KERNEL #elif defined(LOADABLE) # ifndef NCHU # define NCHU 3 @@ -92,6 +105,9 @@ #ifdef SOLARIS2 +#include +#include +#include #include #include #include @@ -129,9 +145,17 @@ struct streamtab chuinfo = { &rinit, &winit, NULL, NULL }; */ struct priv_data { +#ifdef SOLARIS2 + kmutex_t chucode_mutex; +#else char in_use; +#endif struct chucode chu_struct; -} our_priv_data[NCHU]; +}; + +#ifndef SOLARIS2 +struct priv_data our_priv_data[NCHU]; +#endif #ifdef SOLARIS2 @@ -139,7 +163,7 @@ static struct fmodsw fsw = { "chu", &chuinfo, - D_NEW + D_NEW | D_MP }; extern struct mod_ops mod_strmodops; @@ -147,7 +171,7 @@ extern struct mod_ops mod_strmodops; static struct modlstrmod modlstrmod = { &mod_strmodops, - "CHU timecode decoder v2.3", + "CHU timecode decoder v2.6", &fsw }; @@ -160,11 +184,6 @@ static struct modlinkage modlinkage = int _init() { - int i; - - for (i=0; iq_ptr = kmem_alloc( sizeof(struct priv_data), KM_SLEEP ); + ((struct priv_data *) q->q_ptr)->chu_struct.ncodechars = 0; + + mutex_init(&((struct priv_data *) q->q_ptr)->chucode_mutex,"Chucode Mutex",MUTEX_DRIVER,NULL); + qprocson(q); + + if (!putnextctl1(WR(q), M_CTL, MC_SERVICEIMM)) + { + qprocsoff(q); + mutex_destroy(&((struct priv_data *)q->q_ptr)->chucode_mutex); + kmem_free(q->q_ptr, sizeof(struct chucode) ); + return (EFAULT); + } + + return 0; + +#else for(i=0;iq_next, M_CTL, MC_SERVICEIMM)) { our_priv_data[i].in_use=0; -#ifdef SOLARIS2 - return (EFAULT); -#else u.u_error = EFAULT; return (OPENFAIL); -#endif } return 0; } -#ifdef SOLARIS2 - return (EBUSY); -#else u.u_error = EBUSY; return (OPENFAIL); #endif @@ -323,8 +346,13 @@ static int chuclose(q, flag) queue_t *q; int flag; { +#ifdef SOLARIS2 + qprocsoff(q); + mutex_destroy(&((struct priv_data *)q->q_ptr)->chucode_mutex); + kmem_free(q->q_ptr, sizeof(struct chucode) ); +#else ((struct priv_data *) (q->q_ptr))->in_use=0; - +#endif return (0); } @@ -397,8 +425,7 @@ queue_t *q; if (mp==NULL) { #ifdef SOLARIS2 - /* XXX we can't log it because strlog() is too complicated. This isn't - supposed to happen anyway. The hell with it. */ + cmn_err(CE_WARN,"chu module couldn't allocate message block"); #else log(LOG_ERR,"chu: cannot allocate message"); #endif @@ -435,6 +462,10 @@ queue_t *q; */ uniqtime(&tv); +#ifdef SOLARIS2 + mutex_enter(&((struct priv_data *)q->q_ptr)->chucode_mutex); +#endif + /* * Now, locate the chu struct once so we don't have to do it * over and over. @@ -540,6 +571,9 @@ queue_t *q; if (chuc->codechars[i] != chuc->codechars[i+(NCHUCHARS/2)]) { chuc->ncodechars = 0; +#ifdef SOLARIS2 + mutex_exit(&((struct priv_data *)q->q_ptr)->chucode_mutex); +#endif return; } } @@ -551,6 +585,9 @@ queue_t *q; != 0xff ) { chuc->ncodechars = 0; +#ifdef SOLARIS2 + mutex_exit(&((struct priv_data *)q->q_ptr)->chucode_mutex); +#endif return; } } @@ -558,6 +595,9 @@ queue_t *q; passback(chuc,q); /* We're done! */ chuc->ncodechars = 0; /* Start all over again! */ } +#ifdef SOLARIS2 + mutex_exit(&((struct priv_data *)q->q_ptr)->chucode_mutex); +#endif } #endif /* NCHU > 0 */ diff --git a/usr.sbin/xntpd/lib/numtohost.c b/usr.sbin/xntpd/lib/numtohost.c index e22b6231790a..2f07c2c4dac5 100644 --- a/usr.sbin/xntpd/lib/numtohost.c +++ b/usr.sbin/xntpd/lib/numtohost.c @@ -1,12 +1,11 @@ -/* numtohost.c,v 3.1 1993/07/06 01:08:40 jbj Exp +/* * numtohost - convert network number to host name. */ -#include "ntp_types.h" #include #include "ntp_fp.h" -#include "lib_strbuf.h" #include "ntp_stdlib.h" +#include "lib_strbuf.h" #define LOOPBACKNET 0x7f000000 #define LOOPBACKHOST 0x7f000001 diff --git a/usr.sbin/xntpd/machines/univel b/usr.sbin/xntpd/machines/univel new file mode 100644 index 000000000000..23d683a661aa --- /dev/null +++ b/usr.sbin/xntpd/machines/univel @@ -0,0 +1,10 @@ +SHELL= /bin/sh +RANLIB= ls # ar does the work of ranlib under System V +DEFS= -DSYS_UNIVEL -DSTREAMS_TLI -DHAVE_TERMIOS +AUTHDEFS= -DDES -DMD5 +CLOCKDEFS= +DAEMONLIBS= -lnsl -lsocket -lelf +RESLIB= -lnsl -lsocket -lelf +INSTALL=$(TOP)scripts/install.sh +SHELL= /bin/sh +RANLIB= ls # ar does the work of ranlib under System V diff --git a/usr.sbin/xntpd/machines/unixware1 b/usr.sbin/xntpd/machines/unixware1 new file mode 100644 index 000000000000..770737676d86 --- /dev/null +++ b/usr.sbin/xntpd/machines/unixware1 @@ -0,0 +1,10 @@ +SHELL= /bin/sh +RANLIB= ls # ar does the work of ranlib under System V +DEFS= -DSYS_UNIXWARE1 -DSTREAMS_TLI -DHAVE_TERMIOS -DCONFIG_FILE=\\"/usr/local/etc/ntp.conf\\" +AUTHDEFS= -DDES -DMD5 +CLOCKDEFS= +DAEMONLIBS= -lnsl -lsocket -lelf +RESLIB= -lnsl -lsocket -lelf +INSTALL=$(TOP)scripts/install.sh +SHELL= /bin/sh +RANLIB= ls # ar does the work of ranlib under System V diff --git a/usr.sbin/xntpd/ntpdate/ntpdate.h b/usr.sbin/xntpd/ntpdate/ntpdate.h index 4a8ff746e772..f6d3ebf877f3 100644 --- a/usr.sbin/xntpd/ntpdate/ntpdate.h +++ b/usr.sbin/xntpd/ntpdate/ntpdate.h @@ -54,7 +54,11 @@ struct server { * are close, or step the time if the times are farther apart. The * following defines what is "close". */ +#ifdef linux +#define NTPDATE_THRESHOLD (FP_SECOND / 8) /* 1/8 second */ +#else #define NTPDATE_THRESHOLD (FP_SECOND >> 1) /* 1/2 second */ +#endif /* * When doing adjustments, ntpdate actually overadjusts (currently diff --git a/usr.sbin/xntpd/parse/parse.c b/usr.sbin/xntpd/parse/parse.c index dd70f1d85698..84bfa39d1293 100644 --- a/usr.sbin/xntpd/parse/parse.c +++ b/usr.sbin/xntpd/parse/parse.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp * - * parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp * * Parser module for reference clock * @@ -29,6 +29,10 @@ static char rcsid[] = "parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp"; #include "sys/time.h" #include "sys/errno.h" +#include "ntp_fp.h" +#include "ntp_unixtime.h" +#include "ntp_calendar.h" + #include "ntp_machine.h" #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM) @@ -49,10 +53,6 @@ static char rcsid[] = "parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp"; #endif #endif -#include "ntp_fp.h" -#include "ntp_unixtime.h" -#include "ntp_calendar.h" - #include "parse.h" #include "ntp_stdlib.h" @@ -178,6 +178,10 @@ setup_bitmaps(parseio, low, high) { fmt = clockformats[i]; + if (!(parseio->parse_flags & PARSE_FIXED_FMT) && + (fmt->flags & CVT_FIXEDONLY)) + continue; + if (fmt->flags & F_START) { index = fmt->startsym / 8; @@ -1158,6 +1162,9 @@ parse_setcs(dct, parse) * History: * * parse.c,v + * Revision 3.23 1994/03/25 13:09:02 kardel + * considering FIXEDONLY entries only in FIXEDONLY mode + * * Revision 3.22 1994/02/25 12:34:49 kardel * allow for converter generated utc times * diff --git a/usr.sbin/xntpd/patches/patch.1 b/usr.sbin/xntpd/patches/patch.1 new file mode 100644 index 000000000000..a6089ffd321c --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.1 @@ -0,0 +1,790 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa12064; 26 Jan 94 16:33 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa12284; + 26 Jan 94 16:26 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA16418 (5.65c-6/7.3v-FAU); Wed, 26 Jan 1994 22:26:48 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA29418 (5.65c-6/7.3m-FAU); Wed, 26 Jan 1994 22:26:45 +0100 +From: Frank Kardel +Message-Id: <199401262126.AA29418@faui43.informatik.uni-erlangen.de> +Subject: Re: Solaribum +To: Mills@udel.edu +Date: Wed, 26 Jan 94 22:26:38 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, Piete.Brooks@cl.cam.ac.uk, + Paul_Vixie@corpmis.sjc.hw.sony.com +In-Reply-To: <9401261207.aa10860@huey.udel.edu>; from "Mills@udel.edu" at Jan 26, 94 12:07 pm +X-Mailer: ELM [version 2.3 PL11] + + +> Frank, + +> Your command-line weenie sounds rather useful, especially in cases where +> 1-pps signals, kernel mods, etc., are involved. Better be quick about +> patches, though. Paul Vixie is burning rubber on changes. + +> Dave + +Ok, you overan me with 3.3c - thus the following patches will be +relative to 3.3c around Jan 26th 11:something. + +The patches include additional sys and refclock variables, the +adjtime fix from Lewis, doc fixes and a include botch fix for +lib/numtohost.c. + +For examples how to add extra refclock variables see refclock_parse.c +(as usual 8-). The variable mechanism is documented in doc/xntpd.8. + +Ok, here it goes... + +begin 644 patches-fau.Z +M'YV09-*8,0.BQ1@05)X0>:(CA@N'#F<@5,APAHL:"E1HG+BPX<./,Q)<*4,& +MA)(P;D#(L*$RA@X:-E[> !$C1PX:"EKHY/A$)$F3*%6RE.$2YDL<-&WBU,BT +MJ5,5&3?&8%$#1%,%($",4!!"*T\6=D!8I)'TY@L8,5[(D!CC1L,<.F"P7!-& +M#IDR;$ 4P0,'JU:_5-"DF0/"3!HV94",>>.&3I@T;@C#D?-&#.(VA->X>7,G +M)9TW(.B@21RFCN@W<@B+#D,'Q!PZA_.Z*?/S,P@QB>O%U'V""$688 +M8M(U]EAD($Q6V669;=99>>N19AH:J*F&!FNNP<:&;+259!MN(.@V6V]9_1;< +M<,4=)T=RR]'1G'?1+89C==>YIAUW0((G'GFVG9?>>NV]IT! Q5TD&YCO(!' +M8W"0X0(.'D'T4 PQOI'EEG1T^:4.%A$5E0IEGLFEEV"*"5$,/I5T4DHKM233 +M@63]AU-]<6HYYY=Y L7G4$6YA6!92STE*51,@7 ##2SK(.#@5QAD% ="K0"[44<;N(5GFVB)T1'K +MK"6A# (;@[7::Q(?MQ"6R+F2;/(<>:&86> )S%CA6T,PF @[,B&Q';@!; 9.R;FL!QML.9" +M5D-HMUUC<[ G&!CH %"YP#CEJZZ&KT) @TWL4#[IO/N5 ,,F-8P UGY0@CY +M8FUT[D9)D%>6'6(^!GP\")NU%D:QATU+(63K05YY:FDPWEVY:*J9*A10,+OJ +M'&70D32T2$M+[&PKXN,.AIG,#3,D< +MZI"Z@)F(-&,8 \' +MRI5P+(U>\N3)/)225)JIACZ\(W#,6, [A*%H0-Q>&N[B/( E +MDF,Q*H-A9D.&.BXG1.Q#G_KJ$JSMI XE@VE#;WIUOUP-,I1%$DWFJL,C1+I/ +MD>M!D>$<@[T>'A&:02Q@7IX)Q!WFJH=S" -YSM >. @RB_ [X!>2]H6M=9%$ +MQ'DA] 2*3X+HF(Y36/L%UA&-H=)$U?&5#W9.D5T,8)"#& +M8R8GAL,($&!!)-\4'GG"Q<$U661[%5O+( .N%*8.9#B#YL)@L(?-@41W$"*5 +MC+JCI"8&-W2X@X^0*D2]+@D[CFG#Q_A'U.24 0XI-.Q@*R;:?@J1D#K.E,)KM9G;D +M)0@!5EBO,L/DS@ #OR!U@82!3"5;,R'>3NRV_UL=29:3DO*"=)BBJ1!L5":< +M10H4#CASPQDXZBF:Q$ &.#BKNPI"JK6.AS=^><)? T8]NMJ5#G@EB&R-0/3L'Z180O1FJRV[?"SE9U4&? (.!"T%@9"2K=L=0V&N/:4M"R.$& +M9V6H'/(\@*UM.58678L+,AB2;=P,DSNB9]IU-Q7/-,0A[[."^0 +M"_,Q&^;8(QDV8MEQ@UL'62[MAH&[WAVA,,5KFL:)#:3G;2#D!+:=@ 3%O>$I +M8WSG"9DZU-$$I1QN7&O+"FSJ0Z^%- +M2;A:[%7!#6G 0V'Z2H=YXYDQ)3%,O*/X9"29(;FVJ0(5A@ "%%2X-4A 0A.: +M$$A=C@$\E:5#HT&#2W +MW:'V\.3; R5W4"O)%0',Y5L.LFX;X\#!$%J7(#YR7E:;[2B" *DVQ>1/L(>2 +M,U!(#+K%:?H(PP,0^.!S00!!'*0N$(Q96,?)ZLI=LNVB+E?]XE9WV(HX,S$A +M4OT-=YGWY%Z3(7@K-8@4)K@(#9MOH+YA>Q>-E1L KM_/>KF'C/UX&X9CRL]* +M\97F9NK5*]>8BOEH#FYU051!\&\!7CVI@)]8M>G5K@#'H"TR(+!]G)VF.$#[ +MP%6G-MGNUY5K>_NWXL:I1J%Y[NY4>])]!GVI /?>QD/QU?.^54' +MAC5T4;..TR\,EO$2W??4NZQKU?6P.P^'=,0G7G&\9WSC@;0V4#^>9J2*7+AY +M9G*FA7+AH7(LAT9< QGA]RKCQU1?X&)T("M/5W.&5'2% 6X1&$H&N&= !73O +M521O0'0$9'2WE("])&1,QS%.IW\P%('\9G> UQR$@70EM(#8%H,3J'9L9V=O +M1Q!PE!PQ6'?D<7<$EW=3Q'>5IX"%QH#21'XY=7%/=VV#UQIP8'A(TGV1Q#B- +MQQW1EQ>21WD4LUJDA7DQM#*#Y6*BE7JKUWJM@76QIU_5-EE64D(VA5AE\ )<\@7S1!FVA09A\A%5 +M 1G'>!?*F";,R!@R4T,N (T680.R0XU-9(W+V(S<"(UV(UPD(V-X8S=N(Y!T2=$<10Z$(]*46SJ(E8V8%9MD5:=DA4C\#5R +ME@!#, 5?, 59, 544 1-D !M<1\..1L0*9%+4 19D 1$H)$BPY =608?^052 +M4 1&, 4A>04:F0.&U9#2]) 1^0564 2MJ#<)( /=E14UF9(KV01!@ 5IHRTK +MN9,].2Y^X19,> +MF9,4:9$8J9$WP)%HJ9(Y&9(C69(Q<)):090YV9(O&9,S.91Q"0(Y:05!( 5, +MD 06^9-!"0* .6)%>91)601+69B':9%/F151Z1=4:97O%5/ L3!<66_\0Y"3 +M(CM B2E$D7MJE9=Q"9%0,)%%X 14D ), .%=9:..02O23<7*052\ 124)LS +M )>YN9M,$ 374ILXD1]Z^9I$@)A00)LS@!',V9JZ^05&B90*(9G7^9Q34#Y" +MB9E2F15P,@2BYYE:60>AZ975-)4J\ +]=9HL0!0289:L69RP*9O2>9OWB9.[ +MF01,T)N_&9PS,)RXZ9]?8 3'F9R_TYAR)IBO29B&B9BS.9U/F2LVB9_9&9FN +MJ9.42:'! I7C297F.6Y8^9E;&8OLJ9GO29J28IHR( /S*0.XLY#]F99#D*!5 +M0 1'4 2$R00RH)&+F:$XF:,*&@1', 4:&0/$6:1?H"U6D 1#()G_]935F9LY +MNJ';"9$Y"J526@27"0*9Z9[9@I8AY#T^"%0;Q$(9N##HLV6\55N-9AO8)S/& +M@85^U1N$$J-FM19E66 W*I=&NJ,]^J-!.E9-BJ,)>IQ)NJ2)*JA/ZJ-?JI&% +MA:$I*9@Y*J&5.9LQ8*",>:5.JJ5*.029^J&6&9YB.J)P0@1F&HAPER*Q8C [ +MQV1O6D)QBF0@4J>Z]3&)!X@BU!O$:!#&.([)N(P34@:*)6KH^!$1,:SU:*P; +MDZS=R"8N\):50H_DB(W'*JW+*B8A,1)ZTH^, I Q"BGSF%3$:H]?L*U(M8_@ +MJBCM^(_O&)"Y)X]@M2Y2017,-IZ9V154":V(P:U@(18NP!+_,0-GD0-G02;_ +M6 ,N(0-DH2!AUB!]X9XL*F*0<:88LCD@()M0X&J)D:SMED*+5 ?'@1IC0YY@ +MJ:_VV:_D"3W:&JWMB@8#:Q$S(2@+*R!)$1 +M"[(@(+*Z1;*N8;*7) ",2/=^A&;DK7JRK5R-JT. +M ;'AB*[/NK6,U;6\\;4.D0/\N"CN"(\W.Y"$(K;+2+9>.[?Q6A1V:Z[WVBGL +MLA;P\CO[&J99@01!L)-?4 5.0*%$\ 78,I4% 0)-<$PP0F9# B.YY48$X;%? +M 5/, 5)@ 43^01N,Z4@\ -AF@5!4F8@H :R0H6M]H,CMFA"I"TO>4NS44*K +MT[9R-@R*58SK9P22PI!A!H1L90ADOH[U]1UJMU)7QU!JT +M%#U M& !509',[X"K+Q+"VD"\TV1$3.@D5G+1 84TKY7V$.&@SB*$XBY)5!K +MQ%O_P[_=NS&_1QYBL$8_P3C$@U\@]0)\:V[:45B 3E9 +M"[)/-P6T42&5@P>F\Q@"1UHKE!(5/%L7+$+KEAB0)1VBA1@"YWJ*57!AVJ*6 +M"Y:&VZE(89^:"0*,Z[B0*[F4:[F7F[EYL+DDTKF)\;FN);JD:[JH.P6J*P6L +MZ[I"F2N\FP21&S=[,S? "0)K>9%- (F8 )5^9M3.@5R+ 7!DA46*04369&" +M3,93^2E,Y$2N1ZVT.\NU?YU1PIL<+$:[QS@+P;8\#,Z[S4&#.N1!K3 +M2WA!9(HA%QK:RWP?_+W[.S6:7+[GF[[34P;L>R393$ME,K^CU,#V6WGX&[TF +M(D\HX;^, U!A(, 85I"@*M: ,P$-A8 +M'::9Z=.4(A4VD-1DF;CT<@,(B0-_NGM:W9)48+I'0 59 62:0=OL$R/F@"B +MNY9#$ 1,P 1?T*.<:IN?'=H5.=JE_05!0 1*H)$T\)886M9?X\F0_-9K;:F! +MZ=:2#-[JIN[I@"MZ)P=6P3054 )M4 5'( 7@&:A>W+A=#3?M'=9@ +M>MMF8-:ZG=:"S-:__#2?;'&[0;(70,/ +M 43A4>$7[@*Y]S!34$/&0A@RD.$@+N)*0^(>[J)/(58Y$&! *1':3113012; +M8I]$^KOJC=_N#=_R_:CU[;@\KM] OJ.O>04 2@2C+063JRV'R919,-:X+4W_ +MS=L"/F)5'MR#/-P)7MPH#CDEOMQC[=P._M2H6M@^#:,U+@-%W2E[.@,W,)\P +MH7O?3=_B#4/:NB3S.6G^P*A@](Q +M5[H-'N%/C=<2?N:J"@))X"U8D-R=3EJ;?KH@@.%XP.)A52EK40-RKF0S7@.H +M:0.YA^.7VN?M/05%\-Z #N3J7=632^3HW;'O/;KC'<=S+-:$GMN*CI&(_KO) +MON7$'>I8P-R";N:4'MV8;NKX"B<0&^OV[=6]_J6? +M3=F6C=F:G0"<[=GH#=K!+MJDS002:9%$(.7]C>P$;N6^C>7-'M==7@5BHS1B +M7N;1;>G4+J(7&P15@ 783K@;P>;/I?>Z\_@7L +M79% S@1/< 1@_=X@H/(LK_*NS:2_KMZ6[02D7023*R[\7NC_KN7+GA@#S^AS +M#?'1/N:77NUZS9CB.?$_7?$XT*M?[>M\?NY. +M\+CDPI#JF=MW3MYR;-X][^^[#?0!G^@_K]8$W^A.$'-T,.G3OO!*/^%DB@10 +M$/%./]UB@199+Q??_BD%*J._L_5,C1?65_/GWI*QO01-H.P*#^%DW>]4WNQ! +MG^5T3_0O /@1+^UDWO?7;MBR<_53K!C_I]/757_,[:\NMM]&WH$3?UTIVQTPI3 +MS@"^O4.7_(3> :Q[X-)S>&1*6Z2-*6 $F)3VVPB_(]E,IPSH +MYJQ>#I!1[L+QA;Q+Y?ORG%B;=ZR-6]R[?$<%]MV\:X%@C0#"0,XG PL< I1^ +M"K#+"<'2502A'[7;>S^PZ1U!.#&=+F#X^W[N E/0@$Y%YW3=Y"L"E>_R#3(@ +M)Y&& .."9'G,">@\"<@"2=X ?(&;S^?-0.27 &^@Z$L"%M &\,!!%P&!X,MJ +M FD #G2,.0C^[ 6<4TA5[U/L055' ]9"'V1(SB$ED0$4L):PT[>8 BD R#F! +M)T "!V$ 1'=A$!+&0-!'"=&@)21NH% 4ND$(" GAA\MPZ35#5$4!*\4>!(BN4+O5-E:( Y;:% Q,NW BL0U%.+D, +M86&*5$. "3!"<^>X1& O](/"[Q'NMS$H"==A2FR'G9-^0?'FZ;PO8!0181%(BDO1]C5%0#@" +M!6%>!(&.T 5.Q71H$JUB)3R)SJ[+C<68B/T@H(AB3/Z0!K#"1[&:I)_,6P*C +M2Y0I,D)8D:R R4L"E^\)& $B$ 2BW*\S75J@JU$VMT$4OX >HVI5P @8 9Y4 +MDYQ;5ZA) L'M <*,1)NBDF[;C8_CB<$;PM";FH"XV"LM*C\,0_56'(^C@])Q +MYZXYEJ[&*!-/7W_9'D5Q,W DS0 +M@S9@&E[';D<59L"-JWU8+@NZ-GPWD;I@D;-UWS$AN+MM4>2(P)%+3HEP!O(_L\!BJP2=@E/28I$-Z^+ 9PC+^IAN# &], +[QD0''\8!?AB-" +MX$G&$;FUJ!/)'(&DF+BR@H)0.4Y@2-P6!)+EBD@,F D +M@H $ !*_27C@/R$' LD*24DIF=&)" ]3B-TTAHO8%3JEI=Q*%V0+Q( N("G[ +M@*3,"6 QTTD!:7**E$H;2@(OX G *C:UR]K5E(6K!-Z3!2NU)7^LDWYRBH +M+$&#L"26SL-6@91D>5G21XIQ \VR SU+BIE\U,.TW![54HA\B,]R8LYED@!V1-2B U] 5-*!T#DZCR7[DAELRJ6\ +M%Q7@.E]EKO":V,@,HJ#?0P[%1DF!R!R#$(DV7)68ZE +MY20AFJR1P8EM ]U6V>7!>P,'$#V5P98K2J?!8 ,")YPP@ALE_;11#B&^(1/-1 B!8&Q)P(3 +M S V@AZ$G0L7<%O,5%LJ 8M%(QII3(NVC3!05*&A0*Q+;GM"A-*!YP%QJT +M"#P!*^!"<4!WF9&3K2>@@-%&0?EB+HR@5T"'\M OT$&3P$7ZH9--)NW0" +M8QL?&*)%](B&J%P1._U,X5B7<")@E R!*3I)I_3D7P$S:7 *T]$0.6))\(AG +M@'4VAN(9+*IH2D :F=-R80[:H%.>3Q=UGV$T7Q+/U]E&*Z<5A:/+Q')I$RXZ +M.O$H_!2C&L%T % RNA%I2T=$?VJ4#K!1*NI'WVB\*PE3:9 J%#':11?I5G*( +MCU2_1-))&BMAUCTZEE3%!3#/K.9&9Z?F7$:HE&/P3A1P2=FH4 I6!T%LY1;T +M\28_ DO0I76!EWJCAS"EM*L +M6VPBFMZ$ @DGID+&XU=0P5_!B14! Y;*H$CDUIR\ G:K3\<9.W2D\?0'R]&T=5+9P3P-$M]M9O",@ +MD0F)!5 =A,42ITIGGH9-/HBSO.J X%EBU9\NB(AJ5HG6RZJH%[6;51R.ZE&3 +MS7\0J3:!I-H$DUI60.HV5:DL%02XU+D*4^'-M*2I-C7FX-3PH%.[$D^%-#\U +MJ"8KHFI4W0!2Y:8T0=4MF\HX#/F?"FU%70T)\#\@9UH+$X94K5_@/@B$!! " +M4$ WS"^2% 3P 3Z L:@)"N!_1\ )5($<]05,L8RV0)= +MH >(@((*-@D60FVK:2&?,E1^^E 9J]":&Q!/!$C*KRA;U>396$:%$_6@@;Y! +M+T2K=Y.M]K&UHE;*M5I_G7Q]K?5U#-)6VQJ79B%N[:B[M;>2A-]ZVH0K<36N +M_@JY'H13R5S-:8\A ]!5NE+7K9I0W2I8[5G+AJS2U8]A!,+K>+6.L-"\B@#T +M:C>[4=]XAC9 ]AW$[S<#4FS6RS� +M,Q:!#U;8[%H5+FQK%FY;#D:-8U]PQ9 +MM2 1:,)V=:A90<->+$%A.J%L]4@M%@N7_DQDBH_,0"]U"-,H3[+9"F8F+T+: +M@IISEC&XV9Y9 ZYIU603=VN;/LUC&DS+0)N5FO#J3S+-0!LIJ!N[R!2'<@*B +MU:=Z3M];.BT"ZQ0X6=5X*F<+[:&MKF-ARVK7?9HVD6Q9'5I4"ZWFV<-A4,-F +MH.BJ3=;+DEH8,!,T[-O$L20J!.75C+I7.^K!,JPX ;&BA);Z4E>J8YVI:*"F +MWM30Q'H SDYU#)@5J':=H5I4+>=GI1>0MF6%TY=%::.JI9VJIJNJOE-.BV<] +M+9T%M1=!U+[5L.H*;:U$55FJUMSJV59+L 8$D]59-0&NMMN7^FZI%D75M1@5 +M??7:LH!2#^O+6JG#5K$6VYCZ6)-M9,4#D[794LO+ZE.EK5!U YS5VH*4I$H* +MA]I\0H7C"4J"@/O:U=*&$S "]#6VVM?1Y5I+KMI(N?!UO][6UJE;>6LW!*X& +MEO\AV$R*AY+KJ20#8\ ,--<'&V&GJ[QEM>CVU=[;4=M0::VIW;#@M0J(5R=Y +M[=KKQXVQ(I?DTL67"UM9*\N=KR87Y7;=;2AS^RL*^*\U5\#.0IP[7'5N+DRP +M$,CGKDN@*W0=['.-KD:WFGY:>FIO:0 ^7;<85B*X6[X0=:HL%XJZGC%2CJE5K=GCN;KA8O,KV\D+=G,M,^*:ZP*0U0 +MNH-BFN9)S]MX9<;C5:]^EDZ>7L'%.&D"I%U-376 +MROMY72_FI;=!5LE@5RXK:QLJ0AV\J';;$M36&S%"[T%5OK"6^>I3YYM[H*] +M_;<6->!J5+Y:$S[J7S6L@O4)&M:"&VP/;F)=K!/+V,I4C.%PEVTLDKC/MJ?J +M!8N[6:OM4=VX2C7&YEXQM7N];>\%MT94TP;?R4N\BF_U5:\'E4PLWZ^:;\.J +MQWNZMQ;>YECJ^WJ1[YA0MT;V GM?7%N> *Y>W:B^]L7YU9"*?@TK866_%POA +MN@%BRUCE;\-5MI*5V596[@%M*ZYFI;:=];-V7)0::15GS*VM,W>-IMV;6V#; +M;G%]NSQ78BS8Y5IH,=[0O;L2E@,?7W0[5D3M0B6USY??\@7#FP^UPMFC1YNOONF#R \$&*I*54Q+517P517& +MQ+@6\P9]L*R%,S) +ML!.A@D5 0/&D'J 8QL#*VHY,K29%8][K>ZLQ\+W&IW@8T^)0_,3HJ3;U +MNQ:V C?B[AJTZJHY]@K(-'*HXP>U&CR8&J-56\3C +MNB$%^'$,R<3%"&>( 7):-0Z,*B7%75@FTV1)Q!O&@$>P5AM!)X\OF^R3T]%8 +M0<:[(RY@7T&[$X1R36XK8P IPP"EO(SOE6FR@/,)QE;&TY< ^L!3^A0)0*'8 +M(?BC35P _*P#:0 $\&.RG#Z^0!JXB&!9+#L@MEQPSC)!6,L#89": ;@L 1. +M%^!)4L!T +MH V4T+S*F1@B [9,%/L?'0 "2D ;$ %\%#(W$A+"CV$ O^S*5X<-1+Y)63N9 +MB%JF":]R&^8V;1$?X]L4 &R![5X>D,E9?9-FCG_/:"G7 900 F8 RF +M--/EV_R -^0 MP"8TYB(%FTY$# +M4@#KG .SX0S\ !'0 D2 #A !V7D[6ZZ5\9T_0QA 739+9N. &T&V#,;+97# +M^0U09LN,F35S"2@)#[HT0V@R<)VS<\6AN87Y%A=,/*.=2V4"0 $8&C2K#PW] +M!1C&&# =(%H))V81;0=(-(>^T&MT.Z]H_=>BU4>)QC.I6>GU-=Y[-4_F4 G:%M-)ZA?ZTY[<[H$6VC3322!@&-F9 9,A30.?# %]@,V>B)I8_$ +M $4:LV/>SG. "E@!#3D%!O.2-LR$;$E#Y]><*&$;$2 "@UDN>R*Z?)C5-!_U +MT EZ01OG*U"8(M>BU,QST\?^FL\K[F1RO'H +M(["=__)=Z" 4 XK0 "A,FR+S'"#.EGE2=VC:S)VGD@@(U,/RUP3F[8 ".BHU +MHFA;VG10E64B=:CS'*C0H[I36R[UX9_-M&+.T+ +M!C.:RWDY?9CE$IV6\7+\P9UO&4Q[[+$1DKRM.69M9,VY^DI&: +M($SJOQ;8NDO'_M0*^ED?Y\Q\-I3S4&;5SSDZQ^SDPH^K\ZW&SM4Z 7AG\/R? +M 3-H)L_F&3V[9RVJ!@ST>X[/\[D^W^?\[*$IY=3NU0$Z#0SHEKVN#/2=ILT& +MVS@WZ+,1H>OVA,;5,#JW%ND-G1RB=HK6VRR:1)MH%$USS[2+[MMYFU/3)L/= +MI''TAWUP.[H(]&:>+=CDL+ F"$0Z$J!4U0TO6CAI8Y^QL(;E[=.SV +MRYC[4KN'X+VIOW?Q#MJANGM3:_-MN9JWH(;>_+I5&Z-R#93 +M#;!NWX^)<[LG3OLD6^U$5FGD4F+1,0 '..6.. -97+GJ43?0Q4LX%D]H8CP\ +MJ N[M3\IU\N/6MGE/R$BYTN_7 :?W];(#MIJMC$*NMXS_W#KJR!YO&C]*/J +MAA/HXT)IB<.Z/G606)V-2@!W0#!0B(WZ,A>Q"LS+K($-0P!J' QTU +MDW_R)WT"N( <. %2VBIP<5)^G4^ <87,7'P%K !.2<9O\R4K Z\YDCL.2BZP +M%4._P.2&;)2/;L'! ESY=E8!9%R6W^9/+LLYI2Z?Y+4 +M$C(YB-[DU]R3<_%0'LQ7^3 OY:<\E0OSH+^9@U]3,I.Z"Z*M;&+J"IQW"D[!)NC]/<"5:]&/,& +M8,Q"BXZ7QXAS >8A#8@!-BN,78# +M< $NX 7H9)G,)?QZN@0"R8%$G U"D00B@V-H*2< F:)R[/$"L/$&V=8)YV&4 +MAL\020[">2 9$V/2&1;1HH4A[QL@S8;X^!X$\S4&Z)=-!@V 7;#K==DN!@J[ +MP)#)?#TA^W5A$=BS:C?B[<(7:K)>RVM\0V^ZC"'%J 40 >/8+50W:+0;) % +M]+*.V@*20&S/8:D=\OIC1/G6XSIH( % H*X7=]0#VP/[8-?KMOV6['5/V]<% +M!A=(EQ^=M;OVMG)' GW;Q'N$/0FP_[[4]3>QVW,[> +M=?M?[^V=MIK^]NL^?!MP:5>OQ_T@"*OH/MT+@G5'\463PW=@?UPJNWM!^.[A +M';P#=Q"?WDF\WFWO_#VQ_W="(>!9Q\TH\!H^P0N,!0]X&KR./[YO8,*_# N? +MD$5[5I#OH^2UD^;HSMQ_4[BX?!UUC1 -<4(X_J>,MQO5_7.0>2EEYI\[@'TT +M):$%=.L7P 5<@->I#"2D1 .<.#!87@ 90.50!+R[@#307]2ZPXJQ"<#'RW5T +M7->_''E7[[G=S^"%W?[A9SMA%_%AX+ K^<6^$QJ[BX'LDAUX5?:$3$YE!F9/ +MGP'#-&@'*?SD0;M^P? &_L7C==+\X#/)>,?K+B"Z+X'"9 @Y=7]7[ #^4S3Y +M^6?E>SW'^/5O(-BC@&%/QY! 1QV64Y[!%WAG#WK)N[2G]L5>RU?XQ'#A#]2NZU<[QICOO*&\TW;:7N3U>J;_,YP>QQ-:%:\Z6+QP)[ZZ'CX@ +M2N0NK)1[F7?NEP\$T'B7A MMO+\G5E=>NZ=+20_D(_ZE[_0S^=,;E-MN[TN\ +MIKPF_[_E=UQ^7VYCA53Z[A_ =.-H+>W5O[$=]L@7#?"Q/](O]R_?U'7[(>WKT#NHQ +MO4'0IP%"?V ,/:)W^XM^A1\$I6Y3<@K=/8B! +MC8>+B9E ^MF Z0^ZJ!\&V/"'@,,W0NM__68@]JO^CW #RGI8^NJ?XO9_@=/? +MLXUX,RV]#:NK,UK0.A6RFXW:?&H7!?"EI @>EP _KSC=L!(#6)MK=BNQ7G&= +MJ;P;4O\A@!F5G!&(_=Y\ '?;:?Q[-^W73T:E?_C#_N)_HL-F$H?(L7;[NH1' +M/X)?UJ=Z6?$?\9?ZU7\$R_VG4#5?^]]8-8Z18'H!$_ TF'^Q'\VT+0E4V!:Y +M$_+$0F;7]'<977]TF)PQ"VE_2UCWUW)]?]>?^.<=08 ]6_HG?>E>TMBW18V% +M6]88PB+\"8"R'P&8?(%@%5@-4&KU?U3)_T>5!(#SWP!X?>& !((.Z'3Q@)G. +MB/0 #@'G7\\F 3(-:1;.)*P(?]L!9(!4[7X. >M7:+T \5\5Z%EM7+/?YE4I +M4(%E@!4(!A9E7U+O=_SU8@>"\@?\H6-E_@ (&UF]E49?@4I%3T(%GX! X@7UA +M#4O$L@#:551)$U &?H&?8,OTM)PL4@L%*!_\@3@.!EB'27\NR?AG_5%TAB!J +MA0@F@[8."1C^F5W&("0H"5*"EN"D58"Q?P:9^]<)XH*@8 1&!#I4#8&2@00F +M?0"@',@*?H*JE#++:@)T@QM"$K!"\XM4PW5IE-U"[8#C4! +M'K0/MD+DCV1#E& )8"F*$9 J9]61UA%(68R!0)75; +M8/RG6]P!=!<66*W @3)A&$ 3!EVS'TTR!L:$Z+"\!5496"%6_(&D%3>4 1:#&R R* (J@R'@,*@(XD(E(#3H';T- +M5X#Y5PUR6]>@"]C^!5])H4XX%-)3>R#^IQ;4*P]+S^+5C8,^8$(8%+J%2R%< +M*&K1A0&)7:@ >E=UE;\5,>F$V0(3:*]5$K)9Q:1\U(.WDR]XU "#3(TPZ $2 +M@T: ,5@(;H6VSC+(&6):BV!8. Q&@V2A6>CP6(,MX 'V B9@!YD,"!3F%$JA +MFQ4*&H 161'8$'1?LV /F KFA#NA;$A/T89$5D5X&YJ"A:&LA!A"@*S?!PB!'R6!IAF<42^A7B4Y5%'HZ$2,%?F!7<'H&A61=F0507BV& +M!_P$GL6)<#P(&R^A%#CZO88/2.I@OG@)1"'OAQ/*@7. @KA,A(&U'YP@_$6( +M:,"":!.J@4WAG_04RG# 6/"'(&*(&B)3.#4YA0_+4M9HY8/YBO/7U@6"5V%F +MF!7:<\R@X=<57H9?(2-HR#B"Y-]$8@@91T3 6>A4I86JX5K("8Z($B*#^!N. +M@@S5_O>S$(;1%SGX T*(26(Z:/\QB6+5@? D5F31%X63).J"D*%S:+%4@%B7 +M9>A;#8+DWV;H%1Z"-Z)OE2.*AI=A-,@M:!PDB9"("1I@!1D,V!J^?W%@3D$B +M3HBA8!>V#@J'0PUQ&"7FA:I@@I@A HJNH"+&#C8$%-FIU1U"3U\BU +M5UAB>VAED).F.)8 9-BA%T-C(0P'H6$X)?J)56+]YQ#.AQ$A23@H$HI%EIC% +M'LJ%KM!*&&7!AU06F?(0EHWHIHELH"$U93 +M?:+YH32P#+98@WBV/(@YAX9J(6CF#C:!8^ A^ +M,J#1%& %V !VXD"&)VJ",2"?:"X^B^BB0T9PO0!CQ0MP@9$5+T'/(AD9BI,B +MG$ %,(P4@L#($EB*D:'>](^5B5;A,%@OJHDX(IN(AWV&_.*.Z"_VB !C$^ Q +M%HSKGUJ8#;*%W"+'V)/14XS6WT4HUEJY8::S,5Z+'>/ ""8VA[V@R-AQR05G +M!<@%EC"-MT??=+%HAP9AQI@HGHO18D/(8^V*(^%,@![:AFW!L)ADS8H'H*WH +M$;J$N>)X*!*VBBS!PQ@Q7F!0&EQP>KT$L2)_2*88#A7("%+3G(WMQ0)E4X ; +M*D.7N"RB#^_?A@@'%E0^69#E$]I^6R#B2(IQB">BAU@7OH%*'>(8+J)>S!]5 +M^/S-B[/0R:@5ZHN=89LX8+V)IR%:F!KFB:RA-M@X%EI6HG45%QZ I" 2AS&2 +M*8@BXGA0O8Y>%2RX_VT*[^ ^5&B%!YC=M@3K%16UDF.X!DB&MI<%^!9QCIBA +M9O@YIHQC@CCGE@YLHZ!(G"(;]F&,AQ>F K:CFN5][B( +M@8/A8]!XL4 !O^,3J#D\#,0CM&0\8HI]H$K W;B(JLK>1'8A8687VB4]7H9L +MUX$%A=EQI](@!EW=9GD7+Q4HXH[Y7[ H.T)?D1B(!0.)6(M7>F5BQ2?W8XQE +MA.V/':!OY3]R?\-@ .EV(1=_W!UG0)H*_%@"N3.6C]_@QQ.0B(./6 1)((58 +M.9X(4$&66.L5\]>I^%7MPM9$#CC12@KOBSMH=G8$J),:2-5PC6VBG>)$]D>FH2R(TKXLJB$'"&RN'A$ +M@5?2@<@LKEJRX>-X.!Y=;62054PQCFLD'+DAAHM]%U*X.NI==%:ZZ$SY"1]B +M'MEQ:8XO(O/H.=Z+TV.^"#TV@Z&A]7@G8H-ZHNI81_*1\U:@:$^UA]N7#! 7 +MX(90XL52.]J1EB26&*-LDK,C2,@^5E.7DIZ%Q, TP8RV1"%P+/$CR^2$M'E4 +M"YD8#):,E^$A.:75B(JDFS@"-I)-#VJ8":Z&FZ!K.$G6?7TDA34HIH?[5B=) +M.XZ/H*0R^40RD^*8,VE*MH\#31+#. 2/KR3\N#*A(K,D_<@BP@F0S;<4+_87 +MY>34HT%FAT9DJ9CIL)%6HA()$3*1Q)0722L66=2DV(@79(2TXD9H.)B1:"-( +MN$72DPA529A)DI)B)%5"1OZ3?&.!F$:^D9:7I6<3D@7;8T0Y.:0X/6%5MT=F +M$A*EM.@"T #AXD.F1QZ3'$-'&2XN?X.D,Q9,FH[#I)%H3!*.GU='Z1?^B@X@3$12G0%GP)RLP0 *"R943G_7 S0 +M1;* ;0V1CJ3!"$FFCC@C26G7892S80NI _8)XF-.R5%>E$Y'7;E,@H];HJ3( +M !*5,J/[.#Q^D]'2N-%45AP<3E2IW$R5H\1A854^>S_!IZ!59&("5 +M7X9B15;R)&8EP(!6Y@6N0\,F45^)?B3X& +MEAL6;^D8R4&9HH,$+UR,N)<*4)@D*56 K4,$V#_'TLB5L= !M%3FY,V9;GU8 +M"5E LHINP &90IY)9-@5I4>5#E;!%& Z!%"2$JKB6\H'UF6\((!IEU( =^E= +M@I>EAUL&<)"7M91?@%XJ6"8D>^E>G@WF87QYQZD ]*4*8%]:!?;2%6.YH#GU +MX^VA*9P5AI)VXV'RD!W0.BDJ%H2DHM5(6^Z46J/:.$\6@/:DSR@<]@GK(179 +M3QZ+#646"2<,E 1+??@K-E^YI3[)!A2+-P&.>44ZE)H81 GVJ7:D&$M042Z9 +MVIWF55C\A'+EK^=1CEZ1X[KXL,2%(R5,V>Z%BUQF2AEIJ7]$(NI83/*)!UZ@ +MV"["CC_E#A@T2HG;(M]G6ZJ#BA@L"%0"C=:DJ0@G$)9&I2N)5-(AQ6/+M%@^ +ME1;.%$ #*#>YT%KY7Z:"-6.1>#,>B55FAW=079+WI'#HB.69J*!>^>Q)FFL5 +MI>DSIH>7)I=H-?*9AB4LB5@:CX-F8WEHX@&Y4,=E+Y0KJXEJ*7(5EPPF;$ET +MH9!G0YI)9V*2;>81&$,.<-/E!%E#WI#;RP5)+[R: 2$1*8=M0_X-K7E:0IJ5HA19$6B0<)9,50#[7A;E9 +MNMU+Z>5KB5PZF+BF"" 1DF&E&@!585Z8^&6ZA*J4:AM$4F%1@6AF0!O0 O@ +M9L"51E&8#FW /6$Z& %- ,YS^4P!6@ ?]5N*F^\5HI2O43+H9A=#R7AT[29L +M ,A]&TOD@REOUE/TIGRIQMV;]V6&.2GMF^FEG\'%Y0$ I\!)*X&,TRG^G/#"2@ J*ILGYG;H3EXLTZ8\R2L6E*\B +MJ"E%\H=D8^YH9.** B5[:5U-A#]F3>DUBEDIH;%H1<*':&22J=29!H?!4L>* +MC6(Q'!R(=BID5QU#YHH%65,F'4DXOIUJIS'&=O9P95U:%"*ZG2I"WKF-/3%] +M9[N8.:*6+Z) UFB:F0GCV1EX1G5Z)WZQ:R(LMP?$>+,8"+_#<-C_760IV4JV +MC_5C?D$OTP.L+)/320:-+9[9HR1Y=SZ><>?:*7E2F\ZE"^D@E9*<)SZFC[5D +MH&=6('J*?H!GVDEW,8BD&$6Y!>*=OV<8.#39GE'(G\)8/09%1H;CY9**6FQE %-F +MFB^+^;E629\WYD%9* J55 ER2!,$-FI!8(,99 C*(78P#Z4.E ' $5 $(O*/ +M ,,X: @$A4!1<6![HPX,( 24!B4!;$%"_#+>7"WY"[*5*^7UV%(^FB]E\EE^ +M+I^M8Y#5=WV:MF$KM'["F3$""!HHCJ"U(3AH@M*?JXIB>+/@GT )#+!_,H8/ +M!-&05+ 'C,%@8&$4H-M:+T$9)*!' RUU3>P.#RAB\6@H$'D!!2I.OHL;@6-C +M5EP*CEQ;1Z:H>2L#.]8::"6&P_802P ?,0A\T;4($>I)P/$"2!P4QVEA)J@. +M1&2.Y8R@/] $$[%,W!6N!2PR6[@>6V4PI7$F1U/)7^:$#)QY:'A0=M0$@0T4 +M9KG\H3Y ( H"K #\V%CAFO5&< (6((DJ%\\%H $:N!XJ0E[ P E3Y!JJ0]9 +M+G#"YD%XJ"\E$V=5.1228E6!XYF0/GL+J7FH43*+>*="NA0RI'UG'DDH.*3#F$4J&V:D +MVV=!TGV.F2N@6VDS1I)QY>KYD+X&;V'8U%,R79ID^HAIHJ >:0@*)M&4;:9, +M*FHR@#V&EI88GG\S* R0?]J@DD'_&1H\>^8,$;J 'J$.* 2ZA,86ODL94('^ +MD),A!OI]:J#AITO))U:D$&E?V%Q.DR5HI+AA>9*I8$WJ5X*E+JA8FH'IF:X! +MCT0AV)^.Z%!Z@QJE5V52REPLI0(#$NJ42J!-J)PQE?*>$:+24%R\ $> $\'* +MN "/19/I&K1VH1 ,0Y@:IJA'8GHGR Z!:6-*O!2F,P1B*GHA99JD5_=W5J:# +M*69ZF#X6G.EPB#5UF,#E:D*;/"\!QP'GS75JB<,,T0.PIGC 0??)0 [ )M6 +MQ& 2'17\\D"( "2 /52#0&8)P*$9 Q!/2PMD*EWMIG- @ 0"Y*:W*883 _2F +MR:EL:D.J)YB$="H"/*I>#H'S*892VW:!MRFT"F>5I[R 7/E8*"X)0 3Q&\:G&ZG"@AQ:IPB +MI_(I>;H9-*?I:7IUNJ!JI]QI=.H"@*?5Z7@JH6:G'DZ#"EHA<2Q +MBD5NTB81ZFQ !X@!

A"!(>A0C@&4@MA\"E$+\Z,MN'4 +ME C[RW:F'\@O_@LJVF@02XV!0(!%E('A 7*CGFPE%(5;09OH!T; @S+$T32O +M@I.@'J (P@%,85DQ#J0%B= OP'?Z04>T4.0'KI!>!!S]$C*P?_17P V +M(6I[2IR6J.D#BJJBXJ+CAJ(@*H\J@=F8]:S@2IX 8) +M0J3"!O]"B$ P=);8@WK2I(*IG"ENA%*PD[%I3X/7NIU\:1F +M,YL!F4H&F*F-(9H:;JRCP4N;NG? J7>!G,JJVJE' YX:&^RIZD61&L\ %9NJ +MH,H7V! "!"?!>^)-ZLI 8Q-VD=QJ.:)*@H+4BIM0*82KR=.X^JW&2<_GNJA) +MRHY_)[IZCWBKUR<;Z#M09:?I.+EDF14OSO=36-D$6->E$G:Q#:-+E$&;H"WS +MSL#*\N1C1 #=()G\)!A!PJHV$*PPC\-ZL((C*9'"ZMY(* ?K6X*JB#P0R.A"*U&JV3$M+*M#:M:P/+ [DL +M ;O0%> $2*U^P<.4R*5U84G6 VL^?Z>/&S5A1JG'PZ.#.+1J^24E T AH/<$ +MO_1LJG'APQ<0@C@M*>2TX)/=!3J &: #K $Z0"X&!^@ 8AB48@K1:&XJI=85./Z +MN"HQ"*3DJ@-0KI8KYJJY*^BJ ]@!.H 5(+J&*;5K8V"ZI@^H*U(Q!ZRN +M^IA5\+KJ4?.K&A>[EA[ :\>97-FNK 'N:BOHKEC4[Q2KM :]*VKPN[)1S]"E +MD/5 -B/J")70?6BU5&$P&QY(9X$7% +M(G) M=:^R0JG1AD@L1$&6T!!( :4!+M",3+0K"N.0Q> MT6OVT&.1IO$' ($ +M"B #Z+ CW/7Z/%QLD*C]!FD(L:<$54&CXC3IP^/:4 PVA *<8PJ)"I!>N3DI +M/;"86P0[P2II%FQ)@,%^@AOL=E9>+A,=U7>F-#0&(BQ+&L%J9BBL8K'"G@H% +MP;0 P\*QPLH,>ZSH"G1L8H!U( PB2$J@:0 ,-BS4EI3>$Q]?K!G+!V0 +MQM(!)*QFQ@70 8]L"XO?#1$MD1.15%P.-2P=JQ[8#'=L#-L"-*$*FM(2R*)K +M'MH8"T@@LB'L"+O&G@V/;"1;$'P,54C"D +M KT%!&I&C:4K5&B%K"E;QH*P:*PJFV8XLI L'2#)QA(S U9I,WBR8<$!@8AX +MLD]#'.&\(!/\Q"BKPR8 /"QY^<-R2D%L%WN;G:.^$55QQ)JSMH$2VT8<,)\! +M:O'$MBC^$("!%@F=,RL-8)N@1(G$ +M@*#%*B4?_,R+8?;;",L$I.:P] +MRMRJ K K%NU3$AF9%:<7_MA?M+2V@^P8+E$5ZPHYU[%4 :4-IT2*LDDE)1L0 +M=/!C.RU ZSC0<7?,I)29Y$]4"61PZN4% L-FX,=*$_,#(J+^$*M *.-@JV*1 +M*V?S9,B2L=5!(BO"_C*:657K!BP4%6T/P 6( -89?F8Z4+3< V/ 1^5/FI3' +MEC2<77*& (L8N&L4Z HP%?@U3\!;RPAM;RV)'., =C5Z3&^"\[AAZUI/6SD8 +MF+=*7M"(9IL?*DP@.3F-A *"$.?4 (E-%0N;T7051V/6G8(=X,8:T)W.3P J +M"2,XV $G /B1/Y6V#\0)8 6DMJ1M6-:6;5)U 8"&6F2P=BU28=O2J&= "J#7 +MF@Y2P!4@^8U.!P%+Y]IB=#\ ]V8$@ "DF9?FQM$FH*TJ-MI"9MKL0=BI:;%L +MP!G0S#%_F=#ATHFJIKK:5(("R$MU00KP4<@!* .*1M[* >;M2V& ?+-6;*<6 +MW8JVL1M\-\*-<,9L89!UH \6!RB7SATU[@))M0<]2%9<>)L5C+>>4GE[WJ:W +M%<=ZV]Z.3#T'?#O"0;<1 WW+\AUTIBW9*J85)N#'[H:Y47BI*]FA$ORG60$' +M^]$Y<$.;\F9NCEB@P33'L82M^5+SD>=%I8\#;<&MJ:B%;*DFTUVWC6'L5N+Z +MN)G4;"O7UK;M:V2@*G4!N:V[5N3. 4>N;[O7!K>ZE?DV.HU.(*[[&KS]L*E< +M"+!!C &B!0JPY&X!,@"2>S9HLZ@9^)?<\B[,K?"6X\9TL=M\2[/=M^E2?EN' +MG ?\[7?&1W5J$R]4H50I35#;"#6U33^;V()Q:!P Q<5Y<6><E@$U +M!*)+Z"JZI0>(Z\9]<6%<>*G1S7%0VNB:,.F;"53R:JE6+X9!O5$>I*[,'TS@ +M5]4VYR2B!.*>L\[<0X<"A ",;KRV;D)F1:Y#L06 N+(<[:N+F,A0 +M3( ^!\IEN8C)=Q($3"G"+D='FR!T--M?]NL^ <'N)P?^/6:DVBA'T!UUMVFL +M>YO% /^MG\OQW O]5+BTZA*UDU*O"^O6$ 0;;5;KY@RW+NJ:Z]YFNZZ'9NX^ +MN]'N/D?1A0#%K@J%[$J[&9VOL=']IY>N2$?2I71J63GGTKUM\)VS:^M N\EN +MNMNI6;M%';9+G&J[C^VV.B=TJ]J(/N)1%HKRJN>D\9:K1M!&T/$J3]]JG]6N +M I+\E.%)*(R\&2\W4J\ZA?P4I9DY^I"&!?(TK[:\R]-!]3#26F83E-;5=742 +M@1K0-JVE<(*XFH^XO)<+57%)S!2@@?*D7K R*6S,1(@4!SKH06"GB$(L2E9# +MUIA7/ !+VCUT(SX W]0'_4UP4[IZ]"Y/22_'L/2>$DZO4!%0*!92[T2W1OR? +ML()QT%1JO3E,U\O(?KUH0-A+"MD 4T%FJ]T OB&J5>J'N5( :L T7C@ALY3O +MM"O]2VT2!"*_VBJVE-*#CM:+BM/A:T@)3&M4;YOP0#\"K^4+_'[QR&^OX5.$4'TOK&O\YLZ +M3;ZMTYU;>T4]9P4^.YXD #AK4-22A$/; A6 M5I0=&M,]RI]"K!29O(I0$]? +MU*S"L5A/GYJ%H3W!$]R3L=08?$\&1-4@P,!*5 GY%!"83V,(^@2%$, MRJ

*5H+,M@8TC#8+HQT6>H >@/FQ$@M""9LM[0ARG1SPRT*NHN +M_ EG-^VP*"R1\"4P21%P!=#"(@ J;&*HP]U4*WPOZ<,>RH1BD0#$M.U.D3-T +MPKY1+YP/_\*T23!<"P_#^5HQ'"QHOK[O^\3YXCW+V1P@,)%T#[ :EP*X9B%* +M/;IG(L/HR1J3R'8-(D94FZ)!P]+P16' @A0()[>6#6_#K$PWS/SY#O>"@H0H +MY22BT4MRZZ"M*PD1X"T8 >IONI23=)Z'R00UI6AG8-E@8K+.PNG28J(1TPO[ +M;*?"5IJ6W X,(+/VN6V!GLO ADNB\&MBZ\@F#+'_01"+!:K)1'R=\":8&7 " +M$.,:E($<\!87*(J3.VR<("=(P%T\>*Q7]C =-(_.3VEQ0KRI ,3GK4YA,.4] +M9VM?TS3YPN]"13Q#"T%8/0I@' 4)Y:P.59I +M6 0](<.D!>?$RCP,1@O)4@8[$(E!GIH7*# >QOT+5(!Q>L"V=ALD9G;!'@Q! +M#9=ED)4S[S0[M;!C3+ R6<3(&M&BTPMK)YH!IP!=@8C\3T; +M,?6:+VT0(;'5\& V._[3X@JK?"*4P2K3RES(!(Z '!X!)Z.K=ZPQ[BJ/;YM" +M?8 OT%P$3!H'U.#41%9P!WH0Q#S/$R]S%^,0E+%*-ZG1SQ>'!"TE+$ 2#RP +MI0?60 9(2A$P0GN\ E!L+4?#*<%/WUEH(%IHNG. KM%"!,E*PRD; =QFN1"(B$\A20(=K)L-//[+,L":+Q$F# +MFVPH(\C B9T, IL.!_* K,C8Q?I9)I4&Z &,K@B;*8_(4@!U1Q,(RA4NIQ2@ +M)@;DL%JC*"^[9S(,XR@WQ)*R&60IX\GWD0GK*8/*W0$M= "9RM,IS38H#WR% +M;)&.RZ=Q!(GEYS8%)WV6KBD +M+'\BS+*:3"N_R8"0G S!UC)UW*??(\ RA,#JAS:JLK%\J&\*2?* +MVYF/;!IL$,YRI)R3V,N+S+1,!PBP'+*9,$.@!KIR'_8IA\JP;\'L(:,&P+*\ +M+-T2R@]$JRS(O,K?@#''S/PRS5RR +M-B6'7+H\,(, 3;((,3)O$'JLR)

FN:8M0]$3*T "C Y;($Q ;#DRON ^L\D[ /V3/P^<&X@) 2_3B>#+*<\3R6,,QE3LL$J:?,:,'""P.NS HVY +MS0$K0!J@UYH=LK-4VN:NS*FS!%UQ$ ;#G"05NU&8REPY5\R-SH*4S/!RGL\G +MPP.-]T30@E3[_#B@T'2K_5RJX<_ZL_&*.S7$_;-ZD,G55@XTP=ES$#(#= ]M +M0'?*/VX'+4C%SBVT#P "T]!9P5^FY4)GL1NOH3+@$CV5]+H4)F$@RK$R +MI%P/8,R5;:S,=FM#4S(+-!C]*0313S02W8=.T!7T!9U$G!'_Z:"L14?1$_23 +M)D*7;23T27?10=&PBK\)<]*7;#2NG ; T)F4#(TZR\]3B4S7*1O/*T#N,4T[ LN,[*LP7^6.K$O667P:SIXMMO9 +MA#LL3TH9<:EKS[8+?+&("1/HN;N#52HT0RCYB>(,W\7,:3)YV1C[RVKQ.'0S +MG[<#)R$B2:G,\_+\=#A'*(FS:DN;R4^K;>.<.D'.DO-10CE3 9:S(=?'5=.D +MUHV,X$0?NT +M,/?*N_/E\CZC ,-TQWR= ,\6B?!\N1#/]K3Q'+Q1TN!T5L \I[.A:J.!1B40 +M[\_T7#U_"M?SBI ]V]/VM/<\2)L. 373#$TKQ%3 ^-Q1J]#F,WTI J3/Z!HX +M31B4H_\T[ 9.MP;NL_]D3^/0MUE(W3\#T0#T$"U SU $]!IP1#?4ZR91'473 +MSS)# ^U"RQQ^[?9LN4#2%C29,$EKT*MM C H&]6/0QX=0B-1#R\%[4>? ">T +M/9U"FU/?L^E02#/5[#09\U+S8RD;4>V5R=.E&B0M26?07/5'=U5?TN!T)FWP +M!T;FTZMP9M-2,M7(<' +M[W0\'5C/T_AT6ET[.\[Y=.[,3P>_O'-2K=LFQP(U:KVI&-2J4%JM4"//5#4C +M[5"GRLUS1/T\4PS1,T5A45O/V+,:=Q]OSR754^V %T$5U 5]A$ +M-6M]8O=A3'2'G58_U9C;%+UB6]%.Q),]E;S87#08_46#T.6<&+UBE]$)'5R- +M1M//-FH3W49CU5"U'$UB5]4F]D<'8I-.*G9LVV*#U8#UDAU(Q]AF]8S-.A78 +M,70Y6ES;V12F)OU76]DY-C@M5V/0=+2%W687M=OSG.W2I=6!]K4+6-O3@W4I +M;5BKTHBU98EIL]*K;6--X3;3%N?;3!)U7 Y+G#/4[*TSJU)C:J=855R=0^U> +M<>ETBBQ*(U)V@*,K3F]Q<$#*6<;!M25DZTSQEFZ_L%YP&4NMG)*&?$W_%SC +M09LN<9CZZJEM>_@.XB]8DF+Y58F-58K%5AP[0AR 6B#:V;93\YI><>U:ICM% +M34I_F7*<,Q2\'W1'G$>9Q(W9_*0ZA]LF0*S+*2W;XR]5P@3(JK">P!#J$AZ6 +M$HCQ7MRNJL.T&C.<&KZ2#H&BV,$_,58VU+PCY*:Y2TOUU!&V(3- .[S@6\51 +M6]D!$/?*0O +M*W-_&W' 1)?3X7.=G+3[;7=JS.YM6G'S&2PXUQ0]@:M\0-5%/<4K3('4!SW#JPSBS0K7(L739W=D/0)??)S="EW+$; +M%WURO]SGG$#W=W?9J%PFMW1KW7/WS8UA#KNO-M4-='>G/W?/3:H-W5>W)Z=W +M2]J(H.6M>)\ 7G;2[>H>WBV1TVW(Z'3YG-1M=>_G=G73W?P8XLUUL]Y> +M][KI:HH*\$*"-!:;<;'V.UUKX]Z5[CKMS^I1MUP95RJMM\ !2@##; $[E$0B +MJA0!/L!ULGQW5,EM\BU;:R?:@E[;49%F.]1KLGQ;WWV ->?4^G:6[V/7U' +M)M:WION7E=_CL7)0$J3?%#>S#85V4PF28N-T@;=R !RP!A0<[])MAK[(,!N5 +MR'% O$NMVC>[@7,,'NUI0!?D 5.W1ZQ0J QM0.Y4+S'1*+&')@: RI0!<8M% +MI0 !. QC.D3@U'<1D('#=P6X&$7NTB:]+BT%[WJ^Z0/HVP8LS8=9\ W^#7/J +M]VU:;F?<7K2P;04,;_R;1QS!H@8[%&9&]L"M3X#<*J'DN.#V"=>=3KB0G/'- +MY)[=V0:NR>W&I^%WOE3QT@M1CT@E*K3:\%T*OH(CIKXL$_V"1P8QN&Q6--#@ +MHC7YC8-O=B3"#MZ#!TP_^,H@A+M+K.YV5H7G2^5HZXL[S;4@<4-"D.F67A88%+QH7# +M!E8#&$[(B.$=%1E>.B].?;C+?B;'(8?LJ<%F,X +MZ6;BNMDHMMOM4ZOA;+CJC8X7#@'3&[XQ3RF^R1P>MSH!=[C*W:G-4@PCB!7DQ7O$>Y%0V%IV-4S*P +MV9EZCJN;;FY?P[D0!QO7/-9WI3'MCDYJZM#<^5BU ^- H#CD'+'?)2[ &^W +MD2V4K]C:>&'NAV\!%O1/OIWHM8=Y5?V.B]+C!6']GU'FS_)E?BG'M@8N ZW; +MLN:1LFO^0J_2:WE;'I7/WU0Y!UQ5P^7J]NRKQA%,5GD"@#]GY?S85LY#JW)@ +MN6LFEA_1%[GA&BL#R7];"J"6J]PX-#=.F]<%/718()D33&CXQFUD$TS0.:G6 +MF5<JID*SH)'XB[X9T")OT_G+0U^WF;B-[A( +MS(FG!\?$U(U,^P! ^"A..I3B1C@2[HO[XW4!\12,\](+.3%>B!_@XO8Q[NIJ +MXKOA:08<3H]#,F_K +M/9Z/6]T#>4HK=-^F*CE+7@:XY(CX6G27 *S>LB/^H"N_$3H,3J&_%!;Z2X&A +M8V[E]XC H?/@M^F''J+K3D0XFP:+WV:R^!)>B^\=8P N_J(7LKQX$HZBRP$J +MNA\NC._I-)M$'J/39LCX%FZC=^'->$C-HSL1/GKG-HT+Z>&YVKV&&^E4=SR> +MI,_C3I"CY%3Z9VZEN^0=%Z&DH!,U +MWP\ANH(5BMZR<8Z5V[1;N4YMR AK@H*, K#2;&ZN/W6,)IYAJ/T%)35F1;!+)I,2FB3&H +MG*\V%JFF]C:^K4X(!^^!&#%]^$I$P,J08[0:* *E2C 0'@[1GM$> +M8(N<;CN0OHYCP4:4X5=RN^Q*NARNV2A)Q:[> -_:[/CYY59QJ #!]]$- +MCPL!L0W#20YUIT@[9#9T;^,DA"'C!\#) +MK\DN%"[L#5F $S $G.QE.'&:MIG&F-( +MLQO(-/MG0#$C.#+?C"SZ=/1O?.AJ:B6C 2)WMM&.[]+D@RS' +M;NZRITO2.;A,A,IM22^[F'NY/"=/:QASI->O \IT.NA>0(CN'#1M5MU6T9KZ +MR[ZDDSW?R5WT.A6Q6>J'P47(:N;U8%.VA>VT&9PKE$R$CL00;''$D#%OJW,T!8:NW# L3/ODO#'WHTSZC@ZR?Z,U^OE +M.,JN9(.S,L=(?*@3W92Z>FZI3^Z5-S?N$8OLDWG[;KZ; -"XI(Z-\V\J^SI^ +MC9_CW[(\3K?;XY_ZDWZ0(^W$&^7-OJ_BAOC-5K9E;!KY]S:ZC]9].VV6LU?J +M@LD3W+-?[7)[[1ZTU^-#NW&DR!CM8/O>OJJ+[95:E T21^93&M->KSOM@3?4 +M+K4WRU7[^1ZO@?"DVMQ^N]OM7KO>WJXMZTK[J_O"YTOVG&UFMJ/M8(USQ[:[ +M[7#[SR[":^UU>VR#MQM^*?P0G\&W\!7'$<_>_N]4=^=\F]WI-P7LFS;?W2_T +M"O!/B^&1-"+]O.I18W, 15.[!J_S'3V5S/%H_ #5=[NZ 93@'4:/T>8YADD' +ME- 8IAE-JHW0=, @_U6+T2IW^4Q>)O*F@QA>QY]N0FYEOC&#SP,VZ>3D1O)H +M>(ZKG\?/H_5_7K:Y++I:X)X\_"[H@P!C7QSN@$SB+D L[HR[21Z6/>Z1>PQ" +MOQ_.$@G:GKKC\I=SG*RYI^ZJNW'@N3>X^WH*$+I;\+$[U5VZQ\FG^Z($S ?L +M=4%*\+D7\\<\\7;!)P"S._'FPW?J>X-F\[8C3.AH[PXV_.[\* G2N&_/JGI* +M.\%G\%8L\X<#$+YWB0W@?4KE^+?O/>BZTP/Z55*@OQ2J,O]=K_O?^WKQG9#' +MQ@OY0?O&X30O>K'=_))).(7DZX34Y9_":=*G\ X$;IU#ST.ZQ/7][5S$Y?J\ +M@3ZOJW']][WT?\/BG!(!GM#[<=DO0[\&./1,A6:<*4X]M@>9C'B.OV$1=P8G +M&-Q:20&.IAX5*$H^*C#(Y;I<"S%KM$R^TA$ :80T[Y*3VA>W21YO#3&8?>B[ +M%\E@#<.^P5/DBX>8ZN\"(>.$Y&CT-J?[\N#;'(MG,HQR.B0. +MI@.U$OH<4(F7?C2X";#5Z["&>A$^*?7I)[JE%*B3#D]XEB*!2^'!\KTDOM_O +MY/O('H[K\)!Z^AZW:_#Q^\I^RT_Q![S,#JJ7RC6["B^E%^_P794^< ;B,3D5 +M_J)W]GL*#" FTSCC.J)4TU,E.'W($EDV,SU]XO[37R5!O>HPU#LA1?U1#SDD +M]1V[,\U49'4%T_-!$@?GG.])[,:9<7.N)Z(\/?4O13)M3DGU*%KI9-6C",13 +M5B_7,Q5KI4USMTNQR-/KXSXS@Z=FT-\^_H>Q2?LC?V GR1GD"CT9B;@D_8,_A?.&UO +MW^<,)7ND+HV#\7;VFZVS1]SL.(E?XHO2!OSM+MDK\/R;<=ZLZ_6G.ND0D//C +M=53.0-^721_^:Q"0,_#\FP.ODKOW43A\_ZIW]L2;H3Z(:_/:2*]AD4_>HGP@ +M3\ETY+[11SZNX:/&P2]'_PCODS<[CY ?WT=^Q0N9*?D#^PB>%-0$(-4%-N/< +M'J_F#EG%-N:/+4_. _CD?GT4+I@/Y:1:4?Z9'^7#>JSLA(!HAYD38CH$]JLM +MG!^6UU8>?F_/[E[FCOV=OV+K^0EY:%[G8^"K$F=N;K[G_UFB_QB#YB S;'[B +M9O*:OJUKFS/5N+E_7L&K9N\Z53X&/+?J>O#$K@_GN_>^J:N'!QM5<2MB?&R> +M2(.MRAT$9'BP/@8,YCV\G\]4&.O6>0P1Z#,5I7Y^OF,33#TVCZ_H'TPG@W=N +MR #1)W[:S8YWYT,U(WUUI^=O-WL>V[KGL;)JGC_G\6/S/UV?D_KW>:@M3^OG +M?[J +U-/2CA^TN!0[/A=4H]/8_=E'C&U_EAZZ=RK]"S]N*&/,_7'O0D U2_W@092K'JG +MVRE]<=_07_71O<>OJTWWXP9\&S./!G@ "A 04_R1>'[FWZ:&_DZ>ELWYQ7%@_C@ ^[&YY5*6TP%_OMJFU2/[Z3YFG_FD*O6B)$S! +M!ZM;KV:,(&@6_"WPP=_FI'P6P$+OS'H\.LFY!"F+O$O]"+_2G_5/_2Q +M6W*]>]O0 &I]_^S/\53]O_3J8_63?*>&\>.\R#U(H=Q/$!W_Z0WR5_4P/W1_ +M$IO\_1O*CU.H_+$RR^_R/_?EO/.G]SF_XK\&D%(\/U\>D\OY +M=/X%OITX^K>INGGT)_W'_KB1[%?5V7FS7^_/_=WYD,WM5_AK.+:/9$OY'O2X +MS\%[^U6UN@GNZ\WB_KE?[F?RPO_6QFDOUZ,Z'27OZ_BA?LZPEE-'4#]66/U) +M_?\YP%\0\<@T[Y[RCM0XNP/Q:IX;_%W_ N2_M) +MODI^IS?NC.;/KV5U6_G%'!Y_A;_('^)O>8,"J/E9_D0..#_EE\Z/NL< ]+GU +M_/QR0#\B'U!NZ(?GP_T9_6)FJ+^EG^KO/F>::_TMV)Q]0;9HG^ROVF>-F[!% +M^[)]'S]STU]F]H?BX_W%^'Y_H[3@'[DOR:7[&[FA^XY_L+EX7UU@WM?\\_'M +MX:!_48FH7SOLWV<=\WCT*3P>,[WX!+2-/57;@/0 X=XG(PS=@$T+):;J6AG, +MO9(*F &-&[FKT,9@*J,X4LXHZ(]@@7QOKK7YZV0DU_PGK+5V&AK'#?@0F:BM +M^L9MA8-2W//D=+#+\:%-^_)GLAP.WL2MDU$XV&[A4-YM)QS% %EW 9 B1IL +M4>B :)H> ZC,=/ U0**HU8![B!1XVNYM$#B5X .&4B@&FD#@&AJM]/ UP -V +M,GASC90^(/I#$O@*?-?= 0&!B@%XEW# ]377$@4R >!.311H/^$/,'LJ_^! +M FE?_+T\W4:EC4=AVJ>9S%Q]ZS92RINM#D@*O+!-^18#_R9G'?%D#8"BF<6) +M MD7SD "X*RMO+7&\6M1,MA]L[C-WS"PD88+].003%( 6X Q@)VLZ@#O6@>Z +M ^T \$!YH-@L*T#2V>]U#O!TI).%F3EP:?<.C ?:R380R3EI@CW0%Q@/),VI +M4L)0@D#Q%D/PU[A<6Z!@\#YVVXMW_0(S*I9W%1S:1D$23C6PL786U**0 +M >9[!!.78/VF$[@.O W^FS2#H0'IH%^+#8@2;)]4\N9[V,%4("=0FJ 5Q GJ +M!&^"J:\WX.H+%;@P PK"ZUJ!1$$[H$JPMA5OT]\=]L*#"[/QH!E@.SANZPXR +M!G-\KX%Q7WF0_K9N&YB, JV!!$*:(#QM';@#Q ?>!(N"%R^ !;(B1HB4L1&&I$H3CY8L8 :JZ!6S@!&N +M"!M%906(D0S@+" 1*! <"'1 39/)0!T 8' *\B2YI008I+@[%M/"KU"RL ?! +M>CP6GB2KU<9 ZM5SV5F!+%)@OZ#2TU6*2'B/,!&&DF)/,8&[D/J(=G0E--1H +M#"@$6T*G19A((L*Q !/2CL2$\ 0B1IG0XW0FM'CM3/0DE:QGS[=*(M#QRK89 +MI@H.+,).A8LP1XB-NY@L$\I+#_0&:A0F"E\#QA\:X::PBY2O,O/1 +M.&H<;+XHSNT!5=@/RM5EV_H?. 72"+1 +MUH( 0CR^'0L/KM8$I/O9_S*"?9DK3MJOJ<<&&,P(#:9Z$S\#(,GO\*<"7/Q9 +MY3 &FSVF@E3O-O,L1$Q!!OH?)0,Y &(*7!AH*/-QGRH>R+:/2RT-*A9V #5XMCYQ8$>K#4$\V=;L"#X1*[CF5:@-4:+O0P-@ +M#,E+?!02X<6+J>H1\@F. H-DEQ:VY#HCRX)^X,O$AU]@'Y)U:,AH4G*T822NJJ@ +M#'.&Y"."A3YK%!03 ##T#-=/J:"7H0*)GC(UI"E5#:TFO*,YX>1+BAZ!D!9)U".##ID)>R1^VA,] +M#9>%4<.Q LJ.%2!J1KBF792&ABJA-9PA20U'!Q^C^("AD.L(9F";'@0,!L: +MCV($LH@"Q-JP# 0S>4*="[LI-(K#A9!PVY3V42%=D#Y6SH$00#<@\;!XZ#Y^'SD,LAE^E:1(,$K%05[P\8Q#ZQ^J05\@MB$C4 +MB6"'_2.:R^S0[")"LAT:ER1D2:784M%E<6B3NAC!"0,2A\-3BW1)VQ25,!Y" +M#^^'^,/\H?X0>0A:@5CT*1AN,PY]EIRCHK>' A/1&=H."Y9QE38)94+&L']D +M!:!D'P/?WY0OHJ'+R@/TS\Q-OI$VA/HA0W B>"!,9YHG#\2:E@21DA&)^&-= +M$#&(>B$3Q08Q$L%!-&U]$.E1$Y &(I@(#\'$X!\(&UX MA.4A>QAB5.P\WAX +MQC8>IA"Q6, **,(KC$V4)+9:)0%/3@J@!C>DH(+P"G^%M E3%E9/%\(KW!4J +M2> &%['/1U!$K^#D*(V0,1830 [SCVODB"@",/\,PWPCE,.?E.)$^B%&M)R1 +M)&IAYI\PP!D13F CB29PDRP,]*S:"^W@LB5$U(G8!*@"X:[R!R %DZ+*@9_H +M!(M8&T2HX'5 W_8PF*Y,$;93W@0!43A!<9(5 (E$R<11\!/*P"C!A%C$TB0R +MLBJ(E$360^6O< _&6&\*2J(X+P,8KND]#"=^128 L\H(D3, 9 O.-H +M$]<5!(=4(IS /\1I $0,-J!#>:N@!F5+=X#F"VJH"2T709%?(=K* T6?XG$"J$C),/^X +M%>&*1L6'XEPQJ3A3+%@Q%?>*4D78QD:QK?A6C %@%4>*6T7G55?QBJA2K+T0 +M-=X%1(TL8&7K!F O>.*4]I2*-$5NFDU1,=2SB2MV09J*=47.8F"CH7A4!"Q. +M%'F%7$30(AFCC3A8#"TV@4:+V@*1HE91;\!5K")Z%>$&8$7'(G:#*E!6^'X@ +M<50=@(V*$QGC"F#5R"CJ$YU7Q$4Q8D_QLPA8I&0D%S.*>46+XDUPJ2A=="T* +M%J.*SL7B(LHEMIA5)"DZ 3B*ST64"TH1MPA: 6S8"P!?\\1/ > +4P#K$(=A +M%K=I00".8FDHH[A+)44RQGQ1O'A;;"S6C]8Y(2H:Q??C(&%6.$@0$$V*F<7XHO-JP>A9_"]. +M)0H_0@!O08]HOVA:?"^F%IN+J\4 8VN1C %B%#&6?[8%W<7$(B6#PSA>=##J +MJ\(?,HKP!UEQ)Y!BR3$^<=**68$C0)0A+&$#@"]R%(6,4P B8X=1M6BY0#(J +M&4F,$<7I(FJQHLADG$HX&1,;*\8FXY 1R\A=1"S2%IU75\8B8XTQM_A@1%0E +M-B2+/$:R1.'+*F6YB!D) >H&'B,CH_/*S0AG'!@M&5&,;49O01/@S;@ML#-" +M&8&*_<438Y21DD%G[#,6&;&++$8](Y\QSMAE1#!^%^>,BL8ZHYBQP4AFU%?9 +M.& <,8XH#E'@7: CT_IE!9 I R=3(DF@@CBR0Y/Z^@#X#KN +M[)@ 7T?[QH]B.J4%+-BM!,9-7(SS7(IFZ_C-Z#K"'2D7]HVPXVN*XT1N%#@F +M&\4,MQFVX[YPL( NV1A*0#!\,!J^8^7 [QAWW$G,':6.]:.5 )HOZ.1]>K.I +M8RI0"#2LHU'0N?!*?'F,2YX61P,Z3H*%./BN Z"HG"@9K;Y_B2@&P]0&0#I. +M)>!R^Q/3P&)@(&![U /JUM8E#I'>X^AQN'9C4S<-%LP/2X)7R>J1XSAR;#OV +M'4.#@HF_(]CQN1,#>*)('^6.I(WJH]<1\+B3.%(< ;2/U\?N(Z-"!F!]K#RZ +M)!@5,P#AH\R1J0!:L_7-&_4NY\9E8OM1,)5"&%VE')N/B\<#@[VP\$AL7#=: +M*=, +M)]A3^ )!XE_F\^B\HG;!'E-]/<&2 +YNA9!Z%+9=L +M 6 N*9/VB3O_GAS=#Y.'J&/V\?IX^4#_&A^##N6'[F/IC$F !42"^E]W$)R +M-;R/Y,<6L!QX-@O$#;.'QM3(@3[(Q%2 ?GYV@[L +M'W.-_<=C@O(Q =F$S#]N!W(/ ,=JRK?Q\*B'5#M:+E2.^T(F0@-R3P:!]/O] +M_^P4$0@A9/\PQ<+MJ+:-J"1A,<.)P2"XT[OB0 $-'">/Q-G.#)#O. +M(9N0;L<(&Q_ )Q=^O'4\=QJ/H\BDX\HI7R-Z](Y1,A0F+05B%<1YHI4$B7"1-H&)3#EJ(@N/K4A/"RCR.\,I 4!. +M)$Z1J4C%FL8OX!B0U+N\(GD#L$=6#-H?=H%Y9#VR-Z#(>>=E9?J(CQR%&?>NG+,"X*0Y +M'H\KNYKQ@!I2$+ER;"L &VTRWYE28UKF4Z $8*+4! XB_)*1I KMWU2$C,0I +M4@8+@QFVPH'&W#3'VR"84]@# )I]F6NRJ*.H>=OH)$, (K2C%=EQCM>:!-.U +M3S)YQ .0B$:+S\ %L*#\X%R3I9HY'D;R./F>-$E^1=#'$4FA'0M58DH@P9,XX8YT [< +M##88_"@7P=(AH)!G8!RD:"X.%HC@PFM*9,2GA%/:%I IIZLQ@ O@$TE#U*UL +M(LL G<@B9=T' I$8, $(_@YS#@M +M*\%XJLGE'GDI.2DKT,R<#9Z49(S\5J_21_"KA ,$*S&5["M-):>2.3"@T4T: +M)^=SN4E9F?(+26FYV'&UG"8(TTIS97F/!;"=X@%0;%J#LDI@I,B/8Q&B'&6I)%EV+-DL8<"+ X+RBO6?W&>Q.3*05AP\Y51"3TG^*DK. +M\9"2B9#>V +M!D][ "! I6=A U&H/!I,(1*5=:_(P"PQ)?"H5#SHC225^B9L5-RR9@FN3.2) +M*X.2S %/)4!R+#FJ[%2:*@6 XJU6I5Z!5=ER454:RA9!>\A2C;:R]>*KI%MR +M+.V6'LODEX\ 6>EALY^]*\UG54D1P(WR=<:GS%=Z*_>5=4ND7^12%<>IZ >:Y>WR<2FZQ%G*+ $1.\L$0/_0L<'MD-61 +MFX26YZ;G)%&2/:FRA%C2*RL.',H>95+!?.:][%U^*PLM4 B<9? K9&F^!%VB +M+PD.H\M=8.721$8N+5@#K@0X!')E9U6.!$4% +M:6B3O,B%Y4L-7=FZE$-&"&E]"S3GW,]OYPCV:V]D)TA_PLG_).%KW.%>;$[J +M*+6714OVY((2:;F17$IV)$,&6;VGY822>VFAS%PR]2X.6,LL&OW2Y82Y')LY +M+JLIZ4M/R^[2&G;#1!_D,(67:Q21I,H2DJ>Y5)_M+)N1_4L9XAD @,DZZU3J +MK#Q.!4Q*Y1!R5W.TU$ANS)26 R>F90T*) FU- (L)\=J*S079LZ05#F?VEQ2 +M*-<*'LJM99.R:RF?S H8^B28?[DI105S^H;!)$K.*1,D69D2T]6QC-W%L*%998)(%N%YOCVP5@@%C$ +M6.*6QC,_9MPRB::K[&I1+1TT,"4&0R,OYM'@E[D="&;>\5R.Q$PEES$S&6F\FV)6 +M**64)TEGIGH"#/%96&%E*6\&U4S8)#931-FAS$@^!Y.6#DJ'@NE@G\77^F+^ +M-/^95LF-+4/$I:,0F02\L3IE/R-S$0%*2T +M,*N66DWM0 R"JWG4Q$,FKR8&H<;GX!NRC_4++&LR**&:)LP'9=,RP%#5Y! N +M,Q59,$J4I ,B;1A2N&JES]B'H2#W(5I*+@ _-!29,6$9ZB:5(S<3(MC._*>% +M,S.;V\P-1CESW BQ3&9A 27HSG3G?GL:2/$,T$K'@_'I,>#3,9B^2]$ +M0SH5[D5S4SGQ$-FRV4QJ$PX,Y4:R)(J2K$G),&W,;A S+9M5Y!J2$,F#\UKJ +M)'F2:TIMP29SL!#<[%LR!WXZK[8W6Q/ -3(%Z%%$ 0 T X&1C=(/_C"R4:R= +M9U9I> ;2L\F!22E@6W./K(>=1 6BX.$\>$N6-[)6-I)5B/(9HM)BZ1U$AS& +MF"PL8)7(88V)*E%%*B/EF%066Z/^YD>)+( ><@O8)O8I0B8EBS9A_Z7'JIQP +M)4H",87XD*Y(P3DU-"@%#V=/":7L4'3$2(+<0*5H2V0([0EED8&H(" '2$<@ +M!70R0+C/ (D 5.B/J13 .%<&,D[JA4TH3C*!&0I,9?X+;:#^PHVS#9#CI''. +M))8NXPI]2@9ED&19NT#]EZ '.,XWP(P34JCS&IOPO! ?:!/1WDM R2#T4@X1"XFEV)1#HB%Q +8FY81&X3S0IV3=,A,,"*D#\@ 8@"PUU," + +end + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.10 b/usr.sbin/xntpd/patches/patch.10 new file mode 100644 index 000000000000..1771b5fef717 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.10 @@ -0,0 +1,1925 @@ +diff -c COPYRIGHT:1.1.1.16 COPYRIGHT:1.21 +*** COPYRIGHT:1.1.1.16 Wed Feb 2 18:09:17 1994 +--- COPYRIGHT Wed Feb 2 18:09:18 1994 +*************** +*** 1,6 **** + /****************************************************************************** + * * +! * Copyright (c) David L. Mills 1992, 1993, 1994 * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * +--- 1,6 ---- + /****************************************************************************** + * * +! * Copyright (c) David L. Mills 1992, 1993, 1994 * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * +*************** +*** 55,58 **** + * Torsten Duwe (Linux Port) + * Paul A Vixie (TrueTime GPS driver) + * Jim Jagielski (A/UX port) +! */ +--- 55,58 ---- + * Torsten Duwe (Linux Port) + * Paul A Vixie (TrueTime GPS driver) + * Jim Jagielski (A/UX port) +! */ +diff -c doc/xntpd.8:1.1.1.12 doc/xntpd.8:3.24 +*** doc/xntpd.8:1.1.1.12 Wed Feb 2 18:10:44 1994 +--- doc/xntpd.8 Wed Feb 2 18:10:45 1994 +*************** +*** 446,451 **** +--- 446,467 ---- + .Ip notrust 10 + Treat these hosts normally in other respects, but never use them as + synchronization sources. ++ .Ip limited 10 ++ 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 \*(L"client_limit\*(R" hosts ++ that have shown up at the server and that have been active during the ++ last \*(L"client_limit_period\*(R" seconds are accepted. Requests from ++ other clients from the same net are rejected. Only time request ++ packets are taken into account. \*(L"Private\*(R", \*(L"control\*(R", ++ and \*(L"broadcast\*(R" packets are not subject to client limitation ++ and therefore are not contributing to client count. History of clients ++ is kept using the monitoring capability of ++ .IR xntpd . ++ Thus, monitoring is active as long as there is a restriction entry ++ with the \*(L"limited\*(R" flag. The default value for ++ \*(L"client_limit\*(R" is 3. The default value for ++ \*(L"client_limit_period\*(R" is 3600 seconds. + .Ip ntpport 10 + This is actually a match algorithm modifier, rather than a restriction + flag. Its presence causes the restriction entry to be matched only if +*************** +*** 469,474 **** +--- 485,505 ---- + considered an alternative to the standard NTP authentication facility. Source + address based restrictions are easily circumvented by a determined cracker. + .PP ++ .B clientlimit ++ .I limit ++ .PP ++ Sets \*(L"client_limit\*(R" to \*(L"limit\*(R", allows configuration ++ of client limitation policy. This variable defines the number of ++ clients from the same network that are allowed to use the server. ++ .PP ++ .B clientperiod ++ .I period ++ .PP ++ Sets \*(L"client_limit_period\*(R", allows configuration of client ++ limitation policy. This variable specifies the number ++ of seconds after which a client is considered inactive and thus no ++ longer is counted for client limit restriction. ++ .PP + .B trap + .I host_address + [ +diff -c doc/xntpdc.8:1.1.1.2 doc/xntpdc.8:3.4 +*** doc/xntpdc.8:1.1.1.2 Wed Feb 2 18:10:46 1994 +--- doc/xntpdc.8 Wed Feb 2 18:10:47 1994 +*************** +*** 539,544 **** +--- 539,555 ---- + Ignore all NTP mode 7 packets which attempt to modify the state of the + server (i.e. run time reconfiguration). Queries which return information + are permitted. ++ .Ip notrap 10 ++ 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. ++ .Ip lowpriotrap 10 ++ 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. + .Ip noserve 10 + Ignore NTP packets whose mode is other than 7. In effect, time service is + denied, though queries may still be permitted. +*************** +*** 549,554 **** +--- 560,582 ---- + .Ip notrust 10 + Treat these hosts normally in other respects, but never use them as + synchronization sources. ++ .Ip limited 10 ++ 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 \*(L"client_limit\*(R" hosts ++ that have shown up at the server and that have been active during the ++ last \*(L"client_limit_period\*(R" seconds are accepted. Requests from ++ other clients from the same net are rejected. Only time request ++ packets are taken into account. \*(L"Private\*(R", \*(L"control\*(R", ++ and \*(L"broadcast\*(R" packets are not subject to client limitation ++ and therefore are not contributing to client count. History of clients ++ is kept using the monitoring capability of ++ .IR xntpd. ++ Thus, monitoring is active as long as there is a restriction entry ++ with the \*(L"limited\*(R" flag. The default value for ++ \*(L"client_limit\*(R" is 3. The default value for ++ \*(L"client_limit_period\*(R" is 3600 seconds. Currently both ++ variables are not runtime configurable. + .Ip ntpport 10 + This is actually a match algorithm modifier, rather than a restriction + flag. Its presence causes the restriction entry to be matched only if +diff -c hints/linux:1.1.1.1 hints/linux:1.2 +*** hints/linux:1.1.1.1 Wed Feb 2 18:10:58 1994 +--- hints/linux Wed Feb 2 18:10:59 1994 +*************** +*** 1,29 **** + +! Requirements: kernel 0.99.14 or newer, libc 4.5 or newer + ------------ + +! With this configuration, xntp should build an run right out of the +! box (see generic hints for how-to), with one big limitation: tickadj doesn't +! work yet. This is especially painful since PCs are usually equipped with +! untuned, badly-drifting quartzes, values up to 200 ppm being no exception. +! Because the loop filter algorithms are limited to compensating no more than +! 100 ppm, currently only one workaround is possible: +! Compile your own kernel and adjust linux/include/linux/timex.h, +! line 67 (in pl14): +! +! #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +! +! Since this is surely not true for your hardware, adjust the hundreds +! to match your quartz. Adding 100 compensates for a drift of -83.8 ppm +! (1/CLOCK_TICK_RATE). The number gets rounded to the nearest 100 so don't +! bother to tune any finer. +! +! Fixing tickadj is already in my work queue, so the previous comment should be +! obsolete RSN. If you really need to run xntp on any earlier versions of the +! kernel or libc, or have any other question not covered in the READMEs / hint +! files (sorry, necessary comment in the Linux community ;-) feel free to ask +! me (duwe@informatik.uni-erlangen.de) +! +! xntp3.3b of 1993/12/06 : remember to change #define ntp_adjtime adjtimex to +! __adjtimex in the Linux section (line 316). This is hopefully done if you +! (don't :-) see this paragraph in the xntp3.x distribution. +--- 1,9 ---- + +! Requirements: kernel 0.99.14y or newer, libc 4.5.8 or newer + ------------ + +! With this configuration, xntp should build an run right out of the box +! (see generic hints for how-to). If you really need to run xntp on any earlier +! versions of the kernel or libc, or have any other question not covered in the +! READMEs / hint files (sorry, necessary comment in the Linux community ;-) feel +! free to ask me (duwe@informatik.uni-erlangen.de) +diff -c include/ntp.h:1.1.1.17 include/ntp.h:3.23 +*** include/ntp.h:1.1.1.17 Wed Feb 2 18:11:18 1994 +--- include/ntp.h Wed Feb 2 18:11:18 1994 +*************** +*** 612,617 **** +--- 612,620 ---- + struct mon_data *hash_prev; /* previous structure in hash list */ + struct mon_data *mru_next; /* next structure in MRU list */ + struct mon_data *mru_prev; /* previous structure in MRU list */ ++ struct mon_data *fifo_next; /* next structure in FIFO list */ ++ struct mon_data *fifo_prev; /* previous structure in FIFO list */ ++ U_LONG lastdrop; /* last time dropped due to RES_LIMIT*/ + U_LONG lasttime; /* last time data updated */ + U_LONG firsttime; /* time structure initialized */ + U_LONG count; /* count we have seen */ +*************** +*** 621,627 **** + u_char version; /* version of incoming packet */ + }; + +! + /* + * Structure used for restrictlist entries + */ +--- 624,635 ---- + u_char version; /* version of incoming packet */ + }; + +! /* +! * Values used with mon_enabled to indicate reason for enabling monitoring +! */ +! #define MON_OFF 0x00 /* no monitoring */ +! #define MON_ON 0x01 /* monitoring explicitly enabled */ +! #define MON_RES 0x02 /* implicit monitoring for RES_LIMITED */ + /* + * Structure used for restrictlist entries + */ +*************** +*** 645,654 **** + #define RES_NOPEER 0x20 /* don't allocate memory resources */ + #define RES_NOTRAP 0x40 /* don't allow him to set traps */ + #define RES_LPTRAP 0x80 /* traps set by him are low priority */ + + #define RES_ALLFLAGS \ + (RES_IGNORE|RES_DONTSERVE|RES_DONTTRUST|RES_NOQUERY\ +! |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP) + + /* + * Match flags +--- 653,663 ---- + #define RES_NOPEER 0x20 /* don't allocate memory resources */ + #define RES_NOTRAP 0x40 /* don't allow him to set traps */ + #define RES_LPTRAP 0x80 /* traps set by him are low priority */ ++ #define RES_LIMITED 0x100 /* limit per net number of clients */ + + #define RES_ALLFLAGS \ + (RES_IGNORE|RES_DONTSERVE|RES_DONTTRUST|RES_NOQUERY\ +! |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED) + + /* + * Match flags +diff -c include/ntp_request.h:1.1.1.7 include/ntp_request.h:3.7 +*** include/ntp_request.h:1.1.1.7 Wed Feb 2 18:11:27 1994 +--- include/ntp_request.h Wed Feb 2 18:11:28 1994 +*************** +*** 429,438 **** +--- 429,456 ---- + U_LONG processed; /* packets processed */ + U_LONG badauth; /* packets dropped because of authorization */ + U_LONG wanderhold; ++ U_LONG limitrejected; /* rejected because of client limitation */ + }; + + + /* ++ * System stats - old version ++ */ ++ struct old_info_sys_stats { ++ U_LONG timeup; /* time we have been up and running */ ++ U_LONG timereset; /* time since these were last cleared */ ++ U_LONG badstratum; /* packets claiming an invalid stratum */ ++ U_LONG oldversionpkt; /* old version packets received */ ++ U_LONG newversionpkt; /* new version packets received */ ++ U_LONG unknownversion; /* don't know version packets */ ++ U_LONG badlength; /* packets with bad length */ ++ U_LONG processed; /* packets processed */ ++ U_LONG badauth; /* packets dropped because of authorization */ ++ U_LONG wanderhold; ++ }; ++ ++ ++ /* + * Peer memory statistics. Collected in the peer module. + */ + struct info_mem_stats { +*************** +*** 546,551 **** +--- 564,570 ---- + struct info_monitor { + U_LONG lasttime; /* last packet from this host */ + U_LONG firsttime; /* first time we received a packet */ ++ U_LONG lastdrop; /* last time we rejected a packet due to client limitation policy */ + U_LONG count; /* count of packets received */ + U_LONG addr; /* host address */ + u_short port; /* port number of last reception */ +*************** +*** 553,558 **** +--- 572,589 ---- + u_char version; /* version number of last packet */ + }; + ++ /* ++ * Structure used for returning monitor data (old format ++ */ ++ struct old_info_monitor { ++ U_LONG lasttime; /* last packet from this host */ ++ U_LONG firsttime; /* first time we received a packet */ ++ U_LONG count; /* count of packets received */ ++ U_LONG addr; /* host address */ ++ u_short port; /* port number of last reception */ ++ u_char mode; /* mode of last packet */ ++ u_char version; /* version number of last packet */ ++ }; + + /* + * Structure used for passing indication of flags to clear +diff -c include/ntp_stdlib.h:1.1.1.7 include/ntp_stdlib.h:1.2 +*** include/ntp_stdlib.h:1.1.1.7 Wed Feb 2 18:11:31 1994 +--- include/ntp_stdlib.h Wed Feb 2 18:11:31 1994 +*************** +*** 79,84 **** +--- 79,85 ---- + extern char * mfptoa P((U_LONG, U_LONG, int)); + extern char * mfptoms P((U_LONG, U_LONG, int)); + extern char * modetoa P((int)); ++ extern U_LONG netof P((U_LONG)); + extern char * numtoa P((U_LONG)); + extern char * numtohost P((U_LONG)); + extern int octtoint P((const char *, U_LONG *)); +diff -c include/ntpd.h:1.1.1.7 include/ntpd.h:1.6 +*** include/ntpd.h:1.1.1.7 Wed Feb 2 18:11:38 1994 +--- include/ntpd.h Wed Feb 2 18:11:38 1994 +*************** +*** 93,100 **** + + /* ntp_monitor.c */ + extern void init_mon P((void)); +! extern void mon_start P((void)); +! extern void mon_stop P((void)); + extern void monitor P((struct recvbuf *)); + + /* ntp_peer.c */ +--- 93,100 ---- + + /* ntp_monitor.c */ + extern void init_mon P((void)); +! extern void mon_start P((int)); +! extern void mon_stop P((int)); + extern void monitor P((struct recvbuf *)); + + /* ntp_peer.c */ +diff -c lib/Makefile.tmpl:1.1.1.14 lib/Makefile.tmpl:3.25 +*** lib/Makefile.tmpl:1.1.1.14 Wed Feb 2 18:12:06 1994 +--- lib/Makefile.tmpl Wed Feb 2 18:12:07 1994 +*************** +*** 31,37 **** + uglydate.c uinttoa.c utvtoa.c machines.c clocktypes.c \ + md5.c a_md5encrypt.c a_md5decrypt.c \ + a_md512crypt.c decodenetnum.c systime.c msyslog.c syssignal.c \ +! findconfig.c + + OBJS= atoint.o atolfp.o atouint.o auth12crypt.o authdecrypt.o authdes.o \ + authencrypt.o authkeys.o authparity.o authreadkeys.o authusekey.o \ +--- 31,37 ---- + uglydate.c uinttoa.c utvtoa.c machines.c clocktypes.c \ + md5.c a_md5encrypt.c a_md5decrypt.c \ + a_md512crypt.c decodenetnum.c systime.c msyslog.c syssignal.c \ +! findconfig.c netof.c + + OBJS= atoint.o atolfp.o atouint.o auth12crypt.o authdecrypt.o authdes.o \ + authencrypt.o authkeys.o authparity.o authreadkeys.o authusekey.o \ +*************** +*** 44,50 **** + uglydate.o uinttoa.o utvtoa.o machines.o clocktypes.o \ + md5.o a_md5encrypt.o a_md5decrypt.o \ + a_md512crypt.o decodenetnum.o systime.o msyslog.o syssignal.o \ +! findconfig.o + + $(LIBNAME).a: $(OBJS) + ar rv $@ $? +--- 44,50 ---- + uglydate.o uinttoa.o utvtoa.o machines.o clocktypes.o \ + md5.o a_md5encrypt.o a_md5decrypt.o \ + a_md512crypt.o decodenetnum.o systime.o msyslog.o syssignal.o \ +! findconfig.o netof.o + + $(LIBNAME).a: $(OBJS) + ar rv $@ $? +diff -c /dev/null lib/netof.c:3.1 +*** /dev/null Wed Feb 2 18:13:07 1994 +--- lib/netof.c Wed Feb 2 18:13:07 1994 +*************** +*** 0 **** +--- 1,25 ---- ++ /* ++ * netof - return the net address part of an ip address ++ * (zero out host part) ++ */ ++ #include ++ ++ #include "ntp_fp.h" ++ #include "ntp_stdlib.h" ++ ++ U_LONG ++ netof(num) ++ U_LONG num; ++ { ++ register U_LONG netnum; ++ ++ netnum = num; ++ ++ if(IN_CLASSC(netnum)) ++ netnum &= IN_CLASSC_NET; ++ else if (IN_CLASSB(netnum)) ++ netnum &= IN_CLASSB_NET; ++ else /* treat als other like class A */ ++ netnum &= IN_CLASSA_NET; ++ return netnum; ++ } +diff -c /dev/null parse/README.new_clocks:3.2 +*** /dev/null Wed Feb 2 18:14:30 1994 +--- parse/README.new_clocks Wed Feb 2 18:14:30 1994 +*************** +*** 0 **** +--- 1,203 ---- ++ Here is an attempt to scetch out what you need to do in order to ++ add another clock to the parse driver: ++ ++ Prerequsites: ++ - Does the system you want the clock connect to have ++ termio.h or termios.h ? (You need that for the parse driver) ++ ++ What to do: ++ ++ Make a conversion module (parse/clk_*.c) ++ ++ - 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 */ ++ 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 the 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_LEAP LEAP 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) ++ ++ Conversion is done in the cvt_* routine in parse/clk_*.c files. look in ++ them for examples. The basic structure is: ++ ++ struct clockformat _format = { ++ lots of field for you to fill out (see below) ++ }; ++ ++ static cvt_() ++ ... ++ { ++ if () { ++ return CVT_NONE; ++ } else { ++ if () { ++ ; ++ 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 ++ { ++ unsigned LONG (*convert)(); ++ /* conversion routine - your routine - cvt_ */ ++ void (*syncevt)(); ++ /* routine for handling RS232 sync events (time stamps) - usually sync_simple */ ++ unsigned LONG (*syncpps)(); ++ /* PPS input routine - usually pps_simple */ ++ unsigned LONG (*synth)(); ++ /* time code synthesizer - usually not used - (LONG (*)())0 */ ++ 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 */ ++ unsigned LONG flags; ++ /* information for the parser what to look for */ ++ struct timeval timeout; ++ /* buffer restart after timeout (us) - some clocks preceede new data by ++ a longer period of silence - unsually not used */ ++ unsigned char startsym; ++ /* start symbol - character at the beginning of the clock data */ ++ unsigned char endsym; ++ /* end symbol - character at the end of the clock data */ ++ unsigned char syncsym; ++ /* sync symbol - character that is "on time" - where the time stamp should be taken */ ++ }; ++ ++ The flags: ++ F_START use startsym to find the beginning of the clock data ++ F_END use endsym to find the end of the clock data ++ SYNC_TIMEOUT packet restart after timeout in timeout field ++ SYNC_START packet start is sync event (time stamp at paket start) ++ SYNC_END packet end is sync event (time stamp at paket end) ++ SYNC_CHAR special character (syncsym) is sync event ++ SYNC_ONE PPS synchronize on 'ONE' transition ++ SYNC_ZERO PPS synchronize on 'ZERO' transition ++ SYNC_SYNTHESIZE generate intermediate time stamps (very special case!) ++ CVT_FIXEDONLY convert only in fixed configuration - (data format not ++ suitable for auto-configuration) ++ ++ ++ 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 referenc to the clockformat ++ structure must be put into parse_conf.c. ++ ++ ++ ++ TTY setup and initialisation/configuration will be done in ++ xntpd/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 xntpd/refclock_parse.c fill out a new the struct clockinfo element ++ (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_NOPOLLONLY always do async io - read whenever input comes ++ PARSE_F_POLLONLY never do async io - only read when expecting data ++ 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_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 rottdelay estimate (usually 0) ++ U_LONG cl_basedelay; /* current offset - unsigned l_fp fractional par ++ time (fraction) by which the RS232 time code is delayed from the actual time. ++ t */ ++ 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_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. ++ } clockinfo[] = { ++ ...,,... ++ { < 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 closet to your and tweak that ++ code. ++ Two sorts of clocks are used with parse. Clocks that automatically sent ++ thier time code (once a second) do not nee entries in the poll routines because ++ they sent the data all the time. The second sort are the clocks that need a ++ command sent to then in order to reply with a time code (like the Trimble ++ clock). ++ ++ For questions: kardel@informatik.uni-erlangen.de. 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 -c /dev/null parse/README.parse_clocks:3.1 +*** /dev/null Wed Feb 2 18:14:33 1994 +--- parse/README.parse_clocks Wed Feb 2 18:14:33 1994 +*************** +*** 0 **** +--- 1,263 ---- ++ The parse driver currently supports several clock 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 xntpd/refclock_parse.c files). ++ ++ --- ++ Meinberg: 127.127.8. 0- 3 (PZF535TCXO) ++ 127.127.8. 4- 7 (PZF535OCXO) ++ 127.127.8. 8-11 (DCFUA31) ++ 127.127.8.28-31 (GPS166) ++ Meinberg: start=, end=, 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. ++ ++ 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 clock is run at datagram once per second. ++ Stock dataformat is: ++ ++ D:

..;T:;U:::; ++ 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 ++ ++ = '\002' ASCII start of text ++ = '\003' ASCII end of text ++
,, = day, month, year(2 digits!!) ++ = day of week (sunday= 0) ++ ,, = hour, minute, second ++ = '#' if never synced since powerup else ' ' for DCF U/A 31 ++ '#' if not PZF sychronisation available else ' ' for PZF 535 ++ = '*' if time comes from internal quartz else ' ' ++ = 'S' if daylight saving time is active else ' ' ++ = '!' during the hour preceeding an daylight saving time ++ start/end change ++ ++ For the university of Erlangen a special format was implemented to support ++ LEAP announcement and anouncement of alternate antenna. ++ ++ Version for UNI-ERLANGEN Software is: PZFUERL V4.6 (Meinberg) ++ ++ The use of this software release (or higher) is *ABSOLUTELY* ++ recommended (ask for PZFUERL version as some minor HW fixes have ++ been introduced) due to the LEAP second support and UTC indication. ++ The standard timecode does not indicate when the timecode is in ++ UTC (by front panel configuration) thus we have no chance to find ++ the correct utc offset. For the standard format do not ever use ++ UTC display as this is not detectable in the time code !!! ++ ++
..; ; ::; ++ 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 ++ = '\002' ASCII start of text ++ = '\003' ASCII end of text ++
,, = day, month, year(2 digits!!) ++ = day of week (sunday= 0) ++ ,, = hour, minute, second ++ = 'U' UTC time display ++ = '#' if never synced since powerup else ' ' for DCF U/A 31 ++ '#' if not PZF sychronisation available else ' ' for PZF 535 ++ = '*' if time comes from internal quartz else ' ' ++ = 'S' if daylight saving time is active else ' ' ++ = '!' during the hour preceeding an daylight saving time ++ start/end change ++ = 'A' LEAP second announcement ++ = 'R' alternate antenna ++ ++ Meinberg GPS166 receiver ++ ++ You must get the Uni-Erlangen firmware for the GPS receiver support ++ to work to full satisfaction ! ++ ++
..; ; ::; <+/-><00:00>; ; ++ * ++ 000000000111111111122222222223333333333444444444455555555556666666 ++ 123456789012345678901234567890123456789012345678901234567890123456 ++ \x0209.07.93; 5; 08:48:26; +00:00; ; 49.5736N 11.0280E 373m\x03 ++ * ++ ++ = '\002' ASCII start of text ++ = '\003' ASCII end of text ++
,, = day, month, year(2 digits!!) ++ = day of week (sunday= 0) ++ ,, = hour, minute, second ++ <+/->,<00:00> = offset to UTC ++ = '#' if never synced since powerup else ' ' for DCF U/A 31 ++ '#' if not PZF sychronisation available else ' ' for PZF 535 ++ = 'U' UTC time display ++ = '*' if time comes from internal quartz else ' ' ++ = 'S' if daylight saving time is active else ' ' ++ = '!' during the hour preceeding an daylight saving time ++ start/end change ++ = 'A' LEAP second announcement ++ = 'R' alternate antenna (reminiscent of PZF535) usually ' ' ++ = 'L' on 23:59:60 ++ ++ ++ For the Meinberg parse look into clock_meinberg.c ++ ++ --- ++ RAWDCF: 127.127.8.20-23 (Conrad receiver module - delay 210ms) ++ 127.127.8.24-27 (FAU receiver - delay 258ms) ++ 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, Maerz 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: 127.127.8.16-19 ++ 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: 127.127.8.32-35 ++ 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: 127.127.8.12-15 ++ 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 ++ +diff -c parse/parsesolaris.c:1.1.1.5 parse/parsesolaris.c:3.11 +*** parse/parsesolaris.c:1.1.1.5 Wed Feb 2 18:14:49 1994 +--- parse/parsesolaris.c Wed Feb 2 18:14:49 1994 +*************** +*** 65,71 **** + { + "parse", /* module name */ + &parseinfo, /* module information */ +! 0, /* not clean yet */ + /* lock ptr */ + }; + +--- 65,71 ---- + { + "parse", /* module name */ + &parseinfo, /* module information */ +! D_NEW, /* not clean yet */ + /* lock ptr */ + }; + +diff -c scripts/support/bin/monl:1.1.1.1 scripts/support/bin/monl:1.2 +*** scripts/support/bin/monl:1.1.1.1 Wed Feb 2 18:16:01 1994 +--- scripts/support/bin/monl Wed Feb 2 18:16:01 1994 +*************** +*** 143,149 **** + { + chop; + split; +! ($host, $count, $mode, $version, $lasttime, $firsttime) = (@_[$[, $[+2 .. $[+6]); + + $Seen{$host, $mode} = 1; + +--- 143,150 ---- + { + chop; + split; +! ($host, $count, $mode, $version, $lasttime, $firsttime) = +! (@_[$[, $[+2 .. $[+4, $#_-1,$#_]); + + $Seen{$host, $mode} = 1; + +diff -c util/tickadj.c:1.1.1.16 util/tickadj.c:3.17 +*** util/tickadj.c:1.1.1.16 Wed Feb 2 18:16:23 1994 +--- util/tickadj.c Wed Feb 2 18:16:23 1994 +*************** +*** 1,4 **** +! /* tickadj.c,v 3.1 1993/07/06 01:11:05 jbj Exp + * tickadj - read, and possibly modify, the kernel `tick' and + * `tickadj' variables, as well as `dosynctodr'. Note that + * this operates on the running kernel only. I'd like to be +--- 1,4 ---- +! /* + * tickadj - read, and possibly modify, the kernel `tick' and + * `tickadj' variables, as well as `dosynctodr'. Note that + * this operates on the running kernel only. I'd like to be +*************** +*** 6,11 **** +--- 6,46 ---- + * mastered this yet. + */ + #include ++ ++ #ifdef SYS_LINUX ++ #include ++ ++ struct timex txc; ++ ++ int ++ main(int argc, char ** argv) ++ { ++ if (argc > 2) ++ { ++ fprintf(stderr, "Usage: %s [tick_value]\n", argv[0]); ++ exit(-1); ++ } ++ else if (argc == 2) ++ { ++ if ( (txc.tick = atoi(argv[1])) < 1 ) ++ { ++ fprintf(stderr, "Silly value for tick: %s\n", argv[1]); ++ exit(-1); ++ } ++ txc.mode = ADJ_TICK; ++ } ++ else ++ txc.mode = 0; ++ ++ if (__adjtimex(&txc) < 0) ++ perror("adjtimex"); ++ else ++ printf("tick = %d\n", txc.tick); ++ ++ return(0); ++ } ++ #else /* not Linux... kmem tweaking: */ ++ + #include + #include + #include +*************** +*** 513,515 **** +--- 548,551 ---- + exit(1); + } + } ++ #endif /* not Linux */ +diff -c xntpd/ntp_config.c:1.1.1.19 xntpd/ntp_config.c:3.24 +*** xntpd/ntp_config.c:1.1.1.19 Wed Feb 2 18:16:36 1994 +--- xntpd/ntp_config.c Wed Feb 2 18:16:37 1994 +*************** +*** 58,63 **** +--- 58,64 ---- + * statsdir /var/NTP/ + * filegen peerstats [ file peerstats ] [ type day ] [ link ] + * resolver /path/progname ++ * netlimit integer + * + * And then some. See the manual page. + */ +*************** +*** 94,99 **** +--- 95,102 ---- + #define CONFIG_PIDFILE 25 + #define CONFIG_LOGFILE 26 + #define CONFIG_SETVAR 27 ++ #define CONFIG_CLIENTLIMIT 28 ++ #define CONFIG_CLIENTPERIOD 29 + + #define CONF_MOD_VERSION 1 + #define CONF_MOD_KEY 2 +*************** +*** 114,119 **** +--- 117,123 ---- + #define CONF_RES_NOTRAP 8 + #define CONF_RES_LPTRAP 9 + #define CONF_RES_NTPPORT 10 ++ #define CONF_RES_LIMITED 11 + + #define CONF_TRAP_PORT 1 + #define CONF_TRAP_INTERFACE 2 +*************** +*** 179,184 **** +--- 183,190 ---- + { "pidfile", CONFIG_PIDFILE }, + { "logfile", CONFIG_LOGFILE }, + { "setvar", CONFIG_SETVAR }, ++ { "clientlimit", CONFIG_CLIENTLIMIT }, ++ { "clientperiod", CONFIG_CLIENTPERIOD }, + { "", CONFIG_UNKNOWN } + }; + +*************** +*** 217,222 **** +--- 223,229 ---- + { "notrap", CONF_RES_NOTRAP }, + { "lowpriotrap", CONF_RES_LPTRAP }, + { "ntpport", CONF_RES_NTPPORT }, ++ { "limited", CONF_RES_LIMITED }, + { "", CONFIG_UNKNOWN } + }; + +*************** +*** 817,825 **** + errflg = 0; + if (ntokens >= 2) { + if (STREQ(tokens[1], "yes")) +! mon_start(); + else if (STREQ(tokens[1], "no")) +! mon_stop(); + else + errflg++; + } else { +--- 824,832 ---- + errflg = 0; + if (ntokens >= 2) { + if (STREQ(tokens[1], "yes")) +! mon_start(MON_ON); + else if (STREQ(tokens[1], "no")) +! mon_stop(MON_ON); + else + errflg++; + } else { +*************** +*** 965,970 **** +--- 972,981 ---- + peerkey |= RESM_NTPONLY; + break; + ++ case CONF_RES_LIMITED: ++ peerversion |= RES_LIMITED; ++ break; ++ + case CONFIG_UNKNOWN: + errflg++; + break; +*************** +*** 1413,1418 **** +--- 1424,1483 ---- + set_sys_var(tokens[1], strlen(tokens[1])+1, RW | + ((((ntokens > 2) && !strcmp(tokens[2], "default"))) ? DEF : 0)); + } ++ break; ++ ++ case CONFIG_CLIENTLIMIT: ++ if (ntokens < 2) ++ { ++ syslog(LOG_ERR, ++ "no value for clientlimit command - line ignored"); ++ } ++ else ++ { ++ U_LONG i; ++ if (!atouint(tokens[1], &i) || !i) ++ { ++ syslog(LOG_ERR, ++ "illegal value for clientlimit command - line ignored"); ++ } ++ else ++ { ++ extern U_LONG client_limit; ++ char bp[80]; ++ ++ sprintf(bp, "client_limit=%d", i); ++ set_sys_var(bp, strlen(bp)+1, RO); ++ ++ client_limit = i; ++ } ++ } ++ break; ++ ++ case CONFIG_CLIENTPERIOD: ++ if (ntokens < 2) ++ { ++ syslog(LOG_ERR, ++ "no value for clientperiod command - line ignored"); ++ } ++ else ++ { ++ U_LONG i; ++ if (!atouint(tokens[1], &i) || i < 64) ++ { ++ syslog(LOG_ERR, ++ "illegal value for clientperiod command - line ignored"); ++ } ++ else ++ { ++ extern U_LONG client_limit_period; ++ char bp[80]; ++ ++ sprintf(bp, "client_limit_period=%d", i); ++ set_sys_var(bp, strlen(bp)+1, RO); ++ ++ client_limit_period = i; ++ } ++ } + break; + } + } +diff -c xntpd/ntp_monitor.c:1.1.1.10 xntpd/ntp_monitor.c:3.9 +*** xntpd/ntp_monitor.c:1.1.1.10 Wed Feb 2 18:16:48 1994 +--- xntpd/ntp_monitor.c Wed Feb 2 18:16:48 1994 +*************** +*** 58,64 **** + static struct mon_data *mon_hash; /* Pointer to array of hash buckets */ + static int *mon_hash_count; /* Point to hash count stats keeper */ + struct mon_data mon_mru_list; +! + /* + * List of free structures structures, and counters of free and total + * structures. The free structures are linked with the hash_next field. +--- 58,64 ---- + static struct mon_data *mon_hash; /* Pointer to array of hash buckets */ + static int *mon_hash_count; /* Point to hash count stats keeper */ + struct mon_data mon_mru_list; +! struct mon_data mon_fifo_list; + /* + * List of free structures structures, and counters of free and total + * structures. The free structures are linked with the hash_next field. +*************** +*** 93,99 **** + * Don't do much of anything here. We don't allocate memory + * until someone explicitly starts us. + */ +! mon_enabled = 0; + mon_have_memory = 0; + + mon_free_mem = 0; +--- 93,99 ---- + * Don't do much of anything here. We don't allocate memory + * until someone explicitly starts us. + */ +! mon_enabled = MON_OFF; + mon_have_memory = 0; + + mon_free_mem = 0; +*************** +*** 103,108 **** +--- 103,109 ---- + mon_hash = 0; + mon_hash_count = 0; + memset((char *)&mon_mru_list, 0, sizeof mon_mru_list); ++ memset((char *)&mon_fifo_list, 0, sizeof mon_fifo_list); + } + + +*************** +*** 110,122 **** + * mon_start - start up the monitoring software + */ + void +! mon_start() + { + register struct mon_data *md; + register int i; + +! if (mon_enabled) + return; + + if (!mon_have_memory) { + mon_hash = (struct mon_data *) +--- 111,128 ---- + * mon_start - start up the monitoring software + */ + void +! mon_start(mode) +! int mode; + { + register struct mon_data *md; + register int i; + +! if (mon_enabled != MON_OFF) { +! mon_enabled |= mode; + return; ++ } ++ if (mode == MON_OFF) ++ return; /* Ooops.. */ + + if (!mon_have_memory) { + mon_hash = (struct mon_data *) +*************** +*** 142,148 **** + mon_mru_list.mru_next = &mon_mru_list; + mon_mru_list.mru_prev = &mon_mru_list; + +! mon_enabled = 1; + } + + +--- 148,157 ---- + mon_mru_list.mru_next = &mon_mru_list; + mon_mru_list.mru_prev = &mon_mru_list; + +! mon_fifo_list.fifo_next = &mon_fifo_list; +! mon_fifo_list.fifo_prev = &mon_fifo_list; +! +! mon_enabled = mode; + } + + +*************** +*** 150,161 **** + * mon_stop - stop the monitoring software + */ + void +! mon_stop() + { + register struct mon_data *md; + register int i; + +! if (!mon_enabled) + return; + + /* +--- 159,177 ---- + * mon_stop - stop the monitoring software + */ + void +! mon_stop(mode) +! int mode; + { + register struct mon_data *md; + register int i; + +! if (mon_enabled == MON_OFF) +! return; +! if ((mon_enabled & mode) == 0 || mode == MON_OFF) +! return; +! +! mon_enabled &= ~mode; +! if (mon_enabled != MON_OFF) + return; + + /* +*************** +*** 176,182 **** + mon_mru_list.mru_next = &mon_mru_list; + mon_mru_list.mru_prev = &mon_mru_list; + +! mon_enabled = 0; + } + + +--- 192,199 ---- + mon_mru_list.mru_next = &mon_mru_list; + mon_mru_list.mru_prev = &mon_mru_list; + +! mon_fifo_list.fifo_next = &mon_fifo_list; +! mon_fifo_list.fifo_prev = &mon_fifo_list; + } + + +*************** +*** 194,200 **** + register int mode; + register struct mon_data *mdhash; + +! if (!mon_enabled) + return; + + pkt = &rbufp->recv_pkt; +--- 211,217 ---- + register int mode; + register struct mon_data *mdhash; + +! if (mon_enabled == MON_OFF) + return; + + pkt = &rbufp->recv_pkt; +*************** +*** 220,225 **** +--- 237,243 ---- + md->mru_prev = &mon_mru_list; + mon_mru_list.mru_next->mru_prev = md; + mon_mru_list.mru_next = md; ++ + return; + } + md = md->hash_next; +*************** +*** 240,245 **** +--- 258,269 ---- + md->hash_next->hash_prev = md->hash_prev; + md->hash_prev->hash_next = md->hash_next; + *(mon_hash_count + MON_HASH(md->rmtadr)) -= 1; ++ /* ++ * Get it from FIFO list ++ */ ++ md->fifo_prev->fifo_next = md->fifo_next; ++ md->fifo_next->fifo_prev = md->fifo_prev; ++ + } else { + if (mon_free_mem == 0) + mon_getmoremem(); +*************** +*** 252,257 **** +--- 276,282 ---- + * Got one, initialize it + */ + md->lasttime = md->firsttime = current_time; ++ md->lastdrop = 0; + md->count = 1; + md->rmtadr = netnum; + md->rmtport = NSRCPORT(&rbufp->recv_srcadr); +*************** +*** 260,266 **** + + /* + * Shuffle him into the hash table, inserting him at the +! * end. Also put him on top of the MRU list. + */ + mdhash = mon_hash + MON_HASH(netnum); + md->hash_next = mdhash; +--- 285,292 ---- + + /* + * Shuffle him into the hash table, inserting him at the +! * end. Also put him on top of the MRU list +! * and at bottom of FIFO list + */ + mdhash = mon_hash + MON_HASH(netnum); + md->hash_next = mdhash; +*************** +*** 273,278 **** +--- 299,309 ---- + md->mru_prev = &mon_mru_list; + mon_mru_list.mru_next->mru_prev = md; + mon_mru_list.mru_next = md; ++ ++ md->fifo_prev = mon_fifo_list.fifo_prev; ++ md->fifo_next = &mon_fifo_list; ++ mon_fifo_list.fifo_prev->fifo_next = md; ++ mon_fifo_list.fifo_prev = md; + } + + +diff -c xntpd/ntp_proto.c:1.1.1.19 xntpd/ntp_proto.c:3.21 +*** xntpd/ntp_proto.c:1.1.1.19 Wed Feb 2 18:16:51 1994 +--- xntpd/ntp_proto.c Wed Feb 2 18:16:52 1994 +*************** +*** 49,54 **** +--- 49,55 ---- + U_LONG sys_processed; /* packets processed */ + U_LONG sys_badauth; /* packets dropped because of authorization */ + U_LONG sys_wanderhold; /* sys_peer held to prevent wandering */ ++ U_LONG sys_limitrejected; /* pkts rejected due toclient count per net */ + + /* + * Imported from ntp_timer.c +*************** +*** 373,378 **** +--- 374,394 ---- + return; + + /* ++ * See if we only accept limited number of clients ++ * from the net this guy is from. ++ * Note: the flag is determined dynamically within restrictions() ++ */ ++ if (restrict & RES_LIMITED) { ++ extern U_LONG client_limit; ++ ++ sys_limitrejected++; ++ syslog(LOG_NOTICE, ++ "rejected mode %d request from %s - per net client limit (%d) exceeded", ++ PKT_MODE(pkt->li_vn_mode), ++ ntoa(&rbufp->recv_srcadr), client_limit); ++ return; ++ } ++ /* + * Dump anything with a putrid stratum. These will most likely + * come from someone trying to poll us with ntpdc. + */ +*************** +*** 2165,2168 **** +--- 2181,2185 ---- + sys_badauth = 0; + sys_wanderhold = 0; + sys_stattime = current_time; ++ sys_limitrejected = 0; + } +diff -c xntpd/ntp_request.c:1.1.1.14 xntpd/ntp_request.c:3.15 +*** xntpd/ntp_request.c:1.1.1.14 Wed Feb 2 18:16:55 1994 +--- xntpd/ntp_request.c Wed Feb 2 18:16:55 1994 +*************** +*** 916,921 **** +--- 916,922 ---- + extern U_LONG sys_processed; + extern U_LONG sys_badauth; + extern U_LONG sys_wanderhold; ++ extern U_LONG sys_limitrejected; + + ss = (struct info_sys_stats *)prepare_pkt(srcadr, inter, inpkt, + sizeof(struct info_sys_stats)); +*************** +*** 930,936 **** + ss->processed = htonl(sys_processed); + ss->badauth = htonl(sys_badauth); + ss->wanderhold = htonl(sys_wanderhold); +! + (void) more_pkt(); + flush_pkt(); + } +--- 931,937 ---- + ss->processed = htonl(sys_processed); + ss->badauth = htonl(sys_badauth); + ss->wanderhold = htonl(sys_wanderhold); +! ss->limitrejected = htonl(sys_limitrejected); + (void) more_pkt(); + flush_pkt(); + } +*************** +*** 1311,1317 **** + struct interface *inter; + struct req_pkt *inpkt; + { +! mon_start(); + req_ack(srcadr, inter, inpkt, INFO_OKAY); + } + +--- 1312,1318 ---- + struct interface *inter; + struct req_pkt *inpkt; + { +! mon_start(MON_ON); + req_ack(srcadr, inter, inpkt, INFO_OKAY); + } + +*************** +*** 1325,1331 **** + struct interface *inter; + struct req_pkt *inpkt; + { +! mon_stop(); + req_ack(srcadr, inter, inpkt, INFO_OKAY); + } + +--- 1326,1332 ---- + struct interface *inter; + struct req_pkt *inpkt; + { +! mon_stop(MON_ON); + req_ack(srcadr, inter, inpkt, INFO_OKAY); + } + +*************** +*** 1497,1502 **** +--- 1498,1507 ---- + md = md->mru_next) { + im->lasttime = htonl(current_time - md->lasttime); + im->firsttime = htonl(current_time - md->firsttime); ++ if (md->lastdrop) ++ im->lastdrop = htonl(current_time - md->lastdrop); ++ else ++ im->lastdrop = 0; + im->count = htonl(md->count); + im->addr = md->rmtadr; + im->port = md->rmtport; +diff -c xntpd/ntp_restrict.c:1.1.1.10 xntpd/ntp_restrict.c:3.10 +*** xntpd/ntp_restrict.c:1.1.1.10 Wed Feb 2 18:16:57 1994 +--- xntpd/ntp_restrict.c Wed Feb 2 18:16:57 1994 +*************** +*** 1,4 **** +! /* ntp_restrict.c,v 3.1 1993/07/06 01:11:28 jbj Exp + * ntp_restrict.c - find out what restrictions this host is running under + */ + #include +--- 1,4 ---- +! /* + * ntp_restrict.c - find out what restrictions this host is running under + */ + #include +*************** +*** 60,65 **** +--- 60,80 ---- + U_LONG res_timereset; + + /* ++ * Parameters of the RES_LIMITED restriction option. ++ * client_limit is the number of hosts allowed per source net ++ * client_limit_period is the number of seconds after which an entry ++ * is no longer considered for client limit determination ++ */ ++ U_LONG client_limit; ++ U_LONG client_limit_period; ++ /* ++ * count number of restriction entries referring to RES_LIMITED ++ * controls activation/deactivation of monitoring ++ * (with respect ro RES_LIMITED control) ++ */ ++ U_LONG res_limited_refcnt; ++ ++ /* + * Our initial allocation of list entries. + */ + static struct restrictlist resinit[INITRESLIST]; +*************** +*** 70,81 **** +--- 85,102 ---- + extern U_LONG current_time; + + /* ++ * debug flag ++ */ ++ extern int debug; ++ ++ /* + * init_restrict - initialize the restriction data structures + */ + void + init_restrict() + { + register int i; ++ char bp[80]; + + /* + * Zero the list and put all but one on the free list +*************** +*** 108,113 **** +--- 129,146 ---- + res_found = 0; + res_not_found = 0; + res_timereset = 0; ++ ++ /* ++ * set default values for RES_LIMIT functionality ++ */ ++ client_limit = 3; ++ client_limit_period = 3600; ++ res_limited_refcnt = 0; ++ ++ sprintf(bp, "client_limit=%d", client_limit); ++ set_sys_var(bp, strlen(bp)+1, RO); ++ sprintf(bp, "client_limit_period=%d", client_limit_period); ++ set_sys_var(bp, strlen(bp)+1, RO); + } + + +*************** +*** 150,155 **** +--- 183,302 ---- + else + res_found++; + ++ /* ++ * The following implements limiting the number of clients ++ * accepted from a given network. The notion of "same network" ++ * is determined by the mask and addr fields of the restrict ++ * list entry. The monitor mechanism has to be enabled for ++ * collecting info on current clients. ++ * ++ * The policy is as follows: ++ * - take the list of clients recorded ++ * from the given "network" seen within the last ++ * client_limit_period seconds ++ * - if there are at most client_limit entries: ++ * --> access allowed ++ * - otherwise sort by time first seen ++ * - current client among the first client_limit seen ++ * hosts? ++ * if yes: access allowed ++ * else: eccess denied ++ */ ++ if (match->flags & RES_LIMITED) { ++ int lcnt; ++ struct mon_data *md, *this_client; ++ extern int mon_enabled; ++ extern struct mon_data mon_fifo_list, mon_mru_list; ++ ++ #ifdef DEBUG ++ if (debug > 2) ++ printf("limited clients check: %d clients, period %d seconds, net is 0x%X\n", ++ client_limit, client_limit_period, ++ netof(hostaddr)); ++ #endif /*DEBUG*/ ++ if (mon_enabled == MON_OFF) { ++ #ifdef DEBUG ++ if (debug > 4) ++ printf("no limit - monitoring is off\n"); ++ #endif ++ return (int)(match->flags & ~RES_LIMITED); ++ } ++ ++ /* ++ * How nice, MRU list provides our current client as the ++ * first entry in the list. ++ * Monitoring was verified to be active above, thus we ++ * know an entry for our client must exist, or some ++ * brain dead set the memory limit for mon entries to ZERO!!! ++ */ ++ this_client = mon_mru_list.mru_next; ++ ++ for (md = mon_fifo_list.fifo_next,lcnt = 0; ++ md != &mon_fifo_list; ++ md = md->fifo_next) { ++ if ((current_time - md->lasttime) ++ > client_limit_period) { ++ #ifdef DEBUG ++ if (debug > 5) ++ printf("checking: %s: ignore: too old: %d\n", ++ numtoa(md->rmtadr), ++ current_time - md->lasttime); ++ #endif ++ continue; ++ } ++ if (md->mode == MODE_BROADCAST || ++ md->mode == MODE_CONTROL || ++ md->mode == MODE_PRIVATE) { ++ #ifdef DEBUG ++ if (debug > 5) ++ printf("checking: %s: ignore mode %d\n", ++ numtoa(md->rmtadr), ++ md->mode); ++ #endif ++ continue; ++ } ++ if (netof(md->rmtadr) != ++ netof(hostaddr)) { ++ #ifdef DEBUG ++ if (debug > 5) ++ printf("checking: %s: different net 0x%X\n", ++ numtoa(md->rmtadr), ++ netof(md->rmtadr)); ++ #endif ++ continue; ++ } ++ lcnt++; ++ if (lcnt > client_limit || ++ md->rmtadr == hostaddr) { ++ #ifdef DEBUG ++ if (debug > 5) ++ printf("considering %s: found host\n", ++ numtoa(md->rmtadr)); ++ #endif ++ break; ++ } ++ #ifdef DEBUG ++ else { ++ if (debug > 5) ++ printf("considering %s: same net\n", ++ numtoa(md->rmtadr)); ++ } ++ #endif ++ ++ } ++ #ifdef DEBUG ++ if (debug > 4) ++ printf("this one is rank %d in list, limit is %d: %s\n", ++ lcnt, client_limit, ++ (lcnt <= client_limit) ? "ALLOW" : "REJECT"); ++ #endif ++ if (lcnt <= client_limit) { ++ this_client->lastdrop = 0; ++ return (int)(match->flags & ~RES_LIMITED); ++ } else { ++ this_client->lastdrop = current_time; ++ } ++ } + return (int)match->flags; + } + +*************** +*** 257,262 **** +--- 404,413 ---- + rlprev->next = rl; + restrictcount++; + } ++ if ((rl->flags ^ (u_short)flags) & RES_LIMITED) { ++ res_limited_refcnt++; ++ mon_start(MON_RES); /* ensure data gets collected */ ++ } + rl->flags |= (u_short)flags; + break; + +*************** +*** 265,272 **** + * Remove some bits from the flags. If we didn't + * find this one, just return. + */ +! if (rl != 0) + rl->flags &= (u_short)~flags; + break; + + case RESTRICT_REMOVE: +--- 416,429 ---- + * Remove some bits from the flags. If we didn't + * find this one, just return. + */ +! if (rl != 0) { +! if ((rl->flags ^ (u_short)flags) & RES_LIMITED) { +! res_limited_refcnt--; +! if (res_limited_refcnt == 0) +! mon_stop(MON_RES); +! } + rl->flags &= (u_short)~flags; ++ } + break; + + case RESTRICT_REMOVE: +*************** +*** 280,285 **** +--- 437,447 ---- + && !(rl->mflags & RESM_INTERFACE)) { + rlprev->next = rl->next; + restrictcount--; ++ if (rl->flags & RES_LIMITED) { ++ res_limited_refcnt--; ++ if (res_limited_refcnt == 0) ++ mon_stop(MON_RES); ++ } + memset((char *)rl, 0, sizeof(struct restrictlist)); + + rl->next = resfree; +diff -c xntpd/ntp_unixclock.c:1.1.1.27 xntpd/ntp_unixclock.c:3.29 +*** xntpd/ntp_unixclock.c:1.1.1.27 Wed Feb 2 18:17:00 1994 +--- xntpd/ntp_unixclock.c Wed Feb 2 18:17:01 1994 +*************** +*** 556,568 **** + #endif /* SOLARIS */ + + #ifdef SYS_LINUX +! /* XXX should look this up somewhere ! */ + static void + clock_parms(tickadj, tick) + U_LONG *tickadj; + U_LONG *tick; + { +! *tickadj = (U_LONG)1; +! *tick = (U_LONG)10000; + } + #endif /* SYS_LINUX */ +--- 556,573 ---- + #endif /* SOLARIS */ + + #ifdef SYS_LINUX +! #include + static void + clock_parms(tickadj, tick) + U_LONG *tickadj; + U_LONG *tick; + { +! struct timex txc; +! +! txc.mode = 0; +! __adjtimex(&txc); +! +! *tickadj = (U_LONG)1; /* our adjtime is accurate */ +! *tick = (U_LONG)txc.tick; + } + #endif /* SYS_LINUX */ +diff -c xntpdc/ntpdc_ops.c:1.1.1.12 xntpdc/ntpdc_ops.c:3.16 +*** xntpdc/ntpdc_ops.c:1.1.1.12 Wed Feb 2 18:17:35 1994 +--- xntpdc/ntpdc_ops.c Wed Feb 2 18:17:36 1994 +*************** +*** 846,853 **** + if (!check1item(items, fp)) + return; + +! if (!checkitemsize(itemsize, sizeof(struct info_sys_stats))) + return; + + (void) fprintf(fp, "system uptime: %d\n", + ntohl(ss->timeup)); +--- 846,857 ---- + if (!check1item(items, fp)) + return; + +! if (itemsize != sizeof(struct info_sys_stats) && +! itemsize != sizeof(struct old_info_sys_stats)) { +! /* issue warning according to new structure size */ +! checkitemsize(itemsize, sizeof(struct info_sys_stats)); + return; ++ } + + (void) fprintf(fp, "system uptime: %d\n", + ntohl(ss->timeup)); +*************** +*** 869,874 **** +--- 873,883 ---- + ntohl(ss->badauth)); + (void) fprintf(fp, "wander hold downs: %d\n", + ntohl(ss->wanderhold)); ++ if (itemsize != sizeof(struct info_sys_stats)) ++ return; ++ ++ (void) fprintf(fp, "limitation rejects: %d\n", ++ ntohl(ss->limitrejected)); + } + + +*************** +*** 1243,1248 **** +--- 1252,1258 ---- + { "nopeer", RES_NOPEER }, + { "notrap", RES_NOTRAP }, + { "lptrap", RES_LPTRAP }, ++ { "limited", RES_LIMITED }, + { "", 0 } + }; + +*************** +*** 1463,1468 **** +--- 1473,1479 ---- + FILE *fp; + { + struct info_monitor *ml; ++ struct old_info_monitor *oml; + int items; + int itemsize; + int res; +*************** +*** 1476,1498 **** + if (!checkitems(items, fp)) + return; + +! if (!checkitemsize(itemsize, sizeof(struct info_monitor))) +! return; + +! (void) fprintf(fp, +! " address port count mode version lasttime firsttime\n"); +! (void) fprintf(fp, +! "=====================================================================\n"); +! while (items > 0) { +! (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u\n", +! nntohost(ml->addr), +! ntohs(ml->port), +! ntohl(ml->count), +! ml->mode, ml->version, +! ntohl(ml->lasttime), +! ntohl(ml->firsttime)); +! ml++; +! items--; + } + } + +--- 1487,1535 ---- + if (!checkitems(items, fp)) + return; + +! if (itemsize == sizeof(struct info_monitor)) { + +! (void) fprintf(fp, +! " address port count mode version lastdrop lasttime firsttime\n"); +! (void) fprintf(fp, +! "===============================================================================\n"); +! while (items > 0) { +! (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u %9u\n", +! nntohost(ml->addr), +! ntohs(ml->port), +! ntohl(ml->count), +! ml->mode, +! ml->version, +! ntohl(ml->lastdrop), +! ntohl(ml->lasttime), +! ntohl(ml->firsttime)); +! ml++; +! items--; +! } +! } else { +! if (itemsize != sizeof(struct old_info_monitor)) { +! /* issue warning according to new info_monitor size */ +! checkitemsize(itemsize, sizeof(struct info_monitor)); +! return; +! } +! +! oml = (struct old_info_monitor *)ml; +! (void) fprintf(fp, +! " address port count mode version lasttime firsttime\n"); +! (void) fprintf(fp, +! "======================================================================\n"); +! while (items > 0) { +! (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u\n", +! nntohost(oml->addr), +! ntohs(oml->port), +! ntohl(oml->count), +! oml->mode, +! oml->version, +! ntohl(oml->lasttime), +! ntohl(oml->firsttime)); +! oml++; +! items--; +! } + } + } + diff --git a/usr.sbin/xntpd/patches/patch.11 b/usr.sbin/xntpd/patches/patch.11 new file mode 100644 index 000000000000..8554d88fae5e --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.11 @@ -0,0 +1,536 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa05908; 9 Feb 94 18:18 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa21398; + 9 Feb 94 18:13 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA29809 (5.65c-6/7.3v-FAU); Thu, 10 Feb 1994 00:12:50 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA11633 (5.65c-6/7.3m-FAU); Thu, 10 Feb 1994 00:12:46 +0100 +From: Frank Kardel +Message-Id: <199402092312.AA11633@faui43.informatik.uni-erlangen.de> +Subject: .zz Patches +To: Mills@udel.edu +Date: Thu, 10 Feb 94 0:12:41 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, + Paul_Vixie@corpmis.sjc.hw.sony.com, Piete.Brooks@cl.cam.ac.uk +X-Mailer: ELM [version 2.3 PL11] + +Guys, + +Ok, here are some patches (including some WWVB cleanup 8-) relative +to the zz version. The KERNEL stuff in ntp_timex.h must still +be resolved. + +diff -c Makefile:1.1.1.11 Makefile:3.46 +*** Makefile:1.1.1.11 Wed Feb 9 23:54:57 1994 +--- Makefile Wed Feb 9 23:54:57 1994 +*************** +*** 162,168 **** + FRC: + + savebin: +! @test -d bin || mkdir bin + @echo + @echo '### saving $(TARGETS) $(OPTTARG) in bin' + -@for f in $(TARGETS) $(OPTTARG); \ +--- 162,168 ---- + FRC: + + savebin: +! -@test -d bin || mkdir bin + @echo + @echo '### saving $(TARGETS) $(OPTTARG) in bin' + -@for f in $(TARGETS) $(OPTTARG); \ +diff -c include/ntp_machine.h:1.1.1.11 include/ntp_machine.h:1.27 +*** include/ntp_machine.h:1.1.1.11 Wed Feb 9 23:56:27 1994 +--- include/ntp_machine.h Wed Feb 9 23:56:27 1994 +*************** +*** 274,280 **** + #ifndef STR_SYSTEM + #define STR_SYSTEM "UNIX/Ultrix" + #endif +- #define HAVE_TERMIOS + #endif + + /* +--- 274,279 ---- +diff -c lib/systime.c:1.1.1.11 lib/systime.c:1.9 +*** lib/systime.c:1.1.1.11 Wed Feb 9 23:57:45 1994 +--- lib/systime.c Wed Feb 9 23:57:45 1994 +*************** +*** 47,58 **** + * We also remember the clock precision we computed from the kernel in + * case someone asks us. + */ + LONG adj_precision; /* adj precision in usec (tickadj) */ + LONG tvu_maxslew; /* maximum adjust doable in 1< +Message-Id: <199402111326.AA24390@faui43.informatik.uni-erlangen.de> +Subject: Re: Beep, beep, beep +To: Mills@udel.edu +Date: Fri, 11 Feb 94 14:26:25 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, + Paul_Vixie@corpmis.sjc.hw.sony.com, Piete.Brooks@cl.cam.ac.uk +In-Reply-To: <9402101138.aa10259@huey.udel.edu>; from "Mills@udel.edu" at Feb 10, 94 11:38 am +X-Mailer: ELM [version 2.3 PL11] + + +> Frank, + +> In the latest xntp3.3zz.tar.Z the Ultrix kernel finds joy of clock. +> (Whew). + +Ok, I just dug out an old allocation failure in xntpdc. While +reading respones the input buffer might be realloced(and MOVED) without +telling the rest of the system. This was fatal when stdio needed a +buffer for non terminal operation. Net result was confused output. + +Ok, here ist the patch: + +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/xntpdc/ntpdc.c,v +retrieving revision 3.17 +diff -c -r3.17 xntpdc/ntpdc.c +*** xntpdc/ntpdc.c:3.17 1994/01/28 14:07:13 +--- xntpdc/ntpdc.c 1994/02/11 13:20:56 +*************** +*** 598,605 **** + /* + * So far, so good. Copy this data into the output array. + */ +! if ((datap + datasize) > (pktdata + pktdatasize)) + growpktdata(); + memmove(datap, (char *)rpkt.data, datasize); + datap += datasize; + if (firstpkt) { +--- 598,609 ---- + /* + * So far, so good. Copy this data into the output array. + */ +! if ((datap + datasize) > (pktdata + pktdatasize)) { +! int offset = datap - pktdata; + growpktdata(); ++ *rdata = pktdata; /* might have been realloced ! */ ++ datap = pktdata + offset; ++ } + memmove(datap, (char *)rpkt.data, datasize); + datap += datasize; + if (firstpkt) { + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.13 b/usr.sbin/xntpd/patches/patch.13 new file mode 100644 index 000000000000..17363e24ed0b --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.13 @@ -0,0 +1,68 @@ + +Received: from louie.udel.edu by huey.udel.edu id af16153; 14 Feb 94 7:27 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa27498; + 13 Feb 94 13:23 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA22387 (5.65c-6/7.3v-FAU); Sun, 13 Feb 1994 19:22:59 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA27117 (5.65c-6/7.3m-FAU); Sun, 13 Feb 1994 19:22:57 +0100 +From: Frank Kardel +Message-Id: <199402131822.AA27117@faui43.informatik.uni-erlangen.de> +Subject: compilation setup for solaris +To: mills@udel.edu +Date: Sun, 13 Feb 94 19:22:53 MET +X-Mailer: ELM [version 2.3 PL11] + +Hi, Dave. + +Just to remove some compilation noise in solaris (NTP_POSIX_SOURCE +redefined): + +For 3.3e: +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/machines/sunos5.1,v +retrieving revision 1.4 +diff -c -r1.4 machines/sunos5.1 +*** machines/sunos5.1:1.4 1994/02/01 23:30:54 +--- machines/sunos5.1 1994/02/13 18:16:24 +*************** +*** 1,6 **** + RANLIB= : + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSTREAM -DSOLARIS -DSYS_SOLARIS -DNTP_POSIX_SOURCE + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= : + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSTREAM -DSOLARIS -DSYS_SOLARIS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/machines/sunos5.2,v +retrieving revision 1.4 +diff -c -r1.4 machines/sunos5.2 +*** machines/sunos5.2:1.4 1994/02/01 23:30:56 +--- machines/sunos5.2 1994/02/13 18:16:27 +*************** +*** 1,6 **** + RANLIB= : + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSTREAM -DSOLARIS -DSYS_SOLARIS -DADJTIME_IS_ACCURATE -DNTP_POSIX_SOURCE + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= : + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSTREAM -DSOLARIS -DSYS_SOLARIS -DADJTIME_IS_ACCURATE + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.14 b/usr.sbin/xntpd/patches/patch.14 new file mode 100644 index 000000000000..775f9dae7e94 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.14 @@ -0,0 +1,116 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa16187; 14 Feb 94 7:27 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa27096; + 13 Feb 94 13:04 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA21590 (5.65c-6/7.3v-FAU); Sun, 13 Feb 1994 19:04:48 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA26947 (5.65c-6/7.3m-FAU); Sun, 13 Feb 1994 19:04:46 +0100 +From: Frank Kardel +Message-Id: <199402131804.AA26947@faui43.informatik.uni-erlangen.de> +Subject: patches for 3.3e +To: mills@udel.edu +Date: Sun, 13 Feb 94 19:04:42 MET +X-Mailer: ELM [version 2.3 PL11] + +Hi, Dave. + +Here is something to make Sequent PTX happier. +I also changed the version number from 3.3zz to 3.3e. +The patch is relative to the current 3.3e version. + +diff -c Makefile:1.1.1.12 Makefile:3.47 +*** Makefile:1.1.1.12 Sun Feb 13 18:53:06 1994 +--- Makefile Sun Feb 13 18:53:07 1994 +*************** +*** 144,150 **** + @echo '###' creating XNTPRES utility + @cd xntpres && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" + +! util/tickadj: util/Makefile FRC + @echo + @echo '###' creating TICKADJ utility + @cd util && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" +--- 144,150 ---- + @echo '###' creating XNTPRES utility + @cd xntpres && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" + +! util/tickadj: util/Makefile lib/libntp.a FRC + @echo + @echo '###' creating TICKADJ utility + @cd util && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" +diff -c VERSION:1.1.1.7 VERSION:3.12 +*** VERSION:1.1.1.7 Sun Feb 13 18:53:10 1994 +--- VERSION Sun Feb 13 18:53:10 1994 +*************** +*** 1 **** +! version=3.3zz (beta) +--- 1 ---- +! version=3.3e (beta) +diff -c authstuff/Makefile.tmpl:1.1.1.9 authstuff/Makefile.tmpl:3.12 +*** authstuff/Makefile.tmpl:1.1.1.9 Sun Feb 13 18:53:18 1994 +--- authstuff/Makefile.tmpl Sun Feb 13 18:53:18 1994 +*************** +*** 38,50 **** + all: $(PROGRAM) + + authcert: $(CRTOBJS) $(LIB) +! $(CC) $(COPTS) -o $@ $(CRTOBJS) $(LIB) + + authspeed: $(SPDOBJS) $(LIB) + $(CC) $(COPTS) -o $@ $(SPDOBJS) $(LIB) $(COMPAT) $(RESLIB) + + keyparity: $(PAROBJS) $(LIB) +! $(CC) $(COPTS) -o $@ $(PAROBJS) $(LIB) + + makeIPFP: $(IFPOBJS) + $(CC) $(COPTS) -o $@ $(IFPOBJS) +--- 38,50 ---- + all: $(PROGRAM) + + authcert: $(CRTOBJS) $(LIB) +! $(CC) $(COPTS) -o $@ $(CRTOBJS) $(LIB) $(COMPAT) $(RESLIB) + + authspeed: $(SPDOBJS) $(LIB) + $(CC) $(COPTS) -o $@ $(SPDOBJS) $(LIB) $(COMPAT) $(RESLIB) + + keyparity: $(PAROBJS) $(LIB) +! $(CC) $(COPTS) -o $@ $(PAROBJS) $(LIB) $(COMPAT) $(RESLIB) + + makeIPFP: $(IFPOBJS) + $(CC) $(COPTS) -o $@ $(IFPOBJS) +*************** +*** 68,74 **** + $(CC) $(COPTS) -o $@ $(UNXBJS) + + md5: $(MD5OBJS) +! $(CC) $(COPTS) -o $@ $(MD5OBJS) $(LIB) + + tags: + ctags *.c *.h +--- 68,74 ---- + $(CC) $(COPTS) -o $@ $(UNXBJS) + + md5: $(MD5OBJS) +! $(CC) $(COPTS) -o $@ $(MD5OBJS) $(LIB) $(COMPAT) $(RESLIB) + + tags: + ctags *.c *.h +diff -c include/ntp_machine.h:1.1.1.12 include/ntp_machine.h:1.28 +*** include/ntp_machine.h:1.1.1.12 Sun Feb 13 18:54:32 1994 +--- include/ntp_machine.h Sun Feb 13 18:54:32 1994 +*************** +*** 457,462 **** +--- 457,463 ---- + #define HAVE_READKMEM + #define UDP_WILDCARD_DELIVERY + #define NTP_POSIX_SOURCE ++ #define memmove(x, y, z) memcpy(x, y, z) + struct timezone { int __0; }; /* unused placebo */ + /* + * no comment !@! +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.15 b/usr.sbin/xntpd/patches/patch.15 new file mode 100644 index 000000000000..1ef861d502be --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.15 @@ -0,0 +1,39 @@ + +Received: from louie.udel.edu by huey.udel.edu id aq16153; 14 Feb 94 7:28 EST +Received: from jagubox.gsfc.nasa.gov by louie.udel.edu id aa24615; + 14 Feb 94 6:34 EST +Received: by jagubox.gsfc.nasa.gov (Smail3.1.28.1 #1) + id m0pW1Zk-000C8UC; Mon, 14 Feb 94 06:34 EST +Message-Id: +From: Jim Jagielski +Subject: xntp 3.3e (or is that zz ;) ) +To: Mills@udel.edu +Date: Mon, 14 Feb 1994 06:34:52 -0500 (EST) +Reply-To: Jim Jagielski +In-Reply-To: <9308051324.aa24396@huey.udel.edu> from "Mills@udel.edu" at Aug 5, 93 01:24:24 pm +X-Mailer: ELM [version 2.4 PL23] +Content-Type: text +Content-Length: 621 + +This latest version requires the NTP_NEED_BOPS define in ntp_machine.h for +A/UX: + +*** ntp_machine.h.orig Mon Feb 14 06:34:34 1994 +--- ntp_machine.h Mon Feb 14 06:20:57 1994 +*************** +*** 299,304 **** +--- 299,305 ---- + #define HAVE_BSD_TTYS + #define LOG_NTP LOG_LOCAL1 + #define HAVE_SIGNALED_IO ++ #define NTP_NEED_BOPS + #ifndef STR_SYSTEM + #define STR_SYSTEM "UNIX/AUX" + #endif +-- +#include + Jim Jagielski | + jim@jagubox.gsfc.nasa.gov | "Ahh... west and wewaxation at wast" + NASA/GSFC, Code 734.4 | Elmer Fudd + Greenbelt, MD 20771 | + diff --git a/usr.sbin/xntpd/patches/patch.16 b/usr.sbin/xntpd/patches/patch.16 new file mode 100644 index 000000000000..909f0c70c8e9 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.16 @@ -0,0 +1,267 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa25712; 15 Feb 94 17:54 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa18345; + 15 Feb 94 17:51 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA15109 (5.65c-6/7.3v-FAU); Tue, 15 Feb 1994 23:50:53 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA17375 (5.65c-6/7.3m-FAU); Tue, 15 Feb 1994 23:50:51 +0100 +From: Frank Kardel +Message-Id: <199402152250.AA17375@faui43.informatik.uni-erlangen.de> +Subject: fixed for parse kernel stuff... +To: mills@udel.edu +Date: Tue, 15 Feb 94 23:50:47 MET +X-Mailer: ELM [version 2.3 PL11] + + +Hi, Dave ! + +Here are some fixes for the PARSE kernel modules. Basically they +fix a memory leak on an open error condition and pronounce the +Solaris 2.x stream module MT safe. + +Well, actually I should put something for you to eat here 8-). + +RCS file: /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v +retrieving revision 1.1.1.7 +diff -c -r1.1.1.7 parsesolaris.c +*** parse/parsesolaris.c:1.1.1.7 1994/02/12 09:53:42 +--- parse/parsesolaris.c 1994/02/15 22:20:51 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.12 1994/02/02 17:45:35 kardel Exp + * +! * parsesolaris.c,v 3.12 1994/02/02 17:45:35 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS5.x - not fully tested - buyer beware ! - OS KILLERS may still be +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp + * +! * parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS5.x - not fully tested - buyer beware ! - OS KILLERS may still be +*************** +*** 19,25 **** + */ + + #ifndef lint +! static char rcsid[] = "parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp"; + #endif + + /* +--- 19,25 ---- + */ + + #ifndef lint +! static char rcsid[] = "parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp"; + #endif + + /* +*************** +*** 65,71 **** + { + "parse", /* module name */ + &parseinfo, /* module information */ +! D_NEW, /* not clean yet */ + /* lock ptr */ + }; + +--- 65,71 ---- + { + "parse", /* module name */ + &parseinfo, /* module information */ +! D_NEW|D_MP|D_MTQPAIR, /* exclusive for q pair */ + /* lock ptr */ + }; + +*************** +*** 139,145 **** + /*ARGSUSED*/ + int _init(void) + { +! static char revision[] = "3.12"; + char *s, *S, *t; + + /* +--- 139,145 ---- + /*ARGSUSED*/ + int _init(void) + { +! static char revision[] = "3.15"; + char *s, *S, *t; + + /* +*************** +*** 413,418 **** +--- 413,420 ---- + parse->parse_ppsclockev.tv.tv_usec = 0; + parse->parse_ppsclockev.serial = 0; + ++ qprocson(q); ++ + parseprintf(DD_OPEN,("parse: OPEN - initializing io subsystem q=%x\n", q)); + + if (!parse_ioinit(&parse->parse_io)) +*************** +*** 420,425 **** +--- 422,429 ---- + /* + * ok guys - beat it + */ ++ qprocsoff(q); ++ + kmem_free((caddr_t)parse, sizeof(parsestream_t)); + + parsebusy--; +*************** +*** 441,447 **** + */ + if (!notice) + { +! printf("%s: Copyright (c) 1991-1993, Frank Kardel\n", modlstrmod.strmod_linkinfo); + notice = 1; + } + +--- 445,451 ---- + */ + if (!notice) + { +! printf("%s: Copyright (c) 1991-1994, Frank Kardel\n", modlstrmod.strmod_linkinfo); + notice = 1; + } + +*************** +*** 449,455 **** +--- 453,464 ---- + } + else + { ++ qprocsoff(q); ++ ++ kmem_free((caddr_t)parse, sizeof(parsestream_t)); ++ + parsebusy--; ++ + return EIO; + } + } +*************** +*** 462,467 **** +--- 471,478 ---- + + parseprintf(DD_CLOSE,("parse: CLOSE\n")); + ++ qprocsoff(q); ++ + s = splhigh(); + + if (parse->parse_dqueue) +*************** +*** 1178,1184 **** + /* + * History: + * +! * parsesolaris.c,v + * Revision 3.12 1994/02/02 17:45:35 kardel + * rcs ids fixed + * +--- 1189,1204 ---- + /* + * History: + * +! * parsesolaris.c,v +! * Revision 3.15 1994/02/15 22:20:51 kardel +! * rcsid fixed +! * +! * Revision 3.14 1994/02/15 22:06:04 kardel +! * added qprocsx & flags for MT capability +! * +! * Revision 3.13 1994/02/13 19:16:47 kardel +! * updated verbose Copyright message +! * + * Revision 3.12 1994/02/02 17:45:35 kardel + * rcs ids fixed + * +RCS file: /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v +retrieving revision 1.1.1.8 +diff -c -r1.1.1.8 parsestreams.c +*** parse/parsestreams.c:1.1.1.8 1994/02/12 09:53:45 +--- parse/parsestreams.c 1994/02/15 22:39:50 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.14 1994/02/02 17:45:38 kardel Exp + * +! * parsestreams.c,v 3.14 1994/02/02 17:45:38 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.16 1994/02/15 22:39:50 kardel Exp + * +! * parsestreams.c,v 3.16 1994/02/15 22:39:50 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +*************** +*** 527,533 **** + */ + if (!notice) + { +! printf("%s: Copyright (c) 1991-1993, Frank Kardel\n", parsesync_vd.Drv_name); + notice = 1; + } + +--- 527,533 ---- + */ + if (!notice) + { +! printf("%s: Copyright (c) 1991-1994, Frank Kardel\n", parsesync_vd.Drv_name); + notice = 1; + } + +*************** +*** 535,540 **** +--- 535,542 ---- + } + else + { ++ kmem_free((caddr_t)parse, sizeof(parsestream_t)); ++ + #ifdef VDDRV + parsebusy--; + #endif +*************** +*** 1257,1263 **** + /* + * History: + * +! * parsestreams.c,v + * Revision 3.14 1994/02/02 17:45:38 kardel + * rcs ids fixed + * +--- 1259,1271 ---- + /* + * History: + * +! * parsestreams.c,v +! * Revision 3.16 1994/02/15 22:39:50 kardel +! * memory leak on open failure closed +! * +! * Revision 3.15 1994/02/13 19:16:50 kardel +! * updated verbose Copyright message +! * + * Revision 3.14 1994/02/02 17:45:38 kardel + * rcs ids fixed + * + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.17 b/usr.sbin/xntpd/patches/patch.17 new file mode 100644 index 000000000000..f98f75403a11 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.17 @@ -0,0 +1,50 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa00480; 16 Feb 94 12:17 EST +Received: from quack.kfu.com by louie.udel.edu id aa24950; 16 Feb 94 12:12 EST +Received: by quack.kfu.com id AA03532 + (5.65c8/IDA-1.4.4 for mills@udel.edu); Wed, 16 Feb 1994 09:12:04 -0800 +Date: Wed, 16 Feb 1994 09:12:04 -0800 +From: Nick Sayer +Message-Id: <199402161712.AA03532@quack.kfu.com> +To: mills@udel.edu +Subject: CHU debug patch + +I don't know what you think about this, but I thought I'd pass it +along. I'm sorry I don't have a proper 'patch' format patch, but +it should be aparent from the context where this goes in refclock_chu.c: + + return; + } + + /* + * Get the clock this applies to and a pointer to the data + */ + chu = (struct chuunit *)rbufp->recv_srcclock; + chuc = (struct chucode *)&rbufp->recv_space; + chu->responses++; + chu->lastupdate = current_time; + + /* + * Just for fun, we can debug the whole frame if + * we want. + */ + +#ifndef NO_CHU_DEBUG + syslog(LOG_DEBUG,"CHU %s packet:",(chuc->chutype==CHU_YEAR)? + "year":"time"); + for (i=0;icodechars[i]&0xf], + hexstring[chuc->codechars[i]>>4], + ctime(&(chuc->codetimes[i].tv_sec))); + c[strlen(c)-1]=0; /* ctime() adds a damn \n */ + syslog(LOG_DEBUG,"%s .%06d",c,chuc->codetimes[i].tv_usec); + } +#endif + + /* + * At this point we're assured that both halves of the + * data match because of what the kernel has done. + diff --git a/usr.sbin/xntpd/patches/patch.18 b/usr.sbin/xntpd/patches/patch.18 new file mode 100644 index 000000000000..e81eb627c859 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.18 @@ -0,0 +1,99 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa00679; 16 Feb 94 13:00 EST +Received: from spatula.csv.warwick.ac.uk by louie.udel.edu id aa26092; + 16 Feb 94 12:48 EST +Date: Wed, 16 Feb 1994 17:47:50 GMT +From: Ian Dickinson +Message-Id: <7051.199402161747@spatula.csv.warwick.ac.uk> +Received: from localhost by spatula.csv.warwick.ac.uk + id RAA07051; Wed, 16 Feb 1994 17:47:50 GMT +In-Reply-To: Mills@udel.edu + "Re: xntp sunos5 config" (Feb 16, 10:50am) +X-Mailer: Mail User's Shell (7.2.4 2/2/92) +To: Mills@udel.edu +Subject: Re: xntp sunos5 config +MIME-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII + +On Feb 16, 10:50am, Mills@udel.edu wrote: +} Subject: Re: xntp sunos5 config + +BTW, 3.3f seems to work fine on an SC2000 sunos5.3 (including the patch below) + +> Your message did not say in which file sunos5.1 or sunos5.2 or both +> you wanted the -DLOCK_PROCESS. I'll wait for your patches. + +I've never done any heavy work on a sunos5.1 machine, so I can't remember if +plock() exists there. I *think* sunso5.2 will work with it. +Perhaps it's time to create a sunos5.3 file which has -DLOCK_PROCESS and is +otherwise identical to sunos5.2, though this is getting silly for supposedly +a single SVR4-based operating system. + +As far as I'm aware, the choice between plock() and mlockall() can be done +with feature testing and doesn't need a seperate #define. + +This patch applies to 3.3b and 3.3f (with line fuzz). +I'm certainly not sure this is the best way to do this, but it does work here. +Perhaps it's worth asking around how widely this works in sunos5.x + +*** 1.1 1994/02/01 17:16:13 +--- xntpd/ntpd.c 1994/02/16 16:32:47 +*************** +*** 28,35 **** +--- 28,39 ---- + #include "ntp_stdlib.h" + + #ifdef LOCK_PROCESS ++ #ifdef SYS_SOLARIS ++ #include ++ #else + #include + #endif ++ #endif + + /* + * Signals we catch for debugging. If not debugging we ignore them. +*************** +*** 218,229 **** + if (rtprio(0, 120) < 0) + syslog(LOG_ERR, "rtprio() error: %m"); + #else +! #if defined(PROCLOCK) && defined(LOCK_PROCESS) + /* + * lock the process into memory + */ + if (plock(PROCLOCK) < 0) + syslog(LOG_ERR, "plock(): %m"); + #endif + #if defined(NTPD_PRIO) && NTPD_PRIO != 0 + /* +--- 222,243 ---- + if (rtprio(0, 120) < 0) + syslog(LOG_ERR, "rtprio() error: %m"); + #else +! #if defined(LOCK_PROCESS) +! #if defined(MCL_CURRENT) && defined(MCL_FUTURE) +! /* +! * lock the process into memory +! */ +! if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) +! syslog(LOG_ERR, "mlockall(): %m"); +! #else +! #if defined(PROCLOCK) + /* + * lock the process into memory + */ + if (plock(PROCLOCK) < 0) + syslog(LOG_ERR, "plock(): %m"); ++ #endif ++ #endif + #endif + #if defined(NTPD_PRIO) && NTPD_PRIO != 0 + /* + + + +Cheers, +-- +Ian + diff --git a/usr.sbin/xntpd/patches/patch.19 b/usr.sbin/xntpd/patches/patch.19 new file mode 100644 index 000000000000..396f16f34264 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.19 @@ -0,0 +1,599 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa08047; 17 Feb 94 15:26 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa17403; + 17 Feb 94 15:15 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA04056 (5.65c-6/7.3v-FAU); Thu, 17 Feb 1994 21:14:43 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA29721 (5.65c-6/7.3m-FAU); Thu, 17 Feb 1994 21:14:39 +0100 +From: Frank Kardel +Message-Id: <199402172014.AA29721@faui43.informatik.uni-erlangen.de> +Subject: Re: Beep, beep, beep +To: Mills@udel.edu +Date: Thu, 17 Feb 94 21:14:33 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, + Paul_Vixie@corpmis.sjc.hw.sony.com, Piete.Brooks@cl.cam.ac.uk +In-Reply-To: <9402171155.aa07032@huey.udel.edu>; from "Mills@udel.edu" at Feb 17, 94 11:55 am +X-Mailer: ELM [version 2.3 PL11] + + +> Guys, + +> Trouble with HAVE_BSD_TTYS on a VAX + +> ### creating NTP library +> cc -O -DDES -DXNTP_LITTLE_ENDIAN -DSYS_VAX -DDEBUG -DREFCLOCK -I../include -c atoint.c +> "../include/ntp_machine.h", line 570: syntax error +Yupp, nit TTY define set. + +> "atoint.c", line 12: redeclaration of ival +> "atoint.c", line 13: syntax error +> ... + +Well, I guess the trouble is more that none of the tty defines was +defined. For the sake of completeness i have added the tty defines to +(hopefully) all machine/* files. Some configurations were unknown to +me so I assumed HAVE_BSD_TTYS. Would be nice if someone could run +the whole suite 8-). +I have put the tty defines into the machine files so that the +refconf scripts can pick up the define without having to run the +preprocessor to dig out the configuration. +Hope this works. + +diff -c include/ntp_machine.h:1.1.1.13 include/ntp_machine.h:1.30 +*** include/ntp_machine.h:1.1.1.13 Thu Feb 17 20:17:59 1994 +--- include/ntp_machine.h Thu Feb 17 20:17:59 1994 +*************** +*** 44,54 **** + WHICH TERMINAL MODEL TO USE - I would assume HAVE_TERMIOS if + NTP_POSIX_SOURCE was set but can't. The + posix tty driver is too restrictive on most systems. +! It defined if you define STREAMS. + + HAVE_SYSV_TTYS - Use SYSV termio.h + HAVE_BSD_TTYS - Use BSD stty.h +- HAVE_TERMIOS - Use POSIX termios.h + + THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about + kernel mucking. +--- 44,59 ---- + WHICH TERMINAL MODEL TO USE - I would assume HAVE_TERMIOS if + NTP_POSIX_SOURCE was set but can't. The + posix tty driver is too restrictive on most systems. +! It is defined if you define STREAMS. + ++ We do not put these defines in the ntp_machine.h as some systems ++ offer multiple interfaces and refclock configuration likes to ++ peek into the configuration defines for tty model restrictions. ++ Thus all tty definitions should be in the files in the machines directory. ++ ++ HAVE_TERMIOS - Use POSIX termios.h + HAVE_SYSV_TTYS - Use SYSV termio.h + HAVE_BSD_TTYS - Use BSD stty.h + + THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about + kernel mucking. +*************** +*** 296,302 **** + #define FORCE_NTPDATE_STEP + #define RETSIGTYPE void + #define HAVE_ATT_SETPGRP +- #define HAVE_BSD_TTYS + #define LOG_NTP LOG_LOCAL1 + #define HAVE_SIGNALED_IO + #define NTP_NEED_BOPS +--- 301,306 ---- +*************** +*** 352,359 **** + #ifndef STR_SYSTEM + #define STR_SYSTEM "UNIX/BSDI" + #endif +- #define HAVE_BSD_TTYS +- #define HAVE_TERMIOS + #endif + + /* +--- 356,361 ---- +*************** +*** 441,449 **** + */ + #if defined(SYS_PTX) + #define NO_SIGNED_CHAR_DECL +- #ifndef HAVE_SYSV_TTYS +- #define HAVE_SYSV_TTYS +- #endif + #define STREAMS_TLI + #define HAVE_ATT_SETPGRP + #define HAVE_SIGNALED_IO +--- 443,448 ---- +*************** +*** 528,534 **** + #define HAVE_BSD_NICE + #define NOKMEM + #define HAVE_SIGNALED_IO +- #define HAVE_BSD_TTYS + #define NTP_SYSCALLS_STD + #define USE_PROTOTYPES + #define UDP_WILDCARD_DELIVERY +--- 527,532 ---- +*************** +*** 565,570 **** +--- 563,582 ---- + && !defined(HAVE_NO_NICE) + ERROR You_must_define_one_of_the_HAVE_xx_NICE_defines + #endif ++ ++ /* ++ * use only one tty model - no use in initialising ++ * a tty in three ways ++ * HAVE_TERMIOS is preferred over HAVE_SYSV_TTYS over HAVE_BSD_TTYS ++ */ ++ #ifdef HAVE_TERMIOS ++ #undef HAVE_BSD_TTYS ++ #undef HAVE_SYSV_TTYS ++ #endif ++ ++ #ifdef HAVE_SYSV_TTYS ++ #undef HAVE_BSD_TTYS ++ #endif + + #if !defined(HAVE_SYSV_TTYS) \ + && !defined(HAVE_BSD_TTYS) \ +diff -c machines/aux2:1.1.1.2 machines/aux2:1.4 +*** machines/aux2:1.1.1.2 Thu Feb 17 20:19:50 1994 +--- machines/aux2 Thu Feb 17 20:19:50 1994 +*************** +*** 1,6 **** + RANLIB= true # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_AUX2 + AUTHDEFS= -DDES -DMD5 -DFASTMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= true # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_AUX2 -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 -DFASTMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/aux3:1.1.1.2 machines/aux3:1.4 +*** machines/aux3:1.1.1.2 Thu Feb 17 20:19:52 1994 +--- machines/aux3 Thu Feb 17 20:19:52 1994 +*************** +*** 1,6 **** + RANLIB= true # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_AUX3 + AUTHDEFS= -DDES -DMD5 -DFASTMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= true # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_AUX3 -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 -DFASTMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/bsdi:1.1.1.4 machines/bsdi:1.6 +*** machines/bsdi:1.1.1.4 Thu Feb 17 20:19:53 1994 +--- machines/bsdi Thu Feb 17 20:19:53 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_BSDI + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= -lkvm +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_BSDI -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= -lkvm +diff -c machines/convexos10:1.1.1.2 machines/convexos10:1.3 +*** machines/convexos10:1.1.1.2 Thu Feb 17 20:19:54 1994 +--- machines/convexos10 Thu Feb 17 20:19:54 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_CONVEXOS10 + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + RESLIB= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_CONVEXOS10 -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + RESLIB= +diff -c machines/convexos9:1.1.1.2 machines/convexos9:1.3 +*** machines/convexos9:1.1.1.2 Thu Feb 17 20:19:55 1994 +--- machines/convexos9 Thu Feb 17 20:19:56 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_CONVEXOS9 + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + RESLIB= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_CONVEXOS9 -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + RESLIB= +diff -c machines/decosf1:1.1.1.2 machines/decosf1:1.4 +*** machines/decosf1:1.1.1.2 Thu Feb 17 20:19:57 1994 +--- machines/decosf1 Thu Feb 17 20:19:57 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSTREAM -DSYS_DECOSF1 + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSTREAM -DSYS_DECOSF1 -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/dell.svr4:1.1.1.1 machines/dell.svr4:1.2 +*** machines/dell.svr4:1.1.1.1 Thu Feb 17 20:19:58 1994 +--- machines/dell.svr4 Thu Feb 17 20:19:58 1994 +*************** +*** 1,7 **** + SHELL= /bin/sh + RANLIB= ls # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_SVR4 + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,7 ---- + SHELL= /bin/sh + RANLIB= ls # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_SVR4 -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/domainos:1.1.1.1 machines/domainos:1.2 +*** machines/domainos:1.1.1.1 Thu Feb 17 20:19:59 1994 +--- machines/domainos Thu Feb 17 20:19:59 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_DOMAINOS -D_INCLUDE_BSD_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_POSIX_SOURCE + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_DOMAINOS -D_INCLUDE_BSD_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_POSIX_SOURCE -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/i386:1.1.1.2 machines/i386:1.3 +*** machines/i386:1.1.1.2 Thu Feb 17 20:20:04 1994 +--- machines/i386 Thu Feb 17 20:20:05 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_I386 + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_I386 -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/i386svr4:1.1.1.3 machines/i386svr4:1.4 +*** machines/i386svr4:1.1.1.3 Thu Feb 17 20:20:05 1994 +--- machines/i386svr4 Thu Feb 17 20:20:05 1994 +*************** +*** 1,7 **** + SHELL= /bin/sh + RANLIB= ls # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_SVR4 -DSTREAMS_TLI + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,7 ---- + SHELL= /bin/sh + RANLIB= ls # ar does the work of ranlib under System V + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_SVR4 -DSTREAMS_TLI -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/mips:1.1.1.2 machines/mips:1.3 +*** machines/mips:1.1.1.2 Thu Feb 17 20:20:10 1994 +--- machines/mips Thu Feb 17 20:20:10 1994 +*************** +*** 1,7 **** + #RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK + DEFS= +! AUTHDEFS= -DDES -DMD5 -DSYS_MIPS + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= -lmld + RESLIB= +--- 1,7 ---- + #RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK + DEFS= +! AUTHDEFS= -DDES -DMD5 -DSYS_MIPS -DHAVE_BSD_TTYS + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= -lmld + RESLIB= +diff -c machines/next:1.1.1.1 machines/next:1.2 +*** machines/next:1.1.1.1 Thu Feb 17 20:20:12 1994 +--- machines/next Thu Feb 17 20:20:13 1994 +*************** +*** 1,6 **** + RANLIB= ranlib -c -s + DEFS= -DSYS_NEXT +! AUTHDEFS= -DDES -DMD5 -DFAST_MD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= + RESLIB= +--- 1,6 ---- + RANLIB= ranlib -c -s + DEFS= -DSYS_NEXT +! AUTHDEFS= -DDES -DMD5 -DFAST_MD5 -DHAVE_BSD_TTYS + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= + RESLIB= +diff -c machines/sequent:1.1.1.3 machines/sequent:1.4 +*** machines/sequent:1.1.1.3 Thu Feb 17 20:20:14 1994 +--- machines/sequent Thu Feb 17 20:20:14 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DHAVE_READ_KMEM -DSYS_SEQUENT + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DHAVE_READ_KMEM -DSYS_SEQUENT -DHAVE_BSD_TTYS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/sinix-m:1.1.1.2 machines/sinix-m:1.5 +*** machines/sinix-m:1.1.1.2 Thu Feb 17 20:20:15 1994 +--- machines/sinix-m Thu Feb 17 20:20:15 1994 +*************** +*** 1,6 **** + RANLIB= : + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_SINIXM + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +--- 1,6 ---- + RANLIB= : + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_SINIXM -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= +diff -c machines/sony:1.1.1.2 machines/sony:1.3 +*** machines/sony:1.1.1.2 Thu Feb 17 20:20:16 1994 +--- machines/sony Thu Feb 17 20:20:16 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_SONY + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= -lmld +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_SONY -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= -lmld +diff -c machines/svr4:1.1.1.4 machines/svr4:1.4 +*** machines/svr4:1.1.1.4 Thu Feb 17 20:20:20 1994 +--- machines/svr4 Thu Feb 17 20:20:20 1994 +*************** +*** 1,6 **** + SHELL= /bin/sh + RANLIB= ls # ar does the work of ranlib under System V +! DEFS= -DSYS_SVR4 -DSTREAMS_TLI + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= + DAEMONLIBS= -lnet -lnsl -lsocket -lelf +--- 1,6 ---- + SHELL= /bin/sh + RANLIB= ls # ar does the work of ranlib under System V +! DEFS= -DSYS_SVR4 -DSTREAMS_TLI -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= + DAEMONLIBS= -lnet -lnsl -lsocket -lelf +diff -c machines/vax:1.1.1.2 machines/vax:1.3 +*** machines/vax:1.1.1.2 Thu Feb 17 20:20:23 1994 +--- machines/vax Thu Feb 17 20:20:23 1994 +*************** +*** 1,6 **** + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_VAX + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= + RESLIB= +--- 1,6 ---- + RANLIB= ranlib + DEFS_LOCAL= -DREFCLOCK +! DEFS= -DSYS_VAX -DHAVE_BSD_TTYS + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= + RESLIB= +RCS file: /src/NTP/REPOSITORY/v3/parse/README.new_clocks,v +retrieving revision 1.1.1.2 +retrieving revision 3.3 +diff -c -r1.1.1.2 -r3.3 +*** parse/README.new_clocks:1.1.1.2 1994/02/12 09:53:48 +--- parse/README.new_clocks 1994/02/17 20:09:58 +*************** +*** 1,7 **** +! Here is an attempt to scetch out what you need to do in order to + add another clock to the parse driver: + +! Prerequsites: + - Does the system you want the clock connect to have + termio.h or termios.h ? (You need that for the parse driver) + +--- 1,7 ---- +! Here is an attempt to sketch out what you need to do in order to + add another clock to the parse driver: + +! Prerequisites: + - Does the system you want the clock connect to have + termio.h or termios.h ? (You need that for the parse driver) + +*************** +*** 32,38 **** + 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 the is still a + chance the the generated time is still ok. + + PARSEB_DST DST in effect (informational only) +--- 32,38 ---- + 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) +*************** +*** 53,59 **** + them for examples. The basic structure is: + + struct clockformat _format = { +! lots of field for you to fill out (see below) + }; + + static cvt_() +--- 53,59 ---- + them for examples. The basic structure is: + + struct clockformat _format = { +! lots of fields for you to fill out (see below) + }; + + static cvt_() +*************** +*** 122,132 **** + 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 referenc to the clockformat + structure must be put into parse_conf.c. + +- +- + TTY setup and initialisation/configuration will be done in + xntpd/refclock_parse.c + +--- 122,130 ---- + 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. + + TTY setup and initialisation/configuration will be done in + xntpd/refclock_parse.c + +*************** +*** 135,141 **** + termio*.h c_cflag macros. + + - in xntpd/refclock_parse.c fill out a new the struct clockinfo element +! (allocates a new "IP" address - see comments) + (see all the other clocks for example) + struct clockinfo + { +--- 133,139 ---- + termio*.h c_cflag macros. + + - in xntpd/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 + { +*************** +*** 188,199 **** + + + Well, this is very sketchy, i know. But I hope it helps a little bit. +! The best way is to look which clock comes closet to your and tweak that + code. +! Two sorts of clocks are used with parse. Clocks that automatically sent +! thier time code (once a second) do not nee entries in the poll routines because +! they sent the data all the time. The second sort are the clocks that need a +! command sent to then in order to reply with a time code (like the Trimble + clock). + + For questions: kardel@informatik.uni-erlangen.de. Please include +--- 186,197 ---- + + + 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@informatik.uni-erlangen.de. Please include +RCS file: /src/NTP/REPOSITORY/v3/parse/README.parse_clocks,v +retrieving revision 1.1.1.1 +retrieving revision 3.2 +diff -c -r1.1.1.1 -r3.2 +*** parse/README.parse_clocks:1.1.1.1 1994/01/01 00:00:00 +--- parse/README.parse_clocks 1994/02/17 20:10:02 +*************** +*** 1,4 **** +! The parse driver currently supports several clock 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 +--- 1,4 ---- +! 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 +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.2 b/usr.sbin/xntpd/patches/patch.2 new file mode 100644 index 000000000000..50a102355f7c --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.2 @@ -0,0 +1,129 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa12171; 26 Jan 94 17:04 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa15368; + 26 Jan 94 17:00 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA17953 (5.65c-6/7.3v-FAU); Wed, 26 Jan 1994 23:00:40 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA29710 (5.65c-6/7.3m-FAU); Wed, 26 Jan 1994 23:00:37 +0100 +From: Frank Kardel +Message-Id: <199401262200.AA29710@faui43.informatik.uni-erlangen.de> +Subject: Re: Solaribum +To: Mills@udel.edu +Date: Wed, 26 Jan 94 23:00:31 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, Piete.Brooks@cl.cam.ac.uk, + Paul_Vixie@corpmis.sjc.hw.sony.com +In-Reply-To: <9401261207.aa10860@huey.udel.edu>; from "Mills@udel.edu" at Jan 26, 94 12:07 pm +X-Mailer: ELM [version 2.3 PL11] + + +Sorry, guys - i tripped over a backward compatibility +variable. Thus the second patch: + +diff -c include/ntp_control.h:3.6 include/ntp_control.h:3.7 +*** include/ntp_control.h:3.6 Wed Jan 26 22:57:52 1994 +--- include/ntp_control.h Wed Jan 26 22:57:52 1994 +*************** +*** 204,210 **** + #define CP_SENT 32 + #define CP_FILTERROR 33 + #define CP_FLASH 34 +! #define CP_VARLIST 35 + + #define CP_MAXCODE CP_VARLIST + +--- 204,211 ---- + #define CP_SENT 32 + #define CP_FILTERROR 33 + #define CP_FLASH 34 +! #define CP_DISP 35 +! #define CP_VARLIST 36 + + #define CP_MAXCODE CP_VARLIST + +diff -c xntpd/ntp_control.c:3.21 xntpd/ntp_control.c:3.22 +*** xntpd/ntp_control.c:3.21 Wed Jan 26 22:58:30 1994 +--- xntpd/ntp_control.c Wed Jan 26 22:58:31 1994 +*************** +*** 175,181 **** + { CP_SENT, RO, "sent" }, /* 32 */ + { CP_FILTERROR, RO, "filterror" }, /* 33 */ + { CP_FLASH, RO, "flash" }, /* 34 */ +! { CP_VARLIST, RO, "peer_var_list" }, /* 35 */ + { 0, EOV, "" } + }; + +--- 175,182 ---- + { CP_SENT, RO, "sent" }, /* 32 */ + { CP_FILTERROR, RO, "filterror" }, /* 33 */ + { CP_FLASH, RO, "flash" }, /* 34 */ +! { CP_DISP, PADDING,"" }, /* 35 */ +! { CP_VARLIST, RO, "peer_var_list" }, /* 36 */ + { 0, EOV, "" } + }; + +*************** +*** 1298,1303 **** +--- 1299,1307 ---- + + for (k = sys_var; !(k->flags &EOV); k++) + { ++ if (k->flags & PADDING) ++ continue; ++ + i = strlen(k->text); + if (s+i+1 >= be) + break; +*************** +*** 1309,1314 **** +--- 1313,1321 ---- + + for (k = ext_sys_var; k && !(k->flags &EOV); k++) + { ++ if (k->flags & PADDING) ++ continue; ++ + ss = k->text; + if (!ss) + continue; +*************** +*** 1484,1489 **** +--- 1491,1499 ---- + + for (k = peer_var; !(k->flags &EOV); k++) + { ++ if (k->flags & PADDING) ++ continue; ++ + i = strlen(k->text); + if (s+i+1 >= be) + break; +*************** +*** 1594,1599 **** +--- 1604,1612 ---- + + for (k = clock_var; !(k->flags &EOV); k++) + { ++ if (k->flags & PADDING) ++ continue; ++ + i = strlen(k->text); + if (s+i+1 >= be) + break; +*************** +*** 1605,1610 **** +--- 1618,1626 ---- + + for (k = clock->kv_list; k && !(k->flags &EOV); k++) + { ++ if (k->flags & PADDING) ++ continue; ++ + ss = k->text; + if (!ss) + continue; +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.20 b/usr.sbin/xntpd/patches/patch.20 new file mode 100644 index 000000000000..39755074a363 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.20 @@ -0,0 +1,1031 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa03713; 20 Feb 94 10:36 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa02155; + 20 Feb 94 10:26 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA03871 (5.65c-6/7.3v-FAU); Sun, 20 Feb 1994 16:26:26 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA04409 (5.65c-6/7.3m-FAU); Sun, 20 Feb 1994 16:26:24 +0100 +From: Frank Kardel +Message-Id: <199402201526.AA04409@faui43.informatik.uni-erlangen.de> +Subject: 3.3g patches +To: mills@udel.edu +Date: Sun, 20 Feb 94 16:26:19 MET +X-Mailer: ELM [version 2.3 PL11] + +Hi, Dave, + +here are some more patches. They fix the following: + - nroff macros from John Line + - parse add/delete leap second (as opposed to just add second) + - some rcs ids + - linux support + - xntpd.8 leap variable documentation + +And here we go... + +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/compilers/linux.gcc,v +retrieving revision 1.2 +diff -c -r1.2 linux.gcc +*** 1.2 1993/10/10 23:10:03 +--- compilers/linux.gcc 1994/02/20 13:03:27 +*************** +*** 1,2 **** + COMPILER= gcc -DUSE_PROTOTYPES -Wall +! COPTS= -O6 -finline-functions -fomit-frame-pointer +--- 1,2 ---- + COMPILER= gcc -DUSE_PROTOTYPES -Wall +! COPTS= -O2 -finline-functions -fomit-frame-pointer +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/notes.txt,v +retrieving revision 1.3 +diff -c -r1.3 notes.txt +*** 1.3 1993/08/24 21:24:55 +--- doc/notes.txt 1994/02/20 11:57:24 +*************** +*** 785,791 **** + 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 slighly different encoding than the + usual interpretation: + + Value Action +--- 785,791 ---- + 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 +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/ntpdate.8,v +retrieving revision 3.0 +diff -c -r3.0 ntpdate.8 +*** 3.0 1992/08/14 15:11:44 +--- doc/ntpdate.8 1994/02/20 11:27:53 +*************** +*** 20,32 **** + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Bell System Logo is used as a dummy character. + ''' +! .tr \(bs-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(bs- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +--- 20,32 ---- + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Greek uppercase omega is used as a dummy character. + ''' +! .tr \(*W-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(*W- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/ntpq.8,v +retrieving revision 3.3 +diff -c -r3.3 ntpq.8 +*** 3.3 1993/10/22 14:26:57 +--- doc/ntpq.8 1994/02/20 11:27:55 +*************** +*** 20,32 **** + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Bell System Logo is used as a dummy character. + ''' +! .tr \(bs-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(bs- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +--- 20,32 ---- + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Greek uppercase omega is used as a dummy character. + ''' +! .tr \(*W-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(*W- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/ntptrace.8,v +retrieving revision 1.1.1.2 +diff -c -r1.1.1.2 ntptrace.8 +*** 1.1.1.2 1993/01/26 18:55:43 +--- doc/ntptrace.8 1994/02/20 11:27:58 +*************** +*** 20,32 **** + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Bell System Logo is used as a dummy character. + ''' +! .tr \(bs-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(bs- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +--- 20,32 ---- + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Greek uppercase omega is used as a dummy character. + ''' +! .tr \(*W-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(*W- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/tickadj.8,v +retrieving revision 3.0 +diff -c -r3.0 tickadj.8 +*** 3.0 1992/08/14 15:11:53 +--- doc/tickadj.8 1994/02/20 11:28:00 +*************** +*** 20,32 **** + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Bell System Logo is used as a dummy character. + ''' +! .tr \(bs-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(bs- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +--- 20,32 ---- + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Greek uppercase omega is used as a dummy character. + ''' +! .tr \(*W-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(*W- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/xntpd.8,v +retrieving revision 3.24 +diff -c -r3.24 xntpd.8 +*** 3.24 1994/02/02 16:42:25 +--- doc/xntpd.8 1994/02/20 11:57:28 +*************** +*** 20,32 **** + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Bell System Logo is used as a dummy character. + ''' +! .tr \(bs-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(bs- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +--- 20,32 ---- + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Greek uppercase omega is used as a dummy character. + ''' +! .tr \(*W-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(*W- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +*************** +*** 374,380 **** + Certain changes can be made to the + .I xntpd + server via mode 6 control messages, in particular the setting of +! leap second indications in a server with a radio clock. The + .B controlkey + statement specifies an encription key number to be used for authenticating + such messages. Omitting this statement will cause control messages +--- 374,381 ---- + Certain changes can be made to the + .I xntpd + server via mode 6 control messages, in particular the setting of +! leap second indications in a server with a radio clock. +! The + .B controlkey + statement specifies an encription key number to be used for authenticating + such messages. Omitting this statement will cause control messages +*************** +*** 1401,1406 **** +--- 1402,1432 ---- + If flag3 is set, then the sample information is dumped. + If flag4 is set, then the input data is smoothed, and all data + points are used. ++ .PP ++ .SH VARIABLES ++ Most variables used by the NTP protocol can be examined with the xntpdc ++ (mode 7 messages) and the ntpq (mode 6 messages). Currently very few variables ++ can be modified via mode 6 messages. These variables are either created with the ++ .I setvar ++ directive or the leap warning variables. The leap warning bits that can be ++ set in the ++ .B leapwarning ++ variable (up to one month ahead). Both, the ++ .B leapwarning and in the ++ .B leapindication ++ variable, have a slightly different encoding than the usual ++ .B leap ++ bits interpretation: ++ .P ++ .Ip 00 8 ++ The daemon passes the leap bits of its synchronisation source (usual mode of ++ operation). ++ .Ip 01/10 8 ++ A leap second is added/deleted (operator forced leap second). ++ .Ip 11 8 ++ Leap information from the sychronisation source is ignored (thus LEAP_NOWARNING ++ is passed on). ++ .PP + .SH FILES + .Ip /etc/ntp.conf 20 + the default name of the configuration file +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/doc/xntpdc.8,v +retrieving revision 3.4 +diff -c -r3.4 xntpdc.8 +*** 3.4 1994/02/02 15:54:14 +--- doc/xntpdc.8 1994/02/20 11:28:06 +*************** +*** 20,32 **** + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Bell System Logo is used as a dummy character. + ''' +! .tr \(bs-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(bs- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +--- 20,32 ---- + ''' + ''' Set up \*(-- to give an unbreakable dash; + ''' string Tr holds user defined translation string. +! ''' Greek uppercase omega is used as a dummy character. + ''' +! .tr \(*W-|\(bv\*(Tr + .ie n \{\ +! .ds -- \(*W- +! .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +! .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch + .ds L" "" + .ds R" "" + .ds L' ' +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/hints/linux,v +retrieving revision 1.2 +diff -c -r1.2 linux +*** 1.2 1994/02/01 23:19:26 +--- hints/linux 1994/02/20 11:26:44 +*************** +*** 1,5 **** + +! Requirements: kernel 0.99.14y or newer, libc 4.5.8 or newer + ------------ + + With this configuration, xntp should build an run right out of the box +--- 1,5 ---- + +! Requirements: kernel 0.99.14y or newer, libc 4.5.20 or newer + ------------ + + With this configuration, xntp should build an run right out of the box +*************** +*** 7,9 **** +--- 7,14 ---- + versions of the kernel or libc, or have any other question not covered in the + READMEs / hint files (sorry, necessary comment in the Linux community ;-) feel + free to ask me (duwe@informatik.uni-erlangen.de) ++ ++ [NOTE: libc-4.5.20 is (or was ? ;-) a beta testing release, but the first ++ binary compiled under the appropriate kernel. Get this one from ++ tsx-11:.../GCC/private/dontuse , compile 4.5.19 yourself or wait for the next ++ puplic relase after 4.5.20] +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/include/parse.h,v +retrieving revision 3.14 +diff -c -r3.14 parse.h +*** 3.14 1994/01/28 14:03:35 +--- include/parse.h 1994/02/20 13:04:26 +*************** +*** 81,115 **** + /* + * state flags + */ +! #define PARSEB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */ +! #define PARSEB_POWERUP 0x0002 /* no synchronisation */ +! #define PARSEB_NOSYNC 0x0004 /* timecode currently not confirmed */ +! #define PARSEB_DST 0x0008 /* DST in effect */ +! #define PARSEB_UTC 0x0010 /* UTC time */ +! #define PARSEB_LEAP 0x0020 /* LEAP warning (1 hour prior to occurence) */ +! #define PARSEB_ALTERNATE 0x0040 /* alternate antenna used */ +! #define PARSEB_POSITION 0x0080 /* position available */ +! #define PARSEB_LEAPSECOND 0x0100 /* actual leap second */ +! +! #define PARSEB_S_LEAP 0x0200 /* supports LEAP */ +! #define PARSEB_S_ANTENNA 0x0400 /* supports antenna information */ +! #define PARSEB_S_PPS 0x0800 /* supports PPS time stamping */ +! #define PARSEB_S_POSITION 0x1000 /* supports position information (GPS) */ + +! #define PARSEB_TIMECODE 0x2000 /* valid time code sample */ +! #define PARSEB_PPS 0x4000 /* valid PPS sample */ + + #define PARSE_TCINFO (PARSEB_ANNOUNCE|PARSEB_POWERUP|PARSEB_NOSYNC|PARSEB_DST|\ +! PARSEB_UTC|PARSEB_LEAP|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ + PARSEB_S_LOCATION|PARSEB_TIMECODE) + +! #define PARSE_POWERUP(x) ((x) & PARSEB_POWERUP) +! #define PARSE_NOSYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == PARSEB_NOSYNC) +! #define PARSE_SYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == 0) +! #define PARSE_ANNOUNCE(x) ((x) & PARSEB_ANNOUNCE) +! #define PARSE_DST(x) ((x) & PARSEB_DST) + #define PARSE_UTC(x) ((x) & PARSEB_UTC) +! #define PARSE_LEAP(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP)) + #define PARSE_ALTERNATE(x) ((x) & PARSEB_ALTERNATE) + #define PARSE_LEAPSECOND(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP_SECOND)) + +--- 81,135 ---- + /* + * state flags + */ +! #define PARSEB_POWERUP 0x00000001 /* no synchronisation */ +! #define PARSEB_NOSYNC 0x00000002 /* timecode currently not confirmed */ + +! /* +! * time zone information +! */ +! #define PARSEB_ANNOUNCE 0x00000010 /* switch time zone warning (DST switch) */ +! #define PARSEB_DST 0x00000020 /* DST in effect */ +! #define PARSEB_UTC 0x00000040 /* UTC time */ +! +! /* +! * leap information +! */ +! #define PARSEB_LEAPDEL 0x00000100 /* LEAP deletion warning */ +! #define PARSEB_LEAPADD 0x00000200 /* LEAP addition warning */ +! #define PARSEB_LEAPS 0x00000300 /* LEAP warnings */ +! #define PARSEB_LEAPSECOND 0x00000400 /* actual leap second */ +! /* +! * optional status information +! */ +! #define PARSEB_ALTERNATE 0x00001000 /* alternate antenna used */ +! #define PARSEB_POSITION 0x00002000 /* position available */ +! +! /* +! * feature information +! */ +! #define PARSEB_S_LEAP 0x00010000 /* supports LEAP */ +! #define PARSEB_S_ANTENNA 0x00020000 /* supports antenna information */ +! #define PARSEB_S_PPS 0x00040000 /* supports PPS time stamping */ +! #define PARSEB_S_POSITION 0x00080000 /* supports position information (GPS) */ +! +! /* +! * time stamp availality +! */ +! #define PARSEB_TIMECODE 0x10000000 /* valid time code sample */ +! #define PARSEB_PPS 0x20000000 /* valid PPS sample */ + + #define PARSE_TCINFO (PARSEB_ANNOUNCE|PARSEB_POWERUP|PARSEB_NOSYNC|PARSEB_DST|\ +! PARSEB_UTC|PARSEB_LEAPS|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ + PARSEB_S_LOCATION|PARSEB_TIMECODE) + +! #define PARSE_POWERUP(x) ((x) & PARSEB_POWERUP) +! #define PARSE_NOSYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == PARSEB_NOSYNC) +! #define PARSE_SYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == 0) +! #define PARSE_ANNOUNCE(x) ((x) & PARSEB_ANNOUNCE) +! #define PARSE_DST(x) ((x) & PARSEB_DST) + #define PARSE_UTC(x) ((x) & PARSEB_UTC) +! #define PARSE_LEAPADD(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPADD)) +! #define PARSE_LEAPDEL(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPDEL)) + #define PARSE_ALTERNATE(x) ((x) & PARSEB_ALTERNATE) + #define PARSE_LEAPSECOND(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP_SECOND)) + +*************** +*** 118,126 **** + #define PARSE_S_PPS(x) ((x) & PARSEB_S_PPS) + #define PARSE_S_POSITION(x) ((x) & PARSEB_S_POSITION) + +! #define PARSE_TIMECODE(x) ((x) & PARSEB_TIMECODE) + #define PARSE_PPS(x) ((x) & PARSEB_PPS) +! #define PARSE_POSITION(x) ((x) & PARSEB_POSITION) + + /* + * operation flags - some are also fudge flags +--- 138,146 ---- + #define PARSE_S_PPS(x) ((x) & PARSEB_S_PPS) + #define PARSE_S_POSITION(x) ((x) & PARSEB_S_POSITION) + +! #define PARSE_TIMECODE(x) ((x) & PARSEB_TIMECODE) + #define PARSE_PPS(x) ((x) & PARSEB_PPS) +! #define PARSE_POSITION(x) ((x) & PARSEB_POSITION) + + /* + * operation flags - some are also fudge flags +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/parse/README.new_clocks,v +retrieving revision 3.3 +diff -c -r3.3 README.new_clocks +*** 3.3 1994/02/17 20:09:58 +--- parse/README.new_clocks 1994/02/20 13:04:34 +*************** +*** 37,43 **** + + PARSEB_DST DST in effect (informational only) + PARSEB_UTC timecode contains UTC time (informational only) +! PARSEB_LEAP LEAP 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 +--- 37,46 ---- + + 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 +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v +retrieving revision 3.13 +diff -c -r3.13 clk_meinberg.c +*** 3.13 1994/02/02 17:45:21 +--- parse/clk_meinberg.c 1994/02/20 13:04:37 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_MEINBERG) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.13 1994/02/02 17:45:21 kardel Exp + * +! * clk_meinberg.c,v 3.13 1994/02/02 17:45:21 kardel Exp + * + * Meinberg clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_MEINBERG) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.14 1994/02/20 13:04:37 kardel Exp + * +! * clk_meinberg.c,v 3.14 1994/02/20 13:04:37 kardel Exp + * + * Meinberg clock support + * +*************** +*** 284,291 **** + clock->flags |= PARSEB_S_LEAP; + clock->flags |= PARSEB_S_ANTENNA; + + if (f[4] == 'A') +! clock->flags |= PARSEB_LEAP; + + if (f[5] == 'R') + clock->flags |= PARSEB_ALTERNATE; +--- 284,296 ---- + clock->flags |= PARSEB_S_LEAP; + clock->flags |= PARSEB_S_ANTENNA; + ++ /* ++ * DCF77 does not encode the direction - ++ * so we take the current default - ++ * earth slowing down ++ */ + if (f[4] == 'A') +! clock->flags |= PARSEB_LEAPADD; + + if (f[5] == 'R') + clock->flags |= PARSEB_ALTERNATE; +*************** +*** 394,402 **** + + /* + * oncoming leap second + */ + if (f[5] == 'A') +! clock->flags |= PARSEB_LEAP; + + /* + * this is the leap second +--- 399,410 ---- + + /* + * oncoming leap second ++ * data format does not (yet) specify whether ++ * to add or to delete a second - thus we ++ * pick the current default + */ + if (f[5] == 'A') +! clock->flags |= PARSEB_LEAPADD; + + /* + * this is the leap second +*************** +*** 413,419 **** + /* + * History: + * +! * clk_meinberg.c,v + * Revision 3.13 1994/02/02 17:45:21 kardel + * rcs ids fixed + * +--- 421,430 ---- + /* + * History: + * +! * clk_meinberg.c,v +! * Revision 3.14 1994/02/20 13:04:37 kardel +! * parse add/delete second support +! * + * Revision 3.13 1994/02/02 17:45:21 kardel + * rcs ids fixed + * +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v +retrieving revision 3.11 +diff -c -r3.11 clk_rawdcf.c +*** 3.11 1994/02/02 17:45:23 +--- parse/clk_rawdcf.c 1994/02/20 13:04:39 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.11 1994/02/02 17:45:23 kardel Exp + * +! * clk_rawdcf.c,v 3.11 1994/02/02 17:45:23 kardel Exp + * + * Raw DCF77 pulse clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.12 1994/02/20 13:04:39 kardel Exp + * +! * clk_rawdcf.c,v 3.12 1994/02/20 13:04:39 kardel Exp + * + * Raw DCF77 pulse clock support + * +*************** +*** 278,284 **** + clock->flags |= PARSEB_ANNOUNCE; + + if (ext_bf(buffer, DCF_A2, dcfparam->zerobits)) +! clock->flags |= PARSEB_LEAP; + + if (ext_bf(buffer, DCF_R, dcfparam->zerobits)) + clock->flags |= PARSEB_ALTERNATE; +--- 278,284 ---- + clock->flags |= PARSEB_ANNOUNCE; + + if (ext_bf(buffer, DCF_A2, dcfparam->zerobits)) +! clock->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ + + if (ext_bf(buffer, DCF_R, dcfparam->zerobits)) + clock->flags |= PARSEB_ALTERNATE; +*************** +*** 528,534 **** + /* + * History: + * +! * clk_rawdcf.c,v + * Revision 3.11 1994/02/02 17:45:23 kardel + * rcs ids fixed + * +--- 528,537 ---- + /* + * History: + * +! * clk_rawdcf.c,v +! * Revision 3.12 1994/02/20 13:04:39 kardel +! * parse add/delete second support +! * + * Revision 3.11 1994/02/02 17:45:23 kardel + * rcs ids fixed + * +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v +retrieving revision 3.12 +diff -c -r3.12 clk_schmid.c +*** 3.12 1994/02/02 17:45:25 +--- parse/clk_schmid.c 1994/02/20 13:04:41 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_SCHMID) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.12 1994/02/02 17:45:25 kardel Exp + * +! * clk_schmid.c,v 3.12 1994/02/02 17:45:25 kardel Exp + * + * Schmid clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_SCHMID) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.13 1994/02/20 13:04:41 kardel Exp + * +! * clk_schmid.c,v 3.13 1994/02/20 13:04:41 kardel Exp + * + * Schmid clock support + * +*************** +*** 152,158 **** + + if (buffer[8] & WS_LEAP) + { +! clock->flags |= PARSEB_LEAP; + } + } + +--- 152,158 ---- + + if (buffer[8] & WS_LEAP) + { +! clock->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ + } + } + +*************** +*** 167,173 **** + /* + * History: + * +! * clk_schmid.c,v + * Revision 3.12 1994/02/02 17:45:25 kardel + * rcs ids fixed + * +--- 167,176 ---- + /* + * History: + * +! * clk_schmid.c,v +! * Revision 3.13 1994/02/20 13:04:41 kardel +! * parse add/delete second support +! * + * Revision 3.12 1994/02/02 17:45:25 kardel + * rcs ids fixed + * +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v +retrieving revision 3.47 +diff -c -r3.47 refclock_parse.c +*** 3.47 1994/02/02 17:44:30 +--- xntpd/refclock_parse.c 1994/02/20 13:26:00 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.47 1994/02/02 17:44:30 kardel Exp + * +! * refclock_parse.c,v 3.47 1994/02/02 17:44:30 kardel Exp + * + * generic reference clock driver for receivers + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp + * +! * refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp + * + * generic reference clock driver for receivers + * +*************** +*** 129,135 **** + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp"; + #endif + + /**=========================================================================== +--- 129,135 ---- + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp"; + #endif + + /**=========================================================================== +*************** +*** 1706,1712 **** + { PARSEB_NOSYNC, "TIME CODE NOT CONFIRMED" }, + { PARSEB_DST, "DST" }, + { PARSEB_UTC, "UTC DISPLAY" }, +! { PARSEB_LEAP, "LEAP WARNING" }, + { PARSEB_LEAPSECOND, "LEAP SECOND" }, + { PARSEB_ALTERNATE,"ALTERNATE ANTENNA" }, + { PARSEB_TIMECODE, "TIME CODE" }, +--- 1706,1713 ---- + { PARSEB_NOSYNC, "TIME CODE NOT CONFIRMED" }, + { PARSEB_DST, "DST" }, + { PARSEB_UTC, "UTC DISPLAY" }, +! { PARSEB_LEAPADD, "LEAP ADD WARNING" }, +! { PARSEB_LEAPDEL, "LEAP DELETE WARNING" }, + { PARSEB_LEAPSECOND, "LEAP SECOND" }, + { PARSEB_ALTERNATE,"ALTERNATE ANTENNA" }, + { PARSEB_TIMECODE, "TIME CODE" }, +*************** +*** 2539,2547 **** + parse_leap() + { + /* +- * PARSE does encode a leap warning... we are aware but not afraid of that +- * as long as we get a little help for the direction from the operator until + * PARSE encodes the LEAP correction direction. + */ + } + +--- 2540,2549 ---- + parse_leap() + { + /* + * PARSE encodes the LEAP correction direction. ++ * For timecodes that do not pass on the leap correction direction ++ * the default PARSEB_LEAPADD must be used. It may then be modified ++ * with a fudge flag (flag2). + */ + } + +*************** +*** 2821,2827 **** + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +--- 2823,2829 ---- + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +*************** +*** 3245,3258 **** + } + else + { +! if (PARSE_LEAP(parsetime->parse_state)) + { + leap = (parse->flags & PARSE_LEAP_DELETE) ? LEAP_DELSECOND : LEAP_ADDSECOND; + } + else +! { +! leap = LEAP_NOWARNING; +! } + } + + refclock_receive(parse->peer, &off, 0, LFPTOFP(&dispersion), &reftime, &rectime, leap); +--- 3247,3270 ---- + } + else + { +! if (PARSE_LEAPADD(parsetime->parse_state)) + { ++ /* ++ * we pick this state also for time code that pass leap warnings ++ * without direction information (as earth is currently slowing ++ * down). ++ */ + leap = (parse->flags & PARSE_LEAP_DELETE) ? LEAP_DELSECOND : LEAP_ADDSECOND; + } + else +! if (PARSE_LEAPDEL(parsetime->parse_state)) +! { +! leap = LEAP_DELSECOND; +! } +! else +! { +! leap = LEAP_NOWARNING; +! } + } + + refclock_receive(parse->peer, &off, 0, LFPTOFP(&dispersion), &reftime, &rectime, leap); +*************** +*** 3395,3401 **** + /* + * History: + * +! * refclock_parse.c,v + * Revision 3.47 1994/02/02 17:44:30 kardel + * rcs ids fixed + * +--- 3407,3419 ---- + /* + * History: + * +! * refclock_parse.c,v +! * Revision 3.49 1994/02/20 13:26:00 kardel +! * rcs id cleanup +! * +! * Revision 3.48 1994/02/20 13:04:56 kardel +! * parse add/delete second support +! * + * Revision 3.47 1994/02/02 17:44:30 kardel + * rcs ids fixed + * +*** parse/util/parsetest.c Sun Feb 20 15:54:11 1994 +--- parse/util/parsetest.c Sun Feb 20 14:04:46 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/kernel/parsetest.c,v 3.4 1993/03/17 17:16:57 kardel Exp + * +! * parsetest.c,v 3.10 1994/01/23 17:22:18 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/util/parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp + * +! * parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +*************** +*** 10,26 **** + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * +! * parsetest.c,v +! * Revision 3.4 1993/03/17 17:16:57 kardel +! * DEC OSF/1 ALPHA Integration - 930314 + * +! * Revision 3.3 1993/01/18 09:24:33 kardel +! * updated copyright conditions in conjunction with +! * conditions set up in the COPYRIGHT file + * +- * Revision 3.2 1993/01/17 13:43:00 kardel +- * 1993 initial update +- * + */ + + #ifndef STREAM +--- 10,22 ---- + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * +! * parsetest.c,v +! * Revision 3.13 1994/02/20 13:04:46 kardel +! * parse add/delete second support + * +! * Revision 3.12 1994/02/02 17:45:51 kardel +! * rcs ids fixed + * + */ + + #ifndef STREAM +*************** +*** 199,205 **** + parsetime_t parsetime; + struct strioctl strioc; + +! printf("parsetest.c,v 3.10 1994/01/23 17:22:18 kardel Exp\n"); + + while (ioctl(fd, I_POP, 0) == 0) + ; +--- 195,201 ---- + parsetime_t parsetime; + struct strioctl strioc; + +! printf("parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp\n"); + + while (ioctl(fd, I_POP, 0) == 0) + ; +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v +retrieving revision 3.16 +diff -c -r3.16 parsestreams.c +*** 3.16 1994/02/15 22:39:50 +--- parse/parsestreams.c 1994/02/20 15:18:02 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.16 1994/02/15 22:39:50 kardel Exp + * +! * parsestreams.c,v 3.16 1994/02/15 22:39:50 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp + * +! * parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +*************** +*** 16,22 **** + */ + + #ifndef lint +! static char rcsid[] = "parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp"; + #endif + + #include "sys/types.h" +--- 16,22 ---- + */ + + #ifndef lint +! static char rcsid[] = "parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp"; + #endif + + #include "sys/types.h" +*************** +*** 195,201 **** + } + else + { +! static char revision[] = "3.12"; + char *s, *S, *t; + + strncpy(ifm->f_name, mname, FMNAMESZ); +--- 195,201 ---- + } + else + { +! static char revision[] = "3.17"; + char *s, *S, *t; + + strncpy(ifm->f_name, mname, FMNAMESZ); +*************** +*** 1259,1265 **** + /* + * History: + * +! * parsestreams.c,v + * Revision 3.16 1994/02/15 22:39:50 kardel + * memory leak on open failure closed + * +--- 1259,1268 ---- + /* + * History: + * +! * parsestreams.c,v +! * Revision 3.17 1994/02/20 15:18:02 kardel +! * rcs id cleanup +! * + * Revision 3.16 1994/02/15 22:39:50 kardel + * memory leak on open failure closed + * +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.21 b/usr.sbin/xntpd/patches/patch.21 new file mode 100644 index 000000000000..929997130909 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.21 @@ -0,0 +1,54 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa25363; 23 Feb 94 18:50 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa28210; + 23 Feb 94 18:44 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA07903 (5.65c-6/7.3v-FAU); Thu, 24 Feb 1994 00:44:18 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA19013 (5.65c-6/7.3m-FAU); Thu, 24 Feb 1994 00:44:17 +0100 +From: Frank Kardel +Message-Id: <199402232344.AA19013@faui43.informatik.uni-erlangen.de> +Subject: TRAK clock +To: mills@udel.edu +Date: Thu, 24 Feb 94 0:44:12 MET +X-Mailer: ELM [version 2.3 PL11] + +Hi, Dave - some obvious things about the TRAK clock: + - please removed the 4 ^A at the end of the + xntpd/reflock_trak.c file (email leftovers). + - add following refclocks/rclk.TRAK file + +#!/bin/sh - +CMD="$1" +shift; + +. refclocks/setup + +case "$CMD" in + info) + echo " TRAK - TRAK 8810 GPS station clock" + ;; + check) + if check "$RCONFIG" '$0 ~ /TRAK/'; then + echo "TRAK - TRAK 8810 GPS station clock" + fi + ;; + config) + if check "$REFCONF" '$0 ~ /TRAK/' || + ( [ ! "$REFCONF" ] && query "Include TRAK 8810 GPS station clock (TRAK)" n); then + if check "$PPSFEATURES" '$0 ~ /CD/' && + [ "$PPSOK" -eq 1 ] && + (check "$REFCONF" '$0 ~ /TRAKPPS/' || + ( [ ! "$REFCONF" ] && query " Use TRAK for PPS" n)); then + echo "-DTRAKPPS" >> $RCONFIG + else + echo "-DTRAK" >> $RCONFIG + fi + fi + ;; +esac +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.22 b/usr.sbin/xntpd/patches/patch.22 new file mode 100644 index 000000000000..8b4296c79926 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.22 @@ -0,0 +1,296 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa02110; 24 Feb 94 18:54 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa13897; + 24 Feb 94 18:53 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA27796 (5.65c-6/7.3v-FAU); Fri, 25 Feb 1994 00:53:32 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA16114 (5.65c-6/7.3m-FAU); Fri, 25 Feb 1994 00:53:31 +0100 +From: Frank Kardel +Message-Id: <199402242353.AA16114@faui43.informatik.uni-erlangen.de> +Subject: patches (parse pps/pll control) +To: mills@udel.edu +Date: Fri, 25 Feb 94 0:52:59 MET +X-Mailer: ELM [version 2.3 PL11] + +Hi, here are some patches. + +pps pll control is nor supported by parse. +pps output variable are readable via mode 6 messages. + +diff -c v3/parse/parsestreams.c:1.1.1.10 v3/parse/parsestreams.c:3.19 +*** v3/parse/parsestreams.c:1.1.1.10 Fri Feb 25 00:44:41 1994 +--- v3/parse/parsestreams.c Fri Feb 25 00:44:41 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp + * +! * parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp + * +! * parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +*************** +*** 16,22 **** + */ + + #ifndef lint +! static char rcsid[] = "parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp"; + #endif + + #include "sys/types.h" +--- 16,22 ---- + */ + + #ifndef lint +! static char rcsid[] = "parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp"; + #endif + + #include "sys/types.h" +*************** +*** 195,201 **** + } + else + { +! static char revision[] = "3.17"; + char *s, *S, *t; + + strncpy(ifm->f_name, mname, FMNAMESZ); +--- 195,201 ---- + } + else + { +! static char revision[] = "3.19"; + char *s, *S, *t; + + strncpy(ifm->f_name, mname, FMNAMESZ); +*************** +*** 1076,1081 **** +--- 1076,1086 ---- + + #define MAXDEPTH 50 /* maximum allowed stream crawl */ + ++ #ifdef PPS_SYNC ++ extern hardpps(); ++ extern struct timeval time; ++ #endif ++ + /* + * take external status interrupt (only CD interests us) + */ +*************** +*** 1087,1101 **** + register queue_t *q; + register unsigned char zsstatus; + register int loopcheck; +- register unsigned char cdstate; + register char *dname; + + /* + * pick up current state + */ + zsstatus = zsaddr->zscc_control; + +! if (za->za_rr0 ^ (cdstate = zsstatus & ZSRR0_CD)) + { + timestamp_t cdevent; + register int status; +--- 1092,1109 ---- + register queue_t *q; + register unsigned char zsstatus; + register int loopcheck; + register char *dname; ++ #ifdef PPS_SYNC ++ register int s; ++ register long usec; ++ #endif + + /* + * pick up current state + */ + zsstatus = zsaddr->zscc_control; + +! if ((za->za_rr0 ^ zsstatus) & (ZSRR0_CD|ZSRR0_SYNC)) + { + timestamp_t cdevent; + register int status; +*************** +*** 1103,1129 **** + /* + * CONDITIONAL external measurement support + */ +! SET_LED(cdstate); /* + * inconsistent with upper SET_LED, but this + * is for oscilloscope business anyway and we + * are just interested in edge delays in the + * lower us range + */ +! + /* + * time stamp + */ + uniqtime(&cdevent.tv); +! +! TIMEVAL_USADD(&cdevent.tv, xsdelay); +! +! q = za->za_ttycommon.t_readq; + + /* + * logical state + */ +! status = cd_invert ? cdstate == 0 : cdstate != 0; + + /* + * ok - now the hard part - find ourself + */ +--- 1111,1155 ---- + /* + * CONDITIONAL external measurement support + */ +! SET_LED(zsstatus & (ZSRR0_CD|ZSRR0_SYNC)); /* + * inconsistent with upper SET_LED, but this + * is for oscilloscope business anyway and we + * are just interested in edge delays in the + * lower us range + */ +! #ifdef PPS_SYNC +! s = splclock(); +! usec = time.tv_usec; +! #endif + /* + * time stamp + */ + uniqtime(&cdevent.tv); +! +! #ifdef PPS_SYNC +! splx(s); +! #endif + + /* + * logical state + */ +! status = cd_invert ? (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) == 0 : (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) != 0; + ++ #ifdef PPS_SYNC ++ if (status) ++ { ++ usec = cdevent.tv.tv_usec - usec; ++ if (usec < 0) ++ usec += 1000000; ++ ++ hardpps(&cdevent.tv, usec); ++ } ++ #endif ++ ++ TIMEVAL_USADD(&cdevent.tv, xsdelay); ++ ++ q = za->za_ttycommon.t_readq; ++ + /* + * ok - now the hard part - find ourself + */ +*************** +*** 1179,1188 **** + /* + * only pretend that CD has been handled + */ +! za->za_rr0 = za->za_rr0 & ~ZSRR0_CD | zsstatus & ZSRR0_CD; + ZSDELAY(2); + +! if (!((za->za_rr0 ^ zsstatus) & ~ZSRR0_CD)) + { + /* + * all done - kill status indication and return +--- 1205,1214 ---- + /* + * only pretend that CD has been handled + */ +! za->za_rr0 = za->za_rr0 & ~(ZSRR0_CD|ZSRR0_SYNC) | zsstatus & (ZSRR0_CD|ZSRR0_SYNC); + ZSDELAY(2); + +! if (!((za->za_rr0 ^ zsstatus) & ~(ZSRR0_CD|ZSRR0_SYNC))) + { + /* + * all done - kill status indication and return +*************** +*** 1260,1265 **** +--- 1286,1297 ---- + * History: + * + * parsestreams.c,v ++ * Revision 3.19 1994/02/24 16:33:54 kardel ++ * CD events can also be posted on sync flag ++ * ++ * Revision 3.18 1994/02/24 14:12:58 kardel ++ * initial PPS_SYNC support version ++ * + * Revision 3.17 1994/02/20 15:18:02 kardel + * rcs id cleanup + * +diff -c v3/xntpd/ntp_loopfilter.c:1.1.1.33 v3/xntpd/ntp_loopfilter.c:3.40 +*** v3/xntpd/ntp_loopfilter.c:1.1.1.33 Fri Feb 25 00:46:20 1994 +--- v3/xntpd/ntp_loopfilter.c Fri Feb 25 00:46:21 1994 +*************** +*** 522,529 **** +--- 522,545 ---- + ntv.maxerror = sys_rootdispersion + sys_rootdelay / 2; + ntv.esterror = sys_rootdispersion; + ntv.time_constant = time_constant; ++ ntv.shift = 0; + (void)ntp_adjtime(&ntv); + drift_comp = ntv.frequency; ++ if (ntv.shift != 0) { ++ char buf[128]; ++ (void) sprintf(buf, "pps_freq=%s", fptoa(ntv.ybar, 3)); ++ set_sys_var(buf, strlen(buf)+1, RO|DEF); ++ (void) sprintf(buf, "pps_disp=%s", fptoa(ntv.disp, 3)); ++ set_sys_var(buf, strlen(buf)+1, RO|DEF); ++ (void) sprintf(buf, "pps_interval=%ld",1 << ntv.shift); ++ set_sys_var(buf, strlen(buf)+1, RO); ++ (void) sprintf(buf, "pps_intervals=%ld", ntv.calcnt); ++ set_sys_var(buf, strlen(buf)+1, RO); ++ (void) sprintf(buf, "pps_jitterexceeded=%ld", ntv.jitcnt); ++ set_sys_var(buf, strlen(buf)+1, RO); ++ (void) sprintf(buf, "pps_dispersionexceeded=%ld", ntv.discnt); ++ set_sys_var(buf, strlen(buf)+1, RO); ++ } + #endif /* KERNEL_PLL */ + } else { + if (offset < 0) { +*************** +*** 725,730 **** +--- 741,748 ---- + "loop_config: skew compensation %s too large", + fptoa(tmp, 5)); + } else { ++ char var[40]; ++ + drift_comp = tmp; + + #if defined(KERNEL_PLL) +*************** +*** 751,756 **** +--- 769,778 ---- + syslog(LOG_NOTICE, + "%susing kernel phase-lock loop", + (pll_control) ? "" : "Not "); ++ (void)sprintf(var, "kernel_pll=%s", pll_control ? "true" : "false"); ++ ++ set_sys_var(var, strlen(var)+1, RO); ++ + #if DEBUG + if (debug) + printf("pll_control %d\n", pll_control); +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.23 b/usr.sbin/xntpd/patches/patch.23 new file mode 100644 index 000000000000..5fee16f35e9c --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.23 @@ -0,0 +1,80 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa18634; 27 Feb 94 13:54 EST +Received: from rincewind.mech.virginia.edu by louie.udel.edu id aa11711; + 27 Feb 94 13:53 EST +Received: from localhost (dmm0t@localhost) by rincewind.mech.virginia.edu (8.6.5/8.6.5) id NAA04646 for mills@udel.edu; Sun, 27 Feb 1994 13:53:35 -0500 +From: David Meyer +Message-Id: <199402271853.NAA04646@rincewind.mech.virginia.edu> +Subject: patches to xntpd-3.3j for NeXT +To: mills@udel.edu +Date: Sun, 27 Feb 1994 13:53:34 -0500 (EST) +X-Mailer: ELM [version 2.4 PL23] +MIME-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Length: 2043 + +I have a couple of patches to make the 3.3j beta compile on a NeXT +running NS3.1. + +The first patch just defines RETSIGTYPE. The second patch puts +HAVE_BSD_TTYS in DEFS rather than AUTHDEFS. The last patch just fixes +a type - using # rather than * in a comment block. + +*** ../orig/include/ntp_machine.h Sun Feb 20 22:23:29 1994 +--- include/ntp_machine.h Sun Feb 27 13:47:59 1994 +*************** +*** 313,318 **** +--- 313,319 ---- + * Next + */ + #if defined(SYS_NEXT) ++ #define RETSIGTYPE void + #define DOSYNCTODR + #define HAVE_READKMEM + #define HAVE_BSD_NICE + +*** ../orig/machines/next Sun Feb 20 22:23:36 1994 +--- machines/next Sun Feb 27 13:47:15 1994 +*************** +*** 1,6 **** + RANLIB= ranlib -c -s +! DEFS= -DSYS_NEXT +! AUTHDEFS= -DDES -DMD5 -DFAST_MD5 -DHAVE_BSD_TTYS + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= + RESLIB= +--- 1,6 ---- + RANLIB= ranlib -c -s +! DEFS= -DSYS_NEXT -DHAVE_BSD_TTYS +! AUTHDEFS= -DDES -DMD5 -DFAST_MD5 + CLOCKDEFS= -DLOCAL_CLOCK + DAEMONLIBS= + RESLIB= + +*** ../orig/xntpd/refclock_irig.c Thu Jan 27 09:03:58 1994 +--- xntpd/refclock_irig.c Sun Feb 27 13:36:30 1994 +*************** +*** 19,25 **** + * This driver supports the IRIG audio decoder. This clever gadget uses + * a modified BSD audio driver for the Sun SPARCstation which provides + * a timestamp, raw binary timecode, status byte and decoded ASCII +! # timecode. The data are represented in the structure: + * + * struct irig_time { + * struct timeval stamp; timestamp +--- 19,25 ---- + * This driver supports the IRIG audio decoder. This clever gadget uses + * a modified BSD audio driver for the Sun SPARCstation which provides + * a timestamp, raw binary timecode, status byte and decoded ASCII +! * timecode. The data are represented in the structure: + * + * struct irig_time { + * struct timeval stamp; timestamp + + +-- +David M. Meyer Mechanical & Aerospace Engineering +dmm0t@rincewind.mech.virginia.edu University of Virginia +NeXTmail ok + diff --git a/usr.sbin/xntpd/patches/patch.24 b/usr.sbin/xntpd/patches/patch.24 new file mode 100644 index 000000000000..6ab00e2a8391 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.24 @@ -0,0 +1,474 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa16943; 4 Mar 94 6:43 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa02686; + 4 Mar 94 6:34 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA12349 (5.65c-6/7.3v-FAU); Fri, 4 Mar 1994 12:34:08 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA26044 (5.65c-6/7.3m-FAU); Fri, 4 Mar 1994 12:34:06 +0100 +From: Frank Kardel +Message-Id: <199403041134.AA26044@faui43.informatik.uni-erlangen.de> +Subject: Re: patches for 3.3l +To: Mills@udel.edu +Date: Fri, 4 Mar 94 12:33:49 MET +In-Reply-To: <9403040253.aa16147@huey.udel.edu>; from "Mills@udel.edu" at Mar 4, 94 2:53 am +X-Mailer: ELM [version 2.3 PL11] + + +> Frank, + + +> ld: ../lib/libntp.a: warning: archive has no table of contents; add one using ranlib(1) +I didn't fiddle with lib/* this round. Thus it must be some problem +with the lib building process. Try make clean and again. I just checked +the patches with my 3.3l tree - fine. I do admit being a bit lax when +sending you the patches - you might have had to enter some paths +manually. + +> ld: Undefined symbol +> _DESauth1crypt .... +Happens if ranlib isn't run. + +> Obviously, it bombed. +Not likely being a problem from my patches - the lib/libntp.a got +inconsistent. +Usually this should not happen (ranlib need to be run on BSD systems). +Try building again from scratch (make clean all). If the problem +persists look (or send me) at the output of the lib building step +something is amiss there at your site. + +I'll include the patches here again not properly prepared for a +plain "patch < patchfile". + + +Hi, Dave, + +Here are some more patches: + - allow parse conversion routines to deliver UTC directly + - irix4 machine/cc from Amos + - rcs id fixing + - linux hints + - modload hints + - full integration of trak refclock driver (was only partially integrated) + +diff -c /dev/null compilers/irix4.cc:1.1 +*** /dev/null Thu Mar 3 10:29:50 1994 +--- compilers/irix4.cc Thu Mar 3 10:29:50 1994 +*************** +*** 0 **** +--- 1,2 ---- ++ COMPILER= cc -cckr ++ COPTS= -O2 +diff -c hints/linux:1.1.1.3 hints/linux:1.5 +*** hints/linux:1.1.1.3 Thu Mar 3 10:30:53 1994 +--- hints/linux Thu Mar 3 10:30:53 1994 +*************** +*** 1,5 **** + +! Requirements: kernel 0.99.14y or newer, libc 4.5.20 or newer + ------------ + + With this configuration, xntp should build an run right out of the box +--- 1,5 ---- + +! Requirements: kernel 0.99.14y or newer, libc 4.5.21 or newer + ------------ + + With this configuration, xntp should build an run right out of the box +*************** +*** 7,14 **** + versions of the kernel or libc, or have any other question not covered in the + READMEs / hint files (sorry, necessary comment in the Linux community ;-) feel + free to ask me (duwe@informatik.uni-erlangen.de) +- +- [NOTE: libc-4.5.20 is (or was ? ;-) a beta testing release, but the first +- binary compiled under the appropriate kernel. Get this one from +- tsx-11:.../GCC/private/dontuse , compile 4.5.19 yourself or wait for the next +- puplic relase after 4.5.20] +--- 7,9 ---- +diff -c include/parse.h:1.1.1.8 include/parse.h:3.17 +*** include/parse.h:1.1.1.8 Thu Mar 3 10:31:37 1994 +--- include/parse.h Thu Mar 3 10:31:37 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * +! * parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp + * +! * parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +*************** +*** 15,21 **** + #ifndef __PARSE_H__ + #define __PARSE_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char parsehrcsid[]="parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp FAU"; + #endif + + #include "ntp_types.h" +--- 15,21 ---- + #ifndef __PARSE_H__ + #define __PARSE_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char parsehrcsid[]="parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp"; + #endif + + #include "ntp_types.h" +*************** +*** 301,306 **** +--- 301,307 ---- + LONG second; + LONG usecond; + LONG utcoffset; /* in seconds */ ++ time_t utctime; /* the actual time - alternative to date/time */ + LONG flags; /* current clock status */ + }; + +*************** +*** 385,390 **** +--- 386,394 ---- + * History: + * + * parse.h,v ++ * Revision 3.17 1994/03/03 09:27:20 kardel ++ * rcs ids fixed ++ * + * Revision 3.13 1994/01/25 19:04:21 kardel + * 94/01/23 reconcilation + * +diff -c parse/Makefile.kernel:1.1.1.3 parse/Makefile.kernel:3.9 +*** parse/Makefile.kernel:1.1.1.3 Thu Mar 3 10:35:48 1994 +--- parse/Makefile.kernel Thu Mar 3 10:35:48 1994 +*************** +*** 40,46 **** + rm -f parsestreams.o + + parsestreams.o: parsestreams.o.$(KARCH) +! @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o.$(KARCH)' into the kernel" + + parsestreams.o.$(KARCH): parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c $(DEFS) -I../include parsestreams.c +--- 40,46 ---- + rm -f parsestreams.o + + parsestreams.o: parsestreams.o.$(KARCH) +! @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o' (put in e.g. /sys//OBJ) into the kernel" + + parsestreams.o.$(KARCH): parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c $(DEFS) -I../include parsestreams.c +diff -c parse/README.new_clocks:1.1.1.3 parse/README.new_clocks:3.5 +*** parse/README.new_clocks:1.1.1.3 Thu Mar 3 10:35:52 1994 +--- parse/README.new_clocks Thu Mar 3 10:35:53 1994 +*************** +*** 23,28 **** +--- 23,29 ---- + LONG second; + LONG usecond; + LONG utcoffset; /* in seconds */ ++ time_t utcoffset; /* true utc time instead of date/time */ + LONG flags; /* current clock status */ + }; + +*************** +*** 52,57 **** +--- 53,65 ---- + 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: + +diff -c parse/parse.c:1.1.1.9 parse/parse.c:3.22 +*** parse/parse.c:1.1.1.9 Thu Mar 3 10:36:06 1994 +--- parse/parse.c Thu Mar 3 10:36:07 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.21 1994/02/02 17:45:30 kardel Exp + * +! * parse.c,v 3.21 1994/02/02 17:45:30 kardel Exp + * + * Parser module for reference clock + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * +! * parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * + * Parser module for reference clock + * +*************** +*** 556,561 **** +--- 556,564 ---- + register int i; + time_t t; + ++ if (clock->utctime) ++ return clock->utctime; /* if the conversion routine gets it right away - why not */ ++ + if (clock->year < 100) + clock->year += 1900; + +*************** +*** 628,633 **** +--- 631,639 ---- + t += clock->utcoffset; /* warp to UTC */ + + /* done */ ++ ++ clock->utctime = t; /* documentray only */ ++ + return t; + } + +*************** +*** 890,895 **** +--- 896,903 ---- + + if (parseio->parse_flags & PARSE_FIXED_FMT) + { ++ clock.utctime = 0; ++ + switch ((cvtrtc = clockformats[format]->convert ? clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : CVT_NONE) & CVT_MASK) + { + case CVT_FAIL: +*************** +*** 941,946 **** +--- 949,956 ---- + { + do + { ++ clock.utctime = 0; ++ + switch ((cvtrtc = (clockformats[format]->convert && !(clockformats[format]->flags & CVT_FIXEDONLY)) ? + clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : + CVT_NONE) & CVT_MASK) +*************** +*** 1148,1153 **** +--- 1158,1166 ---- + * History: + * + * parse.c,v ++ * Revision 3.22 1994/02/25 12:34:49 kardel ++ * allow for converter generated utc times ++ * + * Revision 3.21 1994/02/02 17:45:30 kardel + * rcs ids fixed + * +diff -c parse/util/testdcf.c:1.1.1.6 parse/util/testdcf.c:3.11 +*** parse/util/testdcf.c:1.1.1.6 Thu Mar 3 10:36:27 1994 +--- parse/util/testdcf.c Thu Mar 3 10:36:27 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * +! * testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * + * simple DCF77 100/200ms pulse test program (via 50Baud serial line) + * +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp + * +! * testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp + * + * simple DCF77 100/200ms pulse test program (via 50Baud serial line) + * +diff -c xntpd/Makefile.tmpl:1.1.1.18 xntpd/Makefile.tmpl:3.28 +*** xntpd/Makefile.tmpl:1.1.1.18 Thu Mar 3 10:38:13 1994 +--- xntpd/Makefile.tmpl Thu Mar 3 10:38:13 1994 +*************** +*** 34,40 **** + refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ + refclock_parse.c refclock_as2201.c refclock_omega.c \ + refclock_tpro.c refclock_leitch.c refclock_irig.c \ +! refclock_msfees.c refclock_gpstm.c ntp_intres.c ntp_filegen.c + + OBJS= ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \ + ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \ +--- 34,41 ---- + refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ + refclock_parse.c refclock_as2201.c refclock_omega.c \ + refclock_tpro.c refclock_leitch.c refclock_irig.c \ +! refclock_msfees.c refclock_gpstm.c refclock_trak.c \ +! ntp_intres.c ntp_filegen.c + + OBJS= ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \ + ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \ +*************** +*** 44,50 **** + refclock_wwvb.o refclock_goes.o refclock_mx4200.o \ + refclock_parse.o refclock_as2201.o refclock_omega.o \ + refclock_tpro.o refclock_leitch.o refclock_irig.o \ +! refclock_msfees.o refclock_gpstm.o ntp_intres.o ntp_filegen.o + + all: $(PROGRAM) + +--- 45,52 ---- + refclock_wwvb.o refclock_goes.o refclock_mx4200.o \ + refclock_parse.o refclock_as2201.o refclock_omega.o \ + refclock_tpro.o refclock_leitch.o refclock_irig.o \ +! refclock_msfees.o refclock_gpstm.o refclock_trak.o \ +! ntp_intres.o ntp_filegen.o + + all: $(PROGRAM) + +*************** +*** 136,141 **** +--- 138,146 ---- + + refclock_msfees.o: refclock_msfees.c + $(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c ++ ++ refclock_trak.o: refclock_trak.c ++ $(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c + + refclock_gpstm.o: refclock_gpstm.c + $(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c +diff -c xntpd/ntp_control.c:1.1.1.17 xntpd/ntp_control.c:3.26 +*** xntpd/ntp_control.c:1.1.1.17 Thu Mar 3 10:38:16 1994 +--- xntpd/ntp_control.c Thu Mar 3 10:38:17 1994 +*************** +*** 301,307 **** + static u_char clocktypes[] = { + CTL_SST_TS_NTP, /* REFCLK_NONE */ + CTL_SST_TS_UNSPEC, /* REFCLK_LOCALCLOCK */ +! CTL_SST_TS_HF, /* REFCLK_WWV_HEATH */ + CTL_SST_TS_HF, /* REFCLK_WWV_PST */ + CTL_SST_TS_LF, /* REFCLK_WWVB_SPECTRACOM */ + CTL_SST_TS_UHF, /* REFCLK_GOES_TRUETIME */ +--- 301,307 ---- + static u_char clocktypes[] = { + CTL_SST_TS_NTP, /* REFCLK_NONE */ + CTL_SST_TS_UNSPEC, /* REFCLK_LOCALCLOCK */ +! CTL_SST_TS_HF, /* REFCLK_GPS_TRAK */ + CTL_SST_TS_HF, /* REFCLK_WWV_PST */ + CTL_SST_TS_LF, /* REFCLK_WWVB_SPECTRACOM */ + CTL_SST_TS_UHF, /* REFCLK_GOES_TRUETIME */ +diff -c xntpd/refclock_conf.c:1.1.1.22 xntpd/refclock_conf.c:3.21 +*** xntpd/refclock_conf.c:1.1.1.22 Thu Mar 3 10:38:54 1994 +--- xntpd/refclock_conf.c Thu Mar 3 10:38:54 1994 +*************** +*** 113,119 **** + struct refclock *refclock_conf[] = { + &refclock_none, /* 0 REFCLK_NONE */ + &refclock_local, /* 1 REFCLK_LOCAL */ +! &refclock_none, /* 2 REFCLK_WWV_HEATH */ + &refclock_pst, /* 3 REFCLK_WWV_PST */ + &refclock_wwvb, /* 4 REFCLK_WWVB_SPECTRACOM */ + &refclock_goes, /* 5 REFCLK_GOES_TRUETIME */ +--- 113,119 ---- + struct refclock *refclock_conf[] = { + &refclock_none, /* 0 REFCLK_NONE */ + &refclock_local, /* 1 REFCLK_LOCAL */ +! &refclock_trak, /* 2 REFCLK_GPS_TRAK */ + &refclock_pst, /* 3 REFCLK_WWV_PST */ + &refclock_wwvb, /* 4 REFCLK_WWVB_SPECTRACOM */ + &refclock_goes, /* 5 REFCLK_GOES_TRUETIME */ +RCS file: /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v +retrieving revision 1.1.1.12 +diff -c -r1.1.1.12 xntpd/refclock_parse.c +*** xntpd/refclock_parse.c:1.1.1.12 1994/02/22 21:57:57 +--- xntpd/refclock_parse.c 1994/03/03 09:49:54 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp + * +! * refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp + * + * generic reference clock driver for receivers + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * +! * refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * + * generic reference clock driver for receivers + * +*************** +*** 129,135 **** + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp"; + #endif + + /**=========================================================================== +--- 129,135 ---- + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp"; + #endif + + /**=========================================================================== +*************** +*** 1653,1659 **** + * done if no more characters are available + */ + FD_SET(fd, &fdmask); +! if (select(fd + 1, &fdmask, 0, 0, &null_time) == 0) + return; + } + } +--- 1653,1660 ---- + * done if no more characters are available + */ + FD_SET(fd, &fdmask); +! if ((i == 0) && +! (select(fd + 1, &fdmask, 0, 0, &null_time) == 0)) + return; + } + } +*************** +*** 2823,2829 **** + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +--- 2824,2830 ---- + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.25 b/usr.sbin/xntpd/patches/patch.25 new file mode 100644 index 000000000000..6ab00e2a8391 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.25 @@ -0,0 +1,474 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa16943; 4 Mar 94 6:43 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa02686; + 4 Mar 94 6:34 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA12349 (5.65c-6/7.3v-FAU); Fri, 4 Mar 1994 12:34:08 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA26044 (5.65c-6/7.3m-FAU); Fri, 4 Mar 1994 12:34:06 +0100 +From: Frank Kardel +Message-Id: <199403041134.AA26044@faui43.informatik.uni-erlangen.de> +Subject: Re: patches for 3.3l +To: Mills@udel.edu +Date: Fri, 4 Mar 94 12:33:49 MET +In-Reply-To: <9403040253.aa16147@huey.udel.edu>; from "Mills@udel.edu" at Mar 4, 94 2:53 am +X-Mailer: ELM [version 2.3 PL11] + + +> Frank, + + +> ld: ../lib/libntp.a: warning: archive has no table of contents; add one using ranlib(1) +I didn't fiddle with lib/* this round. Thus it must be some problem +with the lib building process. Try make clean and again. I just checked +the patches with my 3.3l tree - fine. I do admit being a bit lax when +sending you the patches - you might have had to enter some paths +manually. + +> ld: Undefined symbol +> _DESauth1crypt .... +Happens if ranlib isn't run. + +> Obviously, it bombed. +Not likely being a problem from my patches - the lib/libntp.a got +inconsistent. +Usually this should not happen (ranlib need to be run on BSD systems). +Try building again from scratch (make clean all). If the problem +persists look (or send me) at the output of the lib building step +something is amiss there at your site. + +I'll include the patches here again not properly prepared for a +plain "patch < patchfile". + + +Hi, Dave, + +Here are some more patches: + - allow parse conversion routines to deliver UTC directly + - irix4 machine/cc from Amos + - rcs id fixing + - linux hints + - modload hints + - full integration of trak refclock driver (was only partially integrated) + +diff -c /dev/null compilers/irix4.cc:1.1 +*** /dev/null Thu Mar 3 10:29:50 1994 +--- compilers/irix4.cc Thu Mar 3 10:29:50 1994 +*************** +*** 0 **** +--- 1,2 ---- ++ COMPILER= cc -cckr ++ COPTS= -O2 +diff -c hints/linux:1.1.1.3 hints/linux:1.5 +*** hints/linux:1.1.1.3 Thu Mar 3 10:30:53 1994 +--- hints/linux Thu Mar 3 10:30:53 1994 +*************** +*** 1,5 **** + +! Requirements: kernel 0.99.14y or newer, libc 4.5.20 or newer + ------------ + + With this configuration, xntp should build an run right out of the box +--- 1,5 ---- + +! Requirements: kernel 0.99.14y or newer, libc 4.5.21 or newer + ------------ + + With this configuration, xntp should build an run right out of the box +*************** +*** 7,14 **** + versions of the kernel or libc, or have any other question not covered in the + READMEs / hint files (sorry, necessary comment in the Linux community ;-) feel + free to ask me (duwe@informatik.uni-erlangen.de) +- +- [NOTE: libc-4.5.20 is (or was ? ;-) a beta testing release, but the first +- binary compiled under the appropriate kernel. Get this one from +- tsx-11:.../GCC/private/dontuse , compile 4.5.19 yourself or wait for the next +- puplic relase after 4.5.20] +--- 7,9 ---- +diff -c include/parse.h:1.1.1.8 include/parse.h:3.17 +*** include/parse.h:1.1.1.8 Thu Mar 3 10:31:37 1994 +--- include/parse.h Thu Mar 3 10:31:37 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * +! * parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp + * +! * parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +*************** +*** 15,21 **** + #ifndef __PARSE_H__ + #define __PARSE_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char parsehrcsid[]="parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp FAU"; + #endif + + #include "ntp_types.h" +--- 15,21 ---- + #ifndef __PARSE_H__ + #define __PARSE_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char parsehrcsid[]="parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp"; + #endif + + #include "ntp_types.h" +*************** +*** 301,306 **** +--- 301,307 ---- + LONG second; + LONG usecond; + LONG utcoffset; /* in seconds */ ++ time_t utctime; /* the actual time - alternative to date/time */ + LONG flags; /* current clock status */ + }; + +*************** +*** 385,390 **** +--- 386,394 ---- + * History: + * + * parse.h,v ++ * Revision 3.17 1994/03/03 09:27:20 kardel ++ * rcs ids fixed ++ * + * Revision 3.13 1994/01/25 19:04:21 kardel + * 94/01/23 reconcilation + * +diff -c parse/Makefile.kernel:1.1.1.3 parse/Makefile.kernel:3.9 +*** parse/Makefile.kernel:1.1.1.3 Thu Mar 3 10:35:48 1994 +--- parse/Makefile.kernel Thu Mar 3 10:35:48 1994 +*************** +*** 40,46 **** + rm -f parsestreams.o + + parsestreams.o: parsestreams.o.$(KARCH) +! @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o.$(KARCH)' into the kernel" + + parsestreams.o.$(KARCH): parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c $(DEFS) -I../include parsestreams.c +--- 40,46 ---- + rm -f parsestreams.o + + parsestreams.o: parsestreams.o.$(KARCH) +! @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o' (put in e.g. /sys//OBJ) into the kernel" + + parsestreams.o.$(KARCH): parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c $(DEFS) -I../include parsestreams.c +diff -c parse/README.new_clocks:1.1.1.3 parse/README.new_clocks:3.5 +*** parse/README.new_clocks:1.1.1.3 Thu Mar 3 10:35:52 1994 +--- parse/README.new_clocks Thu Mar 3 10:35:53 1994 +*************** +*** 23,28 **** +--- 23,29 ---- + LONG second; + LONG usecond; + LONG utcoffset; /* in seconds */ ++ time_t utcoffset; /* true utc time instead of date/time */ + LONG flags; /* current clock status */ + }; + +*************** +*** 52,57 **** +--- 53,65 ---- + 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: + +diff -c parse/parse.c:1.1.1.9 parse/parse.c:3.22 +*** parse/parse.c:1.1.1.9 Thu Mar 3 10:36:06 1994 +--- parse/parse.c Thu Mar 3 10:36:07 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.21 1994/02/02 17:45:30 kardel Exp + * +! * parse.c,v 3.21 1994/02/02 17:45:30 kardel Exp + * + * Parser module for reference clock + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * +! * parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * + * Parser module for reference clock + * +*************** +*** 556,561 **** +--- 556,564 ---- + register int i; + time_t t; + ++ if (clock->utctime) ++ return clock->utctime; /* if the conversion routine gets it right away - why not */ ++ + if (clock->year < 100) + clock->year += 1900; + +*************** +*** 628,633 **** +--- 631,639 ---- + t += clock->utcoffset; /* warp to UTC */ + + /* done */ ++ ++ clock->utctime = t; /* documentray only */ ++ + return t; + } + +*************** +*** 890,895 **** +--- 896,903 ---- + + if (parseio->parse_flags & PARSE_FIXED_FMT) + { ++ clock.utctime = 0; ++ + switch ((cvtrtc = clockformats[format]->convert ? clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : CVT_NONE) & CVT_MASK) + { + case CVT_FAIL: +*************** +*** 941,946 **** +--- 949,956 ---- + { + do + { ++ clock.utctime = 0; ++ + switch ((cvtrtc = (clockformats[format]->convert && !(clockformats[format]->flags & CVT_FIXEDONLY)) ? + clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : + CVT_NONE) & CVT_MASK) +*************** +*** 1148,1153 **** +--- 1158,1166 ---- + * History: + * + * parse.c,v ++ * Revision 3.22 1994/02/25 12:34:49 kardel ++ * allow for converter generated utc times ++ * + * Revision 3.21 1994/02/02 17:45:30 kardel + * rcs ids fixed + * +diff -c parse/util/testdcf.c:1.1.1.6 parse/util/testdcf.c:3.11 +*** parse/util/testdcf.c:1.1.1.6 Thu Mar 3 10:36:27 1994 +--- parse/util/testdcf.c Thu Mar 3 10:36:27 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * +! * testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * + * simple DCF77 100/200ms pulse test program (via 50Baud serial line) + * +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp + * +! * testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp + * + * simple DCF77 100/200ms pulse test program (via 50Baud serial line) + * +diff -c xntpd/Makefile.tmpl:1.1.1.18 xntpd/Makefile.tmpl:3.28 +*** xntpd/Makefile.tmpl:1.1.1.18 Thu Mar 3 10:38:13 1994 +--- xntpd/Makefile.tmpl Thu Mar 3 10:38:13 1994 +*************** +*** 34,40 **** + refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ + refclock_parse.c refclock_as2201.c refclock_omega.c \ + refclock_tpro.c refclock_leitch.c refclock_irig.c \ +! refclock_msfees.c refclock_gpstm.c ntp_intres.c ntp_filegen.c + + OBJS= ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \ + ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \ +--- 34,41 ---- + refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ + refclock_parse.c refclock_as2201.c refclock_omega.c \ + refclock_tpro.c refclock_leitch.c refclock_irig.c \ +! refclock_msfees.c refclock_gpstm.c refclock_trak.c \ +! ntp_intres.c ntp_filegen.c + + OBJS= ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \ + ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \ +*************** +*** 44,50 **** + refclock_wwvb.o refclock_goes.o refclock_mx4200.o \ + refclock_parse.o refclock_as2201.o refclock_omega.o \ + refclock_tpro.o refclock_leitch.o refclock_irig.o \ +! refclock_msfees.o refclock_gpstm.o ntp_intres.o ntp_filegen.o + + all: $(PROGRAM) + +--- 45,52 ---- + refclock_wwvb.o refclock_goes.o refclock_mx4200.o \ + refclock_parse.o refclock_as2201.o refclock_omega.o \ + refclock_tpro.o refclock_leitch.o refclock_irig.o \ +! refclock_msfees.o refclock_gpstm.o refclock_trak.o \ +! ntp_intres.o ntp_filegen.o + + all: $(PROGRAM) + +*************** +*** 136,141 **** +--- 138,146 ---- + + refclock_msfees.o: refclock_msfees.c + $(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c ++ ++ refclock_trak.o: refclock_trak.c ++ $(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c + + refclock_gpstm.o: refclock_gpstm.c + $(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c +diff -c xntpd/ntp_control.c:1.1.1.17 xntpd/ntp_control.c:3.26 +*** xntpd/ntp_control.c:1.1.1.17 Thu Mar 3 10:38:16 1994 +--- xntpd/ntp_control.c Thu Mar 3 10:38:17 1994 +*************** +*** 301,307 **** + static u_char clocktypes[] = { + CTL_SST_TS_NTP, /* REFCLK_NONE */ + CTL_SST_TS_UNSPEC, /* REFCLK_LOCALCLOCK */ +! CTL_SST_TS_HF, /* REFCLK_WWV_HEATH */ + CTL_SST_TS_HF, /* REFCLK_WWV_PST */ + CTL_SST_TS_LF, /* REFCLK_WWVB_SPECTRACOM */ + CTL_SST_TS_UHF, /* REFCLK_GOES_TRUETIME */ +--- 301,307 ---- + static u_char clocktypes[] = { + CTL_SST_TS_NTP, /* REFCLK_NONE */ + CTL_SST_TS_UNSPEC, /* REFCLK_LOCALCLOCK */ +! CTL_SST_TS_HF, /* REFCLK_GPS_TRAK */ + CTL_SST_TS_HF, /* REFCLK_WWV_PST */ + CTL_SST_TS_LF, /* REFCLK_WWVB_SPECTRACOM */ + CTL_SST_TS_UHF, /* REFCLK_GOES_TRUETIME */ +diff -c xntpd/refclock_conf.c:1.1.1.22 xntpd/refclock_conf.c:3.21 +*** xntpd/refclock_conf.c:1.1.1.22 Thu Mar 3 10:38:54 1994 +--- xntpd/refclock_conf.c Thu Mar 3 10:38:54 1994 +*************** +*** 113,119 **** + struct refclock *refclock_conf[] = { + &refclock_none, /* 0 REFCLK_NONE */ + &refclock_local, /* 1 REFCLK_LOCAL */ +! &refclock_none, /* 2 REFCLK_WWV_HEATH */ + &refclock_pst, /* 3 REFCLK_WWV_PST */ + &refclock_wwvb, /* 4 REFCLK_WWVB_SPECTRACOM */ + &refclock_goes, /* 5 REFCLK_GOES_TRUETIME */ +--- 113,119 ---- + struct refclock *refclock_conf[] = { + &refclock_none, /* 0 REFCLK_NONE */ + &refclock_local, /* 1 REFCLK_LOCAL */ +! &refclock_trak, /* 2 REFCLK_GPS_TRAK */ + &refclock_pst, /* 3 REFCLK_WWV_PST */ + &refclock_wwvb, /* 4 REFCLK_WWVB_SPECTRACOM */ + &refclock_goes, /* 5 REFCLK_GOES_TRUETIME */ +RCS file: /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v +retrieving revision 1.1.1.12 +diff -c -r1.1.1.12 xntpd/refclock_parse.c +*** xntpd/refclock_parse.c:1.1.1.12 1994/02/22 21:57:57 +--- xntpd/refclock_parse.c 1994/03/03 09:49:54 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp + * +! * refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp + * + * generic reference clock driver for receivers + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * +! * refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * + * generic reference clock driver for receivers + * +*************** +*** 129,135 **** + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp"; + #endif + + /**=========================================================================== +--- 129,135 ---- + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp"; + #endif + + /**=========================================================================== +*************** +*** 1653,1659 **** + * done if no more characters are available + */ + FD_SET(fd, &fdmask); +! if (select(fd + 1, &fdmask, 0, 0, &null_time) == 0) + return; + } + } +--- 1653,1660 ---- + * done if no more characters are available + */ + FD_SET(fd, &fdmask); +! if ((i == 0) && +! (select(fd + 1, &fdmask, 0, 0, &null_time) == 0)) + return; + } + } +*************** +*** 2823,2829 **** + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.49 1994/02/20 13:26:00 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +--- 2824,2830 ---- + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.26 b/usr.sbin/xntpd/patches/patch.26 new file mode 100644 index 000000000000..a55360dbd623 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.26 @@ -0,0 +1,36 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa24501; 5 Mar 94 21:23 EST +Received: from goofus.wustl.edu by louie.udel.edu id aa01087; 5 Mar 94 21:15 EST +Received: from mumps.pfcs.com by goofus.wustl.edu with UUCP id AA17154 + (5.67a+/IDA-1.5 for mills@udel.edu); Sat, 5 Mar 1994 20:15:06 -0600 +Received: by mumps.pfcs.com id AA09821 + (5.65c/IDA-1.4.4 for mills@udel.edu); Sat, 5 Mar 1994 19:10:18 -0600 +Date: Sat, 5 Mar 1994 19:10:18 -0600 +From: Harlan Stenn +Message-Id: <199403060110.AA09821@mumps.pfcs.com> +To: mills@udel.edu +Subject: xntpd/Makefile and 3.3l + +Dave, + +xntpd/Makefile doesn't get -DSYS_whatever and -DHAVE_xxx_TTYS "installed" +when the Makefile gets created. This is for OS=mips. + +Same for xntpdc/Makefile. + +A patch follows... + +Harlan + +PS - might you have a copy of the message I sent you a couple of weeks +ago where I asked about broadcast servers and clients and the ntp.conf +file? I was going to send it to the maling list but I lost my copy. + +machines/mips +3,4c3,4 +< DEFS= +< AUTHDEFS= -DDES -DMD5 -DSYS_MIPS -DHAVE_BSD_TTYS +--- +> DEFS= -DSYS_MIPS -DHAVE_BSD_TTYS +> AUTHDEFS= -DDES -DMD5 + diff --git a/usr.sbin/xntpd/patches/patch.27 b/usr.sbin/xntpd/patches/patch.27 new file mode 100644 index 000000000000..5d450d44f934 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.27 @@ -0,0 +1,86 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa23654; 11 Mar 94 7:49 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa14038; + 10 Mar 94 14:14 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA13885 (5.65c-6/7.3v-FAU); Thu, 10 Mar 1994 20:10:36 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA03872 (5.65c-6/7.3m-FAU); Thu, 10 Mar 1994 20:10:33 +0100 +From: Frank Kardel +Message-Id: <199403101910.AA03872@faui43.informatik.uni-erlangen.de> +Subject: RAW dcf77 showstopper 8-(. +To: mills@udel.edu +Date: Thu, 10 Mar 94 20:10:25 MET +Cc: dpk@morgan.com, Frank.Kardel@informatik.uni-erlangen.de, + Piete.Brooks@cl.cam.ac.uk, jcs@bear.zoo.bt.co.uk +X-Mailer: ELM [version 2.3 PL11] + +Hi, my changes for 3.3m introduced a subtle reliability problem for +the cheap DCF77 receiver code - it only returned somtimes the +correct time 8-(. + +Well, here is the patch. (I'll post this one to the news group +also as it is a show stopper for the cheap clocks 8-(). So +don't be confused. + + +RCS file: /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v +retrieving revision 3.12 +diff -c -r3.12 clk_rawdcf.c +*** parse/clk_rawdcf.c:3.12 1994/02/20 13:04:39 +--- parse/clk_rawdcf.c 1994/03/10 19:00:43 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.12 1994/02/20 13:04:39 kardel Exp + * +! * clk_rawdcf.c,v 3.12 1994/02/20 13:04:39 kardel Exp + * + * Raw DCF77 pulse clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.13 1994/03/10 19:00:43 kardel Exp + * +! * clk_rawdcf.c,v 3.13 1994/03/10 19:00:43 kardel Exp + * + * Raw DCF77 pulse clock support + * +*************** +*** 245,250 **** +--- 245,251 ---- + parseprintf(DD_RAWDCF,("parse: convert_rawdcf: parity check passed\n")); + + clock->flags = PARSEB_S_ANTENNA|PARSEB_S_LEAP; ++ clock->utctime= 0; + clock->usecond= 0; + clock->second = 0; + clock->minute = ext_bf(buffer, DCF_M10, dcfparam->zerobits); +*************** +*** 528,534 **** + /* + * History: + * +! * clk_rawdcf.c,v + * Revision 3.12 1994/02/20 13:04:39 kardel + * parse add/delete second support + * +--- 529,538 ---- + /* + * History: + * +! * clk_rawdcf.c,v +! * Revision 3.13 1994/03/10 19:00:43 kardel +! * clear utctime field to avoid confusion on synthesize time stamps +! * + * Revision 3.12 1994/02/20 13:04:39 kardel + * parse add/delete second support + * + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.28 b/usr.sbin/xntpd/patches/patch.28 new file mode 100644 index 000000000000..37e2065d2edd --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.28 @@ -0,0 +1,454 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa07183; 13 Mar 94 23:57 EST +Received: from hpsdlo.sdd.hp.com by louie.udel.edu id aa17483; + 13 Mar 94 23:50 EST +Received: from hpsdlz.sdd.hp.com by hpsdlo.sdd.hp.com with SMTP + (1.36.108.4/15.5+IOS 3.21+sdd) id AA07032; Sun, 13 Mar 1994 20:50:23 -0800 +Received: from localhost by hpsdlz.sdd.hp.com with SMTP + (1.36.108.4/15.5+IOS 3.21+sdd) id AA05726; Sun, 13 Mar 1994 20:50:21 -0800 +Message-Id: <9403140450.AA05726@hpsdlz.sdd.hp.com> +To: mills@udel.edu +Subject: patches for xntpd +Date: Sun, 13 Mar 1994 20:50:21 -0800 +From: Ken Stone + + +Ok Dave, + +I guess I'll take a poke at the "m" version for cleanup and updates. This +should take care of the newly released 9.03 for s300/s400 which has the +adjtime(2) syscall. Also, cleanup in readiness for 10.0 all around. + + -- Ken + +P.S. How is your HP hardware/software deal going ? I haven't heard anything + lately. + + + +First do a "rm */hpux10+*" as I have renamed all that to hpux-adj ... that +9.03 blew me out of the water on the naming scheme :-) + +Then unshar the following ... it will add a few new files and give you +diff to apply (diffs.hpux). + + +#---------------------------------- cut here ---------------------------------- +# This is a shell archive. Remove anything before this line, +# then unpack it by saving it in a file and typing "sh file". +# +# Wrapped by Source Hacker on Sun Mar 13 20:47:57 1994 +# +# This archive contains: +# compilers/hpux-adj.cc compilers/hpux-adj.gcc +# machines/hpux-adj scripts/hpadjtime.sh +# diffs.hpux +# +# Error checking via wc(1) will be performed. +# Error checking via sum(1) will be performed. + +LANG=""; export LANG +PATH=/bin:/usr/bin:$PATH; export PATH + +if sum -r /dev/null 2>&1 +then + sumopt='-r' +else + sumopt='' +fi + +echo x - compilers/hpux-adj.cc +cat >compilers/hpux-adj.cc <<'@EOF' +COMPILER=cc +O1 +@EOF +set `sum $sumopt compilers/hpux-adj.gcc <<'@EOF' +COMPILER=gcc -O2 +@EOF +set `sum $sumopt machines/hpux-adj <<'@EOF' +SHELL= /bin/sh +RANLIB= ls # ar does the work of ranlib under System V +DEFS_LOCAL= -DREFCLOCK +DEFS= -DHAVE_TERMIOS -DSYS_HPUX=10 +AUTHDEFS= -DDES -DMD5 +CLOCKDEFS= -DLOCAL_CLOCK +COPTS= +INSTALL=$(TOP)scripts/install.sh +@EOF +set `sum $sumopt scripts/hpadjtime.sh <<'@EOF' +#! /bin/sh + +if [ -f /bin/uname -o -f /usr/bin/uname ]; then + set `uname -a | tr '[A-Z]' '[a-z]'` + case "$1" in + hp-ux) case "$3" in + *.10.*) val=1 ;; + *.09.03) case "$5" in + 9000/3*) val=1 ;; + *) val=0 ;; + esac ;; + *) val=0 ;; + esac + ;; + *) + esac +fi +exit $val +@EOF +set `sum $sumopt diffs.hpux <<'@EOF' +*** xntp3.3m.orig/compilers/hpux.cc Thu Sep 2 13:19:56 1993 +--- xntp3.3m/compilers/hpux.cc Sun Mar 13 12:10:23 1994 +*************** +*** 1,2 **** +! COMPILER=cc +! COPTS=+O1 +--- 1 ---- +! COMPILER=cc +O1 +*** xntp3.3m.orig/compilers/hpux.gcc Thu Sep 2 13:19:59 1993 +--- xntp3.3m/compilers/hpux.gcc Sun Mar 13 12:10:29 1994 +*************** +*** 1,2 **** +! COMPILER=gcc +! COPTS=-O2 +--- 1 ---- +! COMPILER=gcc -O2 +*** xntp3.3m.orig/hints/hpux Fri Dec 3 02:28:57 1993 +--- xntp3.3m/hints/hpux Sun Mar 13 20:20:38 1994 +*************** +*** 1,59 **** + This file hopefully describes the whatever and however of how to get xntp +! running on hpux 8.0 and later s300, 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 :-) +! Xntp has been in use here for several months 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 8.0 or later, pretty much hang it up now. +! This stuff has run here on 8.0 s300, s700, and s800. Its possible that it +! runs on 7.0 but I have not tried v3 code on 7.0 at all. + +! [Note that recent reports state that this release does in fact run on HP +! 300 and 400 boxes, which run 7.0 - Ed.] + +! Next, let me explain a bit about how this stuff works on HP-UX since we don't + 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 here may yield very odd results. + + What to do to get this stuff running ? + +! * cd .. +! * Say "make makeconfig" + +! * cd .. +! * 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 .. +! * Now we need to install this stuff ... make install will not work +! unless you have replaced the SYSV install command with a BSD +! compatible version. So ... the simplest thing to do is run +! make -n install and do manually what it would have done. + + * I'd suggest reading the xntp docs about now :-) ... seriously !! + +! * Check out the docs and the stuff in xntp/conf and build a config +! file ... put it in /usr/local/etc/xntp.conf (or where ever you +! defined the config file to be in Config). One thing we 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) +--- 1,63 ---- ++ 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) +*************** +*** 72,76 **** +--- 76,92 ---- + + * 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 +*** xntp3.3m.orig/include/ntp_machine.h Sun Feb 27 19:34:59 1994 +--- xntp3.3m/include/ntp_machine.h Sun Mar 13 15:35:33 1994 +*************** +*** 334,341 **** + #define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) + #define NO_SIGNED_CHAR_DECL + #define LOCK_PROCESS +- #define HAVE_NO_NICE /* HPUX uses rtprio instead */ + #define RETSIGTYPE void + #if (SYS_HPUX < 10) + #define NOKMEM + #else +--- 334,345 ---- + #define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) + #define NO_SIGNED_CHAR_DECL + #define LOCK_PROCESS + #define RETSIGTYPE void ++ #if (SYS_HPUX < 9) ++ #define HAVE_NO_NICE /* HPUX uses rtprio instead */ ++ #else ++ #define HAVE_BSD_NICE /* new at 9.X */ ++ #endif + #if (SYS_HPUX < 10) + #define NOKMEM + #else +*** xntp3.3m.orig/lib/Makefile.tmpl Wed Feb 2 21:20:13 1994 +--- xntp3.3m/lib/Makefile.tmpl Sun Mar 13 16:27:50 1994 +*************** +*** 49,55 **** + $(LIBNAME).a: $(OBJS) + ar rv $@ $? + -rm -f $? +! @if ( hp-pa || hp-mc680x0 ) > /dev/null 2>&1; then \ + ( cd ../adjtime && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" ) && ar rv $@ ../adjtime/adjtime.o; \ + else \ + :; \ +--- 49,55 ---- + $(LIBNAME).a: $(OBJS) + ar rv $@ $? + -rm -f $? +! @if ( ../scripts/hpadjtime.sh ) > /dev/null 2>&1; then \ + ( cd ../adjtime && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" MAKE="$(MAKE)" ) && ar rv $@ ../adjtime/adjtime.o; \ + else \ + :; \ +*** xntp3.3m.orig/scripts/Guess.sh Wed Jan 26 15:26:03 1994 +--- xntp3.3m/scripts/Guess.sh Sun Mar 13 14:10:19 1994 +*************** +*** 40,46 **** + guess="ultrix" + ;; + hp-ux) case "$3" in +! *.10.*) guess="hpux10+" ;; + *) guess="hpux" ;; + esac + ;; +--- 40,50 ---- + guess="ultrix" + ;; + hp-ux) case "$3" in +! *.10.*) guess="hpux-adj" ;; +! *.09.03) case "$5" in +! 9000/3*) guess="hpux-adj" ;; +! *) guess="hpux" ;; +! esac ;; + *) guess="hpux" ;; + esac + ;; +*** xntp3.3m.orig/util/tickadj.c Wed Feb 2 21:20:17 1994 +--- xntp3.3m/util/tickadj.c Sun Mar 13 13:55:53 1994 +*************** +*** 388,393 **** +--- 388,409 ---- + #endif + #endif + ++ #if defined(SYS_HPUX) ++ #define X_TICKADJ 0 ++ #define X_TICK 1 ++ #define X_DEF ++ static struct nlist nl[] = ++ #ifdef hp9000s300 ++ { {"_tickadj"}, ++ {"_old_tick"}, ++ #else ++ { {"tickadj"}, ++ {"old_tick"}, ++ #endif ++ {""}, ++ }; ++ #endif ++ + #if !defined(X_DEF) + #define X_TICKADJ 0 + #define X_TICK 1 +*************** +*** 408,413 **** +--- 424,430 ---- + "/kernel/unix", + "/386bsd", + "/netbsd", ++ "/hp-ux", + NULL + }; + struct stat stbuf; +*** xntp3.3m.orig/xntpd/ntp_loopfilter.c Sun Feb 27 19:36:16 1994 +--- xntp3.3m/xntpd/ntp_loopfilter.c Sun Mar 13 14:03:54 1994 +*************** +*** 349,356 **** + } + } + #endif /* HAVE_BSD_TTYS */ +- fdpps = fd232; + #endif /* HPUXGADGET */ + + /* + * Insert in device list. +--- 349,356 ---- + } + } + #endif /* HAVE_BSD_TTYS */ + #endif /* HPUXGADGET */ ++ fdpps = fd232; + + /* + * Insert in device list. +@EOF +set `sum $sumopt +Message-Id: <199403162257.AA18230@faui43.informatik.uni-erlangen.de> +Subject: hpadjtime.sh +To: mills@udel.edu, ken@sdd.hp.com +Date: Wed, 16 Mar 94 23:57:32 MET +Return-Receipt-To: "Frank Kardel" +X-Mailer: ELM [version 2.3 PL11] + +Hi, 3.3n is somewhat broken... + +First of all + - scripts/hpadjtime.sh is missing (it's in patch.28) + +And + - scripts/hpadjtime.sh is broken for non hp-ux + (will try to build adjtime libs on non hp-ux architectures + as a default value was no set) + +Please use this version of scripts/hpadjtime.sh for increased safety: + +#! /bin/sh +val=1 +if [ -f /bin/uname -o -f /usr/bin/uname ]; then + set `uname -a | tr '[A-Z]' '[a-z]'` + case "$1" in + hp-ux) case "$3" in + *.10.*) val=1 ;; + *.09.03) case "$5" in + 9000/3*) val=1 ;; + *) val=0 ;; + esac ;; + *) val=0 ;; + esac + ;; + *) + esac +fi +exit $val + +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.3 b/usr.sbin/xntpd/patches/patch.3 new file mode 100644 index 000000000000..beba805e39d9 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.3 @@ -0,0 +1,3032 @@ +diff -c TODO:1.1.1.3 TODO:3.5 +*** TODO:1.1.1.3 Wed Jan 26 21:46:47 1994 +--- TODO Wed Jan 26 21:46:48 1994 +*************** +*** 1,5 **** + # +! # TODO,v 3.4 1994/01/23 17:19:06 kardel Exp + # + This file contains problems known to the authors that still need to be done. + We would appreciate if you could spare some of your time to look through +--- 1,5 ---- + # +! # TODO,v 3.5 1994/01/25 19:03:55 kardel Exp + # + This file contains problems known to the authors that still need to be done. + We would appreciate if you could spare some of your time to look through +diff -c doc/xntpd.8:1.1.1.11 doc/xntpd.8:3.21 +*** doc/xntpd.8:1.1.1.11 Wed Jan 26 21:47:54 1994 +--- doc/xntpd.8 Wed Jan 26 21:47:55 1994 +*************** +*** 74,79 **** +--- 74,85 ---- + ] [ + .B -t + .I trustedkey ++ ] [ ++ .B -v ++ .I variable ++ ] [ ++ .B -V ++ .I variable + ] + .SH DESCRIPTION + .I Xntpd +*************** +*** 140,145 **** +--- 146,155 ---- + specify a directory to be used for creating statistics files + .Ip -t 8 + add a key number to the trusted key list ++ .Ip -v 8 ++ add a system variable ++ .Ip -V 8 ++ add a system variable listed by default + .SH "CONFIGURATION FILE OPTIONS" + .IR Xntpd 's + configuration file is relatively free format. Comments, which may be +*************** +*** 494,499 **** +--- 504,534 ---- + This command is obsolete and not available in this version of + .I xntpd. + .PP ++ .B setvar ++ .I variable ++ .I [default] ++ .PP ++ 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 from = is followed by the ++ .I 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 overide any variables defined ++ via the ++ .I setvar ++ mechanism. ++ .PP ++ There are three special variables that contain the names of all variable of ++ the same group. The ++ .I sys_var_list ++ holds the names of all system variables. The ++ .I peer_var_list ++ holds the names of all peer variables and the ++ .I clock_var_list ++ hold the names of the reference clock variables. ++ .PP + .B resolver + .I /path/xntpres + .PP +*************** +*** 1093,1101 **** + time. + On the availability of PPS information the + .I time2 +! fudge factor show the difference betwteen the PPS time stamp and the reception +! time stamp of the serial signal. This parameter is read only attempts to +! set this parameter will be ignored. + The + .I flag0 + enables input filtering. This a median filter with continuous sampling. The +--- 1128,1140 ---- + time. + On the availability of PPS information the + .I time2 +! fudge factor defines the skew between the PPS time stamp and the reception +! time stamp of the PPS signal. This parameter is usually 0 as usually +! the PPS signal is believed in time and OS delays should be corrected +! in the machine specific section of the kernel driver. +! .I time2 +! needs only be set when the actial PPS signal is delayed for some +! reason. + The + .I flag0 + enables input filtering. This a median filter with continuous sampling. The +*************** +*** 1109,1121 **** + .I ntpq + timecode variable + .PP +! The timecode variable in the ntpq read clock variable command contains several +! fields. The first field is the local time in Unix format. The second field is +! the offset to UTC (format HHMM). The currently active receiver flags are listed +! next. Additional feature flags of the receiver are optionally listed in paranthesis. +! The actual time code is enclosed in angle brackets < >. A qualification of the +! decoded time code format is following the time code. The last piece of information +! is the overall running time and the accumulated times for the clock event states. + .PP + Unit encoding + .PP +--- 1148,1172 ---- + .I ntpq + timecode variable + .PP +! The ntpq read clock variables command list several variables. These +! hold followinf information: +! .I refclock_time +! is the local time with the offset to UTC (format HHMM). +! The currently active receiver flags are listed in +! .I refclock_status. +! Additional feature flags of the receiver are optionally listed in paranthesis. +! The actual time code is listed in +! .I timecode. +! A qualification of the decoded time code format is following in +! .I refclock_format. +! The last piece of information is the overall running time and the accumulated +! times for the clock event states in +! .I refclock_states. +! When PPS information is present additional variable are available. +! .I refclock_ppstime +! lists then the PPS timestamp and +! .I refclock_ppsskew +! lists the difference between RS232 derived timestamp and the PPS timestamp. + .PP + Unit encoding + .PP +diff -c include/ntp_control.h:1.1.1.5 include/ntp_control.h:3.6 +*** include/ntp_control.h:1.1.1.5 Wed Jan 26 21:48:21 1994 +--- include/ntp_control.h Wed Jan 26 21:48:21 1994 +*************** +*** 163,171 **** + #define CS_SYSTEM 17 + #define CS_KEYID 18 + #define CS_REFSKEW 19 +! #define CS_VERSION 20 + +! #define CS_MAXCODE CS_VERSION + + /* + * Peer variables we understand +--- 163,171 ---- + #define CS_SYSTEM 17 + #define CS_KEYID 18 + #define CS_REFSKEW 19 +! #define CS_VARLIST 20 + +! #define CS_MAXCODE CS_VARLIST + + /* + * Peer variables we understand +*************** +*** 204,212 **** + #define CP_SENT 32 + #define CP_FILTERROR 33 + #define CP_FLASH 34 +! #define CP_DISP 35 +! #define CP_MAXCODE CP_DISP + + /* + * Clock variables we understand + */ +--- 204,213 ---- + #define CP_SENT 32 + #define CP_FILTERROR 33 + #define CP_FLASH 34 +! #define CP_VARLIST 35 + ++ #define CP_MAXCODE CP_VARLIST ++ + /* + * Clock variables we understand + */ +*************** +*** 222,229 **** + #define CC_FUDGEVAL2 10 + #define CC_FLAGS 11 + #define CC_DEVICE 12 + +! #define CC_MAXCODE CC_DEVICE + + /* + * Definition of the structure used internally to hold trap information. +--- 223,231 ---- + #define CC_FUDGEVAL2 10 + #define CC_FLAGS 11 + #define CC_DEVICE 12 ++ #define CC_VARLIST 13 + +! #define CC_MAXCODE CC_VARLIST + + /* + * Definition of the structure used internally to hold trap information. +diff -c include/ntp_filegen.h:1.1.1.3 include/ntp_filegen.h:3.7 +*** include/ntp_filegen.h:1.1.1.3 Wed Jan 26 21:48:22 1994 +--- include/ntp_filegen.h Wed Jan 26 21:48:22 1994 +*************** +*** 1,5 **** + /* +! * ntp_filegen.h,v 3.6 1993/09/01 21:51:24 kardel Exp + * + * definitions for NTP file generations support + * +--- 1,5 ---- + /* +! * ntp_filegen.h,v 3.7 1994/01/25 19:04:16 kardel Exp + * + * definitions for NTP file generations support + * +diff -c include/ntp_machine.h:1.1.1.9 include/ntp_machine.h:1.24 +*** include/ntp_machine.h:1.1.1.9 Wed Jan 26 21:48:27 1994 +--- include/ntp_machine.h Wed Jan 26 21:48:27 1994 +*************** +*** 123,134 **** + + HAVE_UNISTD_H - Maybe should be part of NTP_POSIX_SOURCE ? + + You could just put the defines on the DEFS line in machines/ file. + I don't since there are lost of different types compiler that a systemm might + have, some that can do proto typing and others that cannot on the saem system. + I get a chanse to twiddle some of the configuration paramasters at compile + time based on compler/machine combinatsions by using this include file. +! See convex, aix and sun configurations see how complex it get. + + */ + +--- 123,138 ---- + + HAVE_UNISTD_H - Maybe should be part of NTP_POSIX_SOURCE ? + ++ DEFINITIONS FOR SYSTEM && PROCESSOR ++ STR_SYSTEM - value of system variable ++ STR_PROCESSOR - value of processor variable ++ + You could just put the defines on the DEFS line in machines/ file. + I don't since there are lost of different types compiler that a systemm might + have, some that can do proto typing and others that cannot on the saem system. + I get a chanse to twiddle some of the configuration paramasters at compile + time based on compler/machine combinatsions by using this include file. +! See convex, aix and sun configurations see how complex it gets. + + */ + +*************** +*** 152,157 **** +--- 156,164 ---- + #endif + #endif /*_BSD */ + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/AIX" ++ #endif + #endif /* RS6000 */ + + /* +*************** +*** 166,171 **** +--- 173,181 ---- + #define RETSIGTYPE void + #define NTP_SYSCALL_GET 132 + #define NTP_SYSCALL_ADJ 147 ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/SunOS 4.x" ++ #endif + #endif + + /* +*************** +*** 182,188 **** +--- 192,201 ---- + #define NTP_POSIX_SOURCE + #define HAVE_ATT_SETPGRP + #define HAVE_ATT_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/SINIX-M" + #endif ++ #endif + + /* + * SunOS 5.1 or SunOS 5.2 or Solaris 2.1 or Solaris 2.2 +*************** +*** 198,203 **** +--- 211,219 ---- + #define HAVE_ATT_SETPGRP + #define HAVE_ATT_NICE + #define UDP_WILDCARD_DELIVERY ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Solaris 2.x" ++ #endif + #endif + + /* +*************** +*** 221,227 **** +--- 237,246 ---- + #define NTP_POSIX_SOURCE + #define HAVE_ATT_SETPGRP + #endif ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/ConvexOS" + #endif ++ #endif + + /* + * IRIX 4.X and IRIX 5.x +*************** +*** 235,240 **** +--- 254,262 ---- + #define HAVE_ATT_SETPGRP + #define HAVE_BSD_NICE + #define NTP_POSIX_SOURCE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/IRIX" ++ #endif + #endif + + /* +*************** +*** 247,253 **** +--- 269,278 ---- + #define HAVE_BSD_NICE + #define RETSIGTYPE void + #define NTP_SYSCALLS_STD ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Ultrix" + #endif ++ #endif + + /* + * AUX +*************** +*** 272,277 **** +--- 297,305 ---- + #define HAVE_BSD_TTYS + #define LOG_NTP LOG_LOCAL1 + #define HAVE_SIGNALED_IO ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/AUX" ++ #endif + #endif + + /* +*************** +*** 283,289 **** +--- 311,320 ---- + #define HAVE_BSD_NICE + #define HAVE_N_UN + #undef NTP_POSIX_SOURCE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Next" + #endif ++ #endif + + /* + * HPUX +*************** +*** 301,306 **** +--- 332,340 ---- + #else + #define HAVE_READKMEM + #endif ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/HPUX" ++ #endif + #endif + + /* +*************** +*** 311,316 **** +--- 345,353 ---- + #define HAVE_LIBKVM + #define NTP_POSIX_SOURCE + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/BSDI" ++ #endif + #define HAVE_BSD_TTYS + #endif + +*************** +*** 327,332 **** +--- 364,372 ---- + * along with a standard name one day ! */ + #define ntp_adjtime __adjtimex + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Linux" ++ #endif + #endif + + /* +*************** +*** 338,344 **** +--- 378,387 ---- + #define HAVE_READKMEM + #define NTP_POSIX_SOURCE + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/*BSD" + #endif ++ #endif + + /* + * DECOSF1 +*************** +*** 349,354 **** +--- 392,400 ---- + #define NTP_POSIX_SOURCE + #define NTP_SYSCALLS_STD + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/DECOSF1" ++ #endif + #endif + + /* +*************** +*** 358,364 **** +--- 404,413 ---- + #define HAVE_READKMEM + #define S_CHAR_DEFINED + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/I386" + #endif ++ #endif + + /* + * Mips +*************** +*** 366,371 **** +--- 415,423 ---- + #if defined(SYS_MIPS) + #define NOKMEM + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Mips" ++ #endif + #endif + + /* +*************** +*** 373,379 **** +--- 425,434 ---- + */ + #if defined(SYS_SEQUENT) + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Sequent Dynix 3" + #endif ++ #endif + + /* + * PTX +*************** +*** 407,412 **** +--- 462,470 ---- + typedef unsigned short u_short; + typedef unsigned long u_long; + #endif ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Sequent PTX" ++ #endif + #endif + + +*************** +*** 417,423 **** +--- 475,484 ---- + #define NO_SIGNED_CHAR_DECL + #define HAVE_READKMEM + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Sony" + #endif ++ #endif + + /* + * VAX +*************** +*** 426,431 **** +--- 487,495 ---- + #define NO_SIGNED_CHAR_DECL + #define HAVE_READKMEM + #define HAVE_BSD_NICE ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/VAX" ++ #endif + #endif + + /* +*************** +*** 445,455 **** + #define LOCK_PROCESS + #define SYSV_TIMEOFDAY + #define SIZE_RETURNED_IN_BUFFER +! #endif +! +! #ifdef STREAM /* STREAM implies TERMIOS */ +! #ifndef HAVE_TERMIOS +! #define HAVE_TERMIOS + #endif + #endif + +--- 509,516 ---- + #define LOCK_PROCESS + #define SYSV_TIMEOFDAY + #define SIZE_RETURNED_IN_BUFFER +! #ifndef STR_SYSTEM +! #define STR_SYSTEM "UNIX/SysVR4" + #endif + #endif + +*************** +*** 464,469 **** +--- 525,539 ---- + #define NTP_SYSCALLS_STD + #define USE_PROTOTYPES + #define UDP_WILDCARD_DELIVERY ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/DOMAINOS" ++ #endif ++ #endif ++ ++ #ifdef STREAM /* STREAM implies TERMIOS */ ++ #ifndef HAVE_TERMIOS ++ #define HAVE_TERMIOS ++ #endif + #endif + + #ifndef RETSIGTYPE +diff -c include/ntp_refclock.h:1.1.1.8 include/ntp_refclock.h:3.8 +*** include/ntp_refclock.h:1.1.1.8 Wed Jan 26 21:48:28 1994 +--- include/ntp_refclock.h Wed Jan 26 21:48:28 1994 +*************** +*** 75,84 **** + LONG fudgeval2; + u_char currentstatus; + u_char lastevent; +! u_char unused[1]; + }; + +- + /* + * Reference clock I/O structure. Used to provide an interface between + * the reference clock drivers and the I/O module. +--- 75,84 ---- + LONG fudgeval2; + u_char currentstatus; + u_char lastevent; +! u_char unused; +! struct ctl_var *kv_list; /* additional variables */ + }; + + /* + * Reference clock I/O structure. Used to provide an interface between + * the reference clock drivers and the I/O module. +diff -c include/ntpd.h:1.1.1.6 include/ntpd.h:1.5 +*** include/ntpd.h:1.1.1.6 Wed Jan 26 21:48:35 1994 +--- include/ntpd.h Wed Jan 26 21:48:35 1994 +*************** +*** 1,4 **** +! /* ntpd.h,v 3.1 1993/07/06 01:07:03 jbj Exp + * ntpd.h - Prototypes for xntpd. + */ + +--- 1,4 ---- +! /* + * ntpd.h - Prototypes for xntpd. + */ + +*************** +*** 21,26 **** +--- 21,55 ---- + extern void process_control P((struct recvbuf *, int)); + extern void report_event P((int, struct peer *)); + ++ /* ntp_control.c */ ++ /* ++ * Structure for translation tables between internal system ++ * variable indices and text format. ++ */ ++ struct ctl_var { ++ u_short code; ++ u_short flags; ++ char *text; ++ }; ++ /* ++ * Flag values ++ */ ++ #define CAN_READ 0x01 ++ #define CAN_WRITE 0x02 ++ ++ #define DEF 0x20 ++ #define PADDING 0x40 ++ #define EOV 0x80 ++ ++ #define RO (CAN_READ) ++ #define WO (CAN_WRITE) ++ #define RW (CAN_READ|CAN_WRITE) ++ ++ extern char * add_var P((struct ctl_var **, unsigned long, int)); ++ extern void free_varlist P((struct ctl_var *)); ++ extern void set_var P((struct ctl_var **, char *, unsigned long, int)); ++ extern void set_sys_var P((char *, unsigned long, int)); ++ + /* ntp_intres.c */ + extern void ntp_intres P((void)); + +diff -c include/parse.h:1.1.1.6 include/parse.h:3.13 +*** include/parse.h:1.1.1.6 Wed Jan 26 21:48:36 1994 +--- include/parse.h Wed Jan 26 21:48:36 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.12 1994/01/23 17:23:05 kardel Exp + * +! * parse.h,v 3.12 1994/01/23 17:23:05 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * +! * parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +*************** +*** 15,21 **** + #ifndef __PARSE_H__ + #define __PARSE_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char parsehrcsid[]="parse.h,v 3.12 1994/01/23 17:23:05 kardel Exp FAU"; + #endif + + #include "ntp_types.h" +--- 15,21 ---- + #ifndef __PARSE_H__ + #define __PARSE_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char parsehrcsid[]="parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp FAU"; + #endif + + #include "ntp_types.h" +*************** +*** 365,370 **** +--- 365,373 ---- + * History: + * + * parse.h,v ++ * Revision 3.13 1994/01/25 19:04:21 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.12 1994/01/23 17:23:05 kardel + * 1994 reconcilation + * +diff -c include/parse_conf.h:1.1.1.5 include/parse_conf.h:3.5 +*** include/parse_conf.h:1.1.1.5 Wed Jan 26 21:48:37 1994 +--- include/parse_conf.h Wed Jan 26 21:48:37 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/include/parse_conf.h,v 3.4 1994/01/23 17:23:07 kardel Exp + * +! * parse_conf.h,v 3.4 1994/01/23 17:23:07 kardel Exp + * + * Copyright (c) 1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/include/parse_conf.h,v 3.5 1994/01/25 19:04:23 kardel Exp + * +! * parse_conf.h,v 3.5 1994/01/25 19:04:23 kardel Exp + * + * Copyright (c) 1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +*************** +*** 15,21 **** + #ifndef __PARSE_CONF_H__ + #define __PARSE_CONF_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char dcfhrcsid[]="parse_conf.h,v 3.4 1994/01/23 17:23:07 kardel Exp FAU"; + #endif + + /* +--- 15,21 ---- + #ifndef __PARSE_CONF_H__ + #define __PARSE_CONF_H__ + #if !(defined(lint) || defined(__GNUC__)) +! static char dcfhrcsid[]="parse_conf.h,v 3.5 1994/01/25 19:04:23 kardel Exp FAU"; + #endif + + /* +diff -c include/sys/parsestreams.h:1.1.1.6 include/sys/parsestreams.h:3.11 +*** include/sys/parsestreams.h:1.1.1.6 Wed Jan 26 21:48:44 1994 +--- include/sys/parsestreams.h Wed Jan 26 21:48:44 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/include/sys/parsestreams.h,v 3.10 1994/01/23 17:23:12 kardel Exp + * +! * parsestreams.h,v 3.10 1994/01/23 17:23:12 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/include/sys/parsestreams.h,v 3.11 1994/01/25 19:04:30 kardel Exp + * +! * parsestreams.h,v 3.11 1994/01/25 19:04:30 kardel Exp + * + * Copyright (c) 1989,1990,1991,1992,1993,1994 + * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg +*************** +*** 13,19 **** + */ + + #if !(defined(lint) || defined(__GNUC__)) +! static char parse77hrcsid[]="parsestreams.h,v 3.10 1994/01/23 17:23:12 kardel Exp"; + #endif + + #undef PARSEKERNEL +--- 13,19 ---- + */ + + #if !(defined(lint) || defined(__GNUC__)) +! static char parse77hrcsid[]="parsestreams.h,v 3.11 1994/01/25 19:04:30 kardel Exp"; + #endif + + #undef PARSEKERNEL +diff -c kernel/Makefile.tmpl:1.1.1.3 kernel/Makefile.tmpl:3.6 +*** kernel/Makefile.tmpl:1.1.1.3 Wed Jan 26 21:48:49 1994 +--- kernel/Makefile.tmpl Wed Jan 26 21:48:49 1994 +*************** +*** 1,7 **** + # +! # /src/NTP/REPOSITORY/v3/kernel/Makefile.tmpl,v 3.5 1994/01/23 17:37:53 kardel Exp + # +- # + # parse routine that could be used in two places + # + COMPILER= cc +--- 1,6 ---- + # +! # /src/NTP/REPOSITORY/v3/kernel/Makefile.tmpl,v 3.6 1994/01/25 19:04:35 kardel Exp + # + # parse routine that could be used in two places + # + COMPILER= cc +diff -c lib/systime.c:1.1.1.10 lib/systime.c:1.7 +*** lib/systime.c:1.1.1.10 Wed Jan 26 21:50:00 1994 +--- lib/systime.c Wed Jan 26 21:50:00 1994 +*************** +*** 238,273 **** + #endif + } + +- sys_clock_offset.l_ui = offset_i; +- sys_clock_offset.l_uf = offset_f; +- + if (adjtime(&adjtv, &oadjtv) < 0) { + syslog(LOG_ERR, "Can't do time adjustment: %m"); + rval = 0; +! } else + rval = 1; + + #ifdef DEBUGRS6000 +! syslog(LOG_ERR, "adj_systime(%s): offset = %s%s\n", +! mfptoa((adj<0?-1:0), adj, 9), isneg?"-":"", +! umfptoa(offset_i, offset_f, 9)); +! syslog(LOG_ERR, "%d %d %d %d\n", (int) adjtv.tv_sec, +! (int) adjtv.tv_usec, (int) oadjtv.tv_sec, (int) +! oadjtv.tv_usec); + #endif /* DEBUGRS6000 */ + +! if ((oadjtv.tv_sec != 0 || oadjtv.tv_usec != 0) && (max_no_complete > 0)) { +! sTVTOTS(&oadjtv, &oadjts); +! L_ADD(&sys_clock_offset, &oadjts); +! syslog(LOG_WARNING, "Previous time adjustment didn't complete"); + #ifdef DEBUG +! if (debug > 4) +! syslog(LOG_DEBUG, +! "Previous adjtime() incomplete, residual = %s\n", +! tvtoa(&oadjtv)); + #endif +! if (--max_no_complete == 0) syslog(LOG_WARNING, +! "*** No more 'Prev time adj didn't complete'"); + } + return(rval); + } +--- 238,277 ---- + #endif + } + + if (adjtime(&adjtv, &oadjtv) < 0) { + syslog(LOG_ERR, "Can't do time adjustment: %m"); + rval = 0; +! } else { +! sys_clock_offset.l_ui = offset_i; +! sys_clock_offset.l_uf = offset_f; + rval = 1; + + #ifdef DEBUGRS6000 +! syslog(LOG_ERR, "adj_systime(%s): offset = %s%s\n", +! mfptoa((adj<0?-1:0), adj, 9), isneg?"-":"", +! umfptoa(offset_i, offset_f, 9)); +! syslog(LOG_ERR, "%d %d %d %d\n", (int) adjtv.tv_sec, +! (int) adjtv.tv_usec, (int) oadjtv.tv_sec, (int) +! oadjtv.tv_usec); + #endif /* DEBUGRS6000 */ + +! if (oadjtv.tv_sec != 0 || oadjtv.tv_usec != 0) { +! sTVTOTS(&oadjtv, &oadjts); +! L_ADD(&sys_clock_offset, &oadjts); +! if (max_no_complete > 0) { +! syslog(LOG_WARNING, +! "Previous time adjustment didn't complete"); + #ifdef DEBUG +! if (debug > 4) +! syslog(LOG_DEBUG, +! "Previous adjtime() incomplete, residual = %s\n", +! tvtoa(&oadjtv)); + #endif +! if (--max_no_complete == 0) +! syslog(LOG_WARNING, +! "*** No more 'Prev time adj didn't complete'"); +! } +! } + } + return(rval); + } +diff -c ntpq/ntpq.c:1.1.1.20 ntpq/ntpq.c:3.20 +*** ntpq/ntpq.c:1.1.1.20 Wed Jan 26 21:50:59 1994 +--- ntpq/ntpq.c Wed Jan 26 21:50:59 1994 +*************** +*** 2577,2582 **** +--- 2577,2583 ---- + register char *cp; + register char *np; + register char *cpend; ++ int quoted = 0; + static char name[MAXVARLEN]; + static char value[MAXVALLEN]; + +*************** +*** 2623,2630 **** + while (cp < cpend && (isspace(*cp) && *cp != '\r' && *cp != '\n')) + cp++; + np = value; +! while (cp < cpend && *cp != ',') +! *np++ = *cp++; + while (np > value && isspace(*(np-1))) + np--; + *np = '\0'; +--- 2624,2634 ---- + while (cp < cpend && (isspace(*cp) && *cp != '\r' && *cp != '\n')) + cp++; + np = value; +! while (cp < cpend && ((*cp != ',') || quoted)) +! { +! quoted ^= ((*np++ = *cp++) == '"'); +! } +! + while (np > value && isspace(*(np-1))) + np--; + *np = '\0'; +diff -c parse/Makefile.kernel:1.1.1.2 parse/Makefile.kernel:3.8 +*** parse/Makefile.kernel:1.1.1.2 Wed Jan 26 21:51:11 1994 +--- parse/Makefile.kernel Wed Jan 26 21:51:11 1994 +*************** +*** 30,46 **** + ld -r -o parse parsesolaris.o libparse_kernel.a ../lib/libntp.a + @echo "--- Install 'parse' in /kernel/strmod for automatic loading" + +! mparsestreams.o: parsestreams.c microtime.o ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c -DMICROTIME $(DEFS) -I../include parsestreams.c + ld -r -o $@ parsestreams.o ../lib/libntp.a libparse_kernel.a \ + microtime.o + rm -f parsestreams.o +! @echo "--- You may load mparsestreams.o via 'modload mparsestreams.o' into the kernel" + +! parsestreams.o: parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c $(DEFS) -I../include parsestreams.c +! ld -r -o $@ $@ ../lib/libntp.a libparse_kernel.a +! @echo "--- You may load parsestreams.o via 'modload parsestreams.o' into the kernel" + + microtime.o: $(MICROTIME) assym.s + cc -E -I. $(MICROTIME) | sed -e '/\.global _uniqtime/d' > $@.i +--- 30,51 ---- + ld -r -o parse parsesolaris.o libparse_kernel.a ../lib/libntp.a + @echo "--- Install 'parse' in /kernel/strmod for automatic loading" + +! mparsestreams.o: mparsestreams.o.$(KARCH) +! @echo "--- You may load mparsestreams.o.$(KARCH) via 'modload mparsestreams.o.$(KARCH)' into the kernel" +! +! mparsestreams.o.$(KARCH): parsestreams.c microtime.o ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c -DMICROTIME $(DEFS) -I../include parsestreams.c + ld -r -o $@ parsestreams.o ../lib/libntp.a libparse_kernel.a \ + microtime.o + rm -f parsestreams.o +! +! parsestreams.o: parsestreams.o.$(KARCH) +! @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o.$(KARCH)' into the kernel" + +! parsestreams.o.$(KARCH): parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h + cc -c $(DEFS) -I../include parsestreams.c +! ld -r -o $@ parsestreams.o ../lib/libntp.a libparse_kernel.a +! rm -f parsestreams.o + + microtime.o: $(MICROTIME) assym.s + cc -E -I. $(MICROTIME) | sed -e '/\.global _uniqtime/d' > $@.i +diff -c parse/clk_dcf7000.c:1.1.1.7 parse/clk_dcf7000.c:3.10 +*** parse/clk_dcf7000.c:1.1.1.7 Wed Jan 26 21:51:16 1994 +--- parse/clk_dcf7000.c Wed Jan 26 21:51:17 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_DCF7000) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_dcf7000.c,v 3.9 1994/01/23 17:21:51 kardel Exp + * +! * clk_dcf7000.c,v 3.9 1994/01/23 17:21:51 kardel Exp + * + * ELV DCF7000 module + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_DCF7000) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_dcf7000.c,v 3.10 1994/01/25 19:05:07 kardel Exp + * +! * clk_dcf7000.c,v 3.10 1994/01/25 19:05:07 kardel Exp + * + * ELV DCF7000 module + * +diff -c parse/clk_meinberg.c:1.1.1.7 parse/clk_meinberg.c:3.11 +*** parse/clk_meinberg.c:1.1.1.7 Wed Jan 26 21:51:17 1994 +--- parse/clk_meinberg.c Wed Jan 26 21:51:18 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_MEINBERG) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.10 1994/01/23 17:21:54 kardel Exp + * +! * clk_meinberg.c,v 3.10 1994/01/23 17:21:54 kardel Exp + * + * Meinberg clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_MEINBERG) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.11 1994/01/25 19:05:10 kardel Exp + * +! * clk_meinberg.c,v 3.11 1994/01/25 19:05:10 kardel Exp + * + * Meinberg clock support + * +*************** +*** 414,419 **** +--- 414,422 ---- + * History: + * + * clk_meinberg.c,v ++ * Revision 3.11 1994/01/25 19:05:10 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.10 1994/01/23 17:21:54 kardel + * 1994 reconcilation + * +diff -c parse/clk_rawdcf.c:1.1.1.7 parse/clk_rawdcf.c:3.9 +*** parse/clk_rawdcf.c:1.1.1.7 Wed Jan 26 21:51:19 1994 +--- parse/clk_rawdcf.c Wed Jan 26 21:51:19 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.8 1994/01/22 11:24:11 kardel Exp + * +! * clk_rawdcf.c,v 3.8 1994/01/22 11:24:11 kardel Exp + * + * Raw DCF77 pulse clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.9 1994/01/25 19:05:12 kardel Exp + * +! * clk_rawdcf.c,v 3.9 1994/01/25 19:05:12 kardel Exp + * + * Raw DCF77 pulse clock support + * +*************** +*** 529,534 **** +--- 529,537 ---- + * History: + * + * clk_rawdcf.c,v ++ * Revision 3.9 1994/01/25 19:05:12 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.8 1994/01/22 11:24:11 kardel + * fixed PPS handling + * +diff -c parse/clk_schmid.c:1.1.1.7 parse/clk_schmid.c:3.10 +*** parse/clk_schmid.c:1.1.1.7 Wed Jan 26 21:51:20 1994 +--- parse/clk_schmid.c Wed Jan 26 21:51:20 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_SCHMID) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.9 1994/01/23 17:21:56 kardel Exp + * +! * clk_schmid.c,v 3.9 1994/01/23 17:21:56 kardel Exp + * + * Schmid clock support + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_SCHMID) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.10 1994/01/25 19:05:15 kardel Exp + * +! * clk_schmid.c,v 3.10 1994/01/25 19:05:15 kardel Exp + * + * Schmid clock support + * +*************** +*** 168,173 **** +--- 168,176 ---- + * History: + * + * clk_schmid.c,v ++ * Revision 3.10 1994/01/25 19:05:15 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.9 1994/01/23 17:21:56 kardel + * 1994 reconcilation + * +diff -c parse/clk_trimble.c:1.1.1.2 parse/clk_trimble.c:3.7 +*** parse/clk_trimble.c:1.1.1.2 Wed Jan 26 21:51:21 1994 +--- parse/clk_trimble.c Wed Jan 26 21:51:21 1994 +*************** +*** 1,6 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_TRIMSV6) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_trimble.c,v 3.6 1993/10/30 09:44:45 kardel Exp + * + * Trimble SV6 clock support + */ +--- 1,6 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_TRIMSV6) + /* +! * /src/NTP/REPOSITORY/v3/parse/clk_trimble.c,v 3.7 1994/01/25 19:05:17 kardel Exp + * + * Trimble SV6 clock support + */ +*************** +*** 106,111 **** +--- 106,114 ---- + * History: + * + * clk_trimble.c,v ++ * Revision 3.7 1994/01/25 19:05:17 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.6 1993/10/30 09:44:45 kardel + * conditional compilation flag cleanup + * +diff -c parse/parse.c:1.1.1.7 parse/parse.c:3.19 +*** parse/parse.c:1.1.1.7 Wed Jan 26 21:51:24 1994 +--- parse/parse.c Wed Jan 26 21:51:24 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.18 1994/01/23 17:21:59 kardel Exp + * +! * parse.c,v 3.18 1994/01/23 17:21:59 kardel Exp + * + * Parser module for reference clock + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp + * +! * parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp + * + * Parser module for reference clock + * +*************** +*** 22,28 **** + */ + + #if !(defined(lint) || defined(__GNUC__)) +! static char rcsid[] = "parse.c,v 3.18 1994/01/23 17:21:59 kardel Exp"; + #endif + + #include "sys/types.h" +--- 22,28 ---- + */ + + #if !(defined(lint) || defined(__GNUC__)) +! static char rcsid[] = "parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp"; + #endif + + #include "sys/types.h" +*************** +*** 1139,1144 **** +--- 1139,1147 ---- + * History: + * + * parse.c,v ++ * Revision 3.19 1994/01/25 19:05:20 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.18 1994/01/23 17:21:59 kardel + * 1994 reconcilation + * +diff -c parse/parse_conf.c:1.1.1.7 parse/parse_conf.c:3.13 +*** parse/parse_conf.c:1.1.1.7 Wed Jan 26 21:51:25 1994 +--- parse/parse_conf.c Wed Jan 26 21:51:25 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse_conf.c,v 3.12 1994/01/23 17:22:02 kardel Exp + * +! * parse_conf.c,v 3.12 1994/01/23 17:22:02 kardel Exp + * + * Parser configuration module for reference clocks + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse_conf.c,v 3.13 1994/01/25 19:05:23 kardel Exp + * +! * parse_conf.c,v 3.13 1994/01/25 19:05:23 kardel Exp + * + * Parser configuration module for reference clocks + * +*************** +*** 81,86 **** +--- 81,89 ---- + * History: + * + * parse_conf.c,v ++ * Revision 3.13 1994/01/25 19:05:23 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.12 1994/01/23 17:22:02 kardel + * 1994 reconcilation + * +diff -c parse/parsesolaris.c:1.1.1.4 parse/parsesolaris.c:3.9 +*** parse/parsesolaris.c:1.1.1.4 Wed Jan 26 21:51:26 1994 +--- parse/parsesolaris.c Wed Jan 26 21:51:27 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.8 1994/01/23 17:22:04 kardel Exp + * +! * parsesolaris.c,v 3.8 1994/01/23 17:22:04 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS5.x - not fully tested - buyer beware ! - OS KILLERS may still be +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp + * +! * parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS5.x - not fully tested - buyer beware ! - OS KILLERS may still be +*************** +*** 19,25 **** + */ + + #ifndef lint +! static char rcsid[] = "parsesolaris.c,v 3.8 1994/01/23 17:22:04 kardel Exp"; + #endif + + /* +--- 19,25 ---- + */ + + #ifndef lint +! static char rcsid[] = "parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp"; + #endif + + /* +*************** +*** 139,145 **** + /*ARGSUSED*/ + int _init(void) + { +! static char revision[] = "3.8"; + char *s, *S, *t; + + /* +--- 139,145 ---- + /*ARGSUSED*/ + int _init(void) + { +! static char revision[] = "3.9"; + char *s, *S, *t; + + /* +*************** +*** 1179,1184 **** +--- 1179,1187 ---- + * History: + * + * parsesolaris.c,v ++ * Revision 3.9 1994/01/25 19:05:26 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.8 1994/01/23 17:22:04 kardel + * 1994 reconcilation + * +diff -c parse/parsestreams.c:1.1.1.6 parse/parsestreams.c:3.12 +*** parse/parsestreams.c:1.1.1.6 Wed Jan 26 21:51:28 1994 +--- parse/parsestreams.c Wed Jan 26 21:51:28 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.11 1994/01/23 17:22:07 kardel Exp + * +! * parsestreams.c,v 3.11 1994/01/23 17:22:07 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp + * +! * parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp + * + * STREAMS module for reference clocks + * (SunOS4.x) +*************** +*** 16,22 **** + */ + + #ifndef lint +! static char rcsid[] = "parsestreams.c,v 3.11 1994/01/23 17:22:07 kardel Exp"; + #endif + + #include "sys/types.h" +--- 16,22 ---- + */ + + #ifndef lint +! static char rcsid[] = "parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp"; + #endif + + #include "sys/types.h" +*************** +*** 195,201 **** + } + else + { +! static char revision[] = "3.11"; + char *s, *S, *t; + + strncpy(ifm->f_name, mname, FMNAMESZ); +--- 195,201 ---- + } + else + { +! static char revision[] = "3.12"; + char *s, *S, *t; + + strncpy(ifm->f_name, mname, FMNAMESZ); +*************** +*** 1258,1263 **** +--- 1258,1266 ---- + * History: + * + * parsestreams.c,v ++ * Revision 3.12 1994/01/25 19:05:30 kardel ++ * 94/01/23 reconcilation ++ * + * Revision 3.11 1994/01/23 17:22:07 kardel + * 1994 reconcilation + * +diff -c parse/util/Makefile.tmpl:1.1.1.2 parse/util/Makefile.tmpl:3.12 +*** parse/util/Makefile.tmpl:1.1.1.2 Wed Jan 26 21:51:31 1994 +--- parse/util/Makefile.tmpl Wed Jan 26 21:51:31 1994 +*************** +*** 1,5 **** + # +! # /src/NTP/REPOSITORY/v3/parse/util/Makefile.tmpl,v 3.11 1993/11/17 13:34:12 kardel Exp + # + COMPILER= cc + DEFS= +--- 1,5 ---- + # +! # /src/NTP/REPOSITORY/v3/parse/util/Makefile.tmpl,v 3.12 1994/01/25 19:05:39 kardel Exp + # + COMPILER= cc + DEFS= +diff -c parse/util/dcfd.c:1.1.1.4 parse/util/dcfd.c:3.15 +*** parse/util/dcfd.c:1.1.1.4 Wed Jan 26 21:51:33 1994 +--- parse/util/dcfd.c Wed Jan 26 21:51:33 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/util/dcfd.c,v 3.13 1994/01/23 17:22:15 kardel Exp + * +! * dcfd.c,v 3.13 1994/01/23 17:22:15 kardel Exp + * + * DCF77 100/200ms pulse synchronisation daemon program (via 50Baud serial line) + * +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/util/dcfd.c,v 3.15 1994/01/25 19:05:42 kardel Exp + * +! * dcfd.c,v 3.15 1994/01/25 19:05:42 kardel Exp + * + * DCF77 100/200ms pulse synchronisation daemon program (via 50Baud serial line) + * +*************** +*** 733,740 **** + * assume that we convert timecode within the unix/UTC epoch - + * prolonges validity of 2 digit years + */ +! if (clock->year < 1900) +! clock->year += 100; /* XXX this will do it till <2092 */ + + /* + * must have been a really negative year code - drop it +--- 733,740 ---- + * assume that we convert timecode within the unix/UTC epoch - + * prolonges validity of 2 digit years + */ +! if (clock->year < 1994) +! clock->year += 100; /* XXX this will do it till <2094 */ + + /* + * must have been a really negative year code - drop it +diff -c parse/util/testdcf.c:1.1.1.5 parse/util/testdcf.c:3.9 +*** parse/util/testdcf.c:1.1.1.5 Wed Jan 26 21:51:35 1994 +--- parse/util/testdcf.c Wed Jan 26 21:51:35 1994 +*************** +*** 1,7 **** + /* +! * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.8 1994/01/23 17:22:20 kardel Exp + * +! * testdcf.c,v 3.8 1994/01/23 17:22:20 kardel Exp + * + * simple DCF77 100/200ms pulse test program (via 50Baud serial line) + * +--- 1,7 ---- + /* +! * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * +! * testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * + * simple DCF77 100/200ms pulse test program (via 50Baud serial line) + * +diff -c scripts/Guess.sh:1.1.1.6 scripts/Guess.sh:1.11 +*** scripts/Guess.sh:1.1.1.6 Wed Jan 26 21:52:11 1994 +--- scripts/Guess.sh Wed Jan 26 21:52:12 1994 +*************** +*** 19,25 **** + sinix-m) + guess=sinix-m + ;; +! sunos) case "$3" in + 4.1*) guess="sunos4" ;; + 5.1) guess="sunos5.1" ;; + 5.*) guess="sunos5.2" ;; +--- 19,26 ---- + sinix-m) + guess=sinix-m + ;; +! sunos|solaris) +! case "$3" in + 4.1*) guess="sunos4" ;; + 5.1) guess="sunos5.1" ;; + 5.*) guess="sunos5.2" ;; +*************** +*** 59,65 **** + guess="netbsd" + ;; + # now the fun starts - there are vendors that +! # do not really identify their OS un uname. + # Fine - now I look at our version and hope + # that nobody else had this marvellous idea. + # I am not willing to mention the vendor explicitly +--- 60,66 ---- + guess="netbsd" + ;; + # now the fun starts - there are vendors that +! # do not really identify their OS in uname. + # Fine - now I look at our version and hope + # that nobody else had this marvellous idea. + # I am not willing to mention the vendor explicitly +diff -c xntpd/ntp_config.c:1.1.1.18 xntpd/ntp_config.c:3.21 +*** xntpd/ntp_config.c:1.1.1.18 Wed Jan 26 21:52:59 1994 +--- xntpd/ntp_config.c Wed Jan 26 21:53:00 1994 +*************** +*** 93,98 **** +--- 93,99 ---- + #define CONFIG_PPS 24 + #define CONFIG_PIDFILE 25 + #define CONFIG_LOGFILE 26 ++ #define CONFIG_SETVAR 27 + + #define CONF_MOD_VERSION 1 + #define CONF_MOD_KEY 2 +*************** +*** 177,182 **** +--- 178,184 ---- + { "statistics", CONFIG_STATISTICS }, + { "pidfile", CONFIG_PIDFILE }, + { "logfile", CONFIG_LOGFILE }, ++ { "setvar", CONFIG_SETVAR }, + { "", CONFIG_UNKNOWN } + }; + +*************** +*** 316,322 **** + #endif + extern char *FindConfig(); + char *progname; +! static char *xntp_options = "abc:de:f:k:l:p:r:s:t:"; + + static int gettokens P((FILE *, char *, char **, int *)); + static int matchkey P((char *, struct keyword *)); +--- 318,324 ---- + #endif + extern char *FindConfig(); + char *progname; +! static char *xntp_options = "abc:de:f:k:l:p:r:s:t:v:V:"; + + static int gettokens P((FILE *, char *, char **, int *)); + static int matchkey P((char *, struct keyword *)); +*************** +*** 374,381 **** + } + + if (errflg || optind != argc) { +! (void) fprintf(stderr, +! "usage: %s [ -bd ] [ -c config_file ]\n", progname); + exit(2); + } + optind = 0; /* reset optind to restart getopt_l */ +--- 376,385 ---- + } + + if (errflg || optind != argc) { +! (void) fprintf(stderr, "usage: %s [ -abd ] [ -c config_file ] [ -e encryption delay ]\n", progname); +! (void) fprintf(stderr, "\t\t[ -f frequency file ] [ -k key file ] [ -l log file ]\n"); +! (void) fprintf(stderr, "\t\t[ -p pid file ] [ -r broadcast delay ] [ -s status directory ]\n"); +! (void) fprintf(stderr, "\t\t[ -t trusted key ] [ -v sys variable ] [ -V default sys variable ]\n"); + exit(2); + } + optind = 0; /* reset optind to restart getopt_l */ +*************** +*** 428,433 **** +--- 432,438 ---- + char keyfile[MAXFILENAME]; + extern int optind; + extern char *optarg; ++ extern char *Version; + extern U_LONG info_auth_keyid; + FILEGEN *filegen; + +*************** +*** 443,448 **** +--- 448,459 ---- + res_fp = NULL; + have_resolver = have_keyfile = 0; + ++ /* ++ * install a non default variable with this daemon version ++ */ ++ (void) sprintf(line, "daemon_version=\"%s\"", Version); ++ set_sys_var(line, strlen(line)+1, RO); ++ + #ifdef RESOLVE_INTERNAL + resolve_internal = 1; + #endif +*************** +*** 546,551 **** +--- 557,566 ---- + } while (0); + break; + ++ case 'v': ++ case 'V': ++ set_sys_var(optarg, strlen(optarg)+1, RW | ((c == 'V') ? DEF : 0)); ++ break; + + default: + errflg++; +*************** +*** 1386,1392 **** + (u_char)peerkey, (u_char)peerflags); + } + break; +! + } + } + (void) fclose(fp); +--- 1401,1419 ---- + (u_char)peerkey, (u_char)peerflags); + } + break; +! +! case CONFIG_SETVAR: +! if (ntokens < 2) +! { +! syslog(LOG_ERR, +! "no value for setvar command - line ignored"); +! } +! else +! { +! set_sys_var(tokens[1], strlen(tokens[1])+1, RW | +! ((((ntokens > 2) && !strcmp(tokens[2], "default"))) ? DEF : 0)); +! } +! break; + } + } + (void) fclose(fp); +*************** +*** 1445,1450 **** +--- 1472,1478 ---- + register char *cp; + register int eol; + register int ntok; ++ register int quoted = 0; + + /* + * Find start of first token +*************** +*** 1469,1476 **** + ntok = 0; + while (!eol) { + tokenlist[ntok++] = cp; +! while (!ISEOL(*cp) && !ISSPACE(*cp)) +! cp++; + if (ISEOL(*cp)) { + *cp = '\0'; + eol = 1; +--- 1497,1505 ---- + ntok = 0; + while (!eol) { + tokenlist[ntok++] = cp; +! while (!ISEOL(*cp) && (!ISSPACE(*cp) || quoted)) +! quoted ^= (*cp++ == '"'); +! + if (ISEOL(*cp)) { + *cp = '\0'; + eol = 1; +diff -c xntpd/ntp_control.c:1.1.1.15 xntpd/ntp_control.c:3.21 +*** xntpd/ntp_control.c:1.1.1.15 Wed Jan 26 21:53:01 1994 +--- xntpd/ntp_control.c Wed Jan 26 21:53:02 1994 +*************** +*** 1,4 **** +! /* ntp_control.c,v 3.1 1993/07/06 01:11:13 jbj Exp + * ntp_control.c - respond to control messages and send async traps + */ + #include +--- 1,4 ---- +! /* + * ntp_control.c - respond to control messages and send async traps + */ + #include +*************** +*** 61,66 **** +--- 61,67 ---- + static void ctl_putclock P((int, struct refclockstat *, int)); + #endif /* REFCLOCK */ + static struct ctl_var *ctl_getitem P((struct ctl_var *, char **)); ++ static unsigned long count_var P((struct ctl_var *)); + static void control_unspec P((struct recvbuf *, int)); + static void read_status P((struct recvbuf *, int)); + static void read_variables P((struct recvbuf *, int)); +*************** +*** 83,113 **** + { NO_REQUEST, 0 } + }; + +- +- /* +- * Structure for translation tables between internal system +- * variable indices and text format. +- */ +- struct ctl_var { +- u_short code; +- u_short flags; +- char *text; +- }; +- + /* +- * Flag values +- */ +- #define CAN_READ 0x1 +- #define CAN_WRITE 0x2 +- #define PADDING 0x80 +- #define EOV 0x40 +- +- #define RO (CAN_READ) +- #define WO (CAN_WRITE) +- #define RW (CAN_READ|CAN_WRITE) +- +- +- /* + * System variable values. The array can be indexed by + * the variable index to find the textual name. + */ +--- 84,90 ---- +*************** +*** 132,141 **** + { CS_SYSTEM, RO, "system" }, /* 17 */ + { CS_KEYID, RO, "keyid" }, /* 18 */ + { CS_REFSKEW, RO, "refskew" }, /* 19 */ +! { CS_VERSION, RO, "daemon_version" }, /* 20 */ + { 0, EOV, "" } + }; + + /* + * System variables we print by default (in fuzzball order, more-or-less) + */ +--- 109,120 ---- + { CS_SYSTEM, RO, "system" }, /* 17 */ + { CS_KEYID, RO, "keyid" }, /* 18 */ + { CS_REFSKEW, RO, "refskew" }, /* 19 */ +! { CS_VARLIST, RO, "sys_var_list" },/* 20 */ + { 0, EOV, "" } + }; + ++ static struct ctl_var *ext_sys_var = (struct ctl_var *)0; ++ + /* + * System variables we print by default (in fuzzball order, more-or-less) + */ +*************** +*** 153,159 **** + CS_OFFSET, + CS_DRIFT, + CS_COMPLIANCE, +- CS_VERSION, + 0 + }; + +--- 132,137 ---- +*************** +*** 197,202 **** +--- 175,181 ---- + { CP_SENT, RO, "sent" }, /* 32 */ + { CP_FILTERROR, RO, "filterror" }, /* 33 */ + { CP_FLASH, RO, "flash" }, /* 34 */ ++ { CP_VARLIST, RO, "peer_var_list" }, /* 35 */ + { 0, EOV, "" } + }; + +*************** +*** 255,260 **** +--- 234,240 ---- + { CC_FUDGEVAL2, RO, "fudgeval2" }, /* 10 */ + { CC_FLAGS, RO, "flags" }, /* 11 */ + { CC_DEVICE, RO, "device" }, /* 12 */ ++ { CC_VARLIST, RO, "clock_var_list" },/* 13 */ + { 0, EOV, "" } + }; + +*************** +*** 283,290 **** +--- 263,277 ---- + /* + * System and processor definitions. These will change for the gizmo board. + */ ++ #ifndef STR_SYSTEM + #define STR_SYSTEM "UNIX" ++ #endif ++ #ifndef STR_PROCESSOR + #define STR_PROCESSOR "unknown" ++ #endif ++ ++ static char str_system[] = STR_SYSTEM; ++ static char str_processor[] = STR_PROCESSOR; + + /* + * Trap structures. We only allow a few of these, and send +*************** +*** 1221,1227 **** + ctl_putsys(varid) + int varid; + { +- extern char *Version; + l_fp tmp; + + switch (varid) { +--- 1208,1213 ---- +*************** +*** 1280,1291 **** + ctl_putuint(sys_var[CS_LEAPWARNING].text, (U_LONG)leap_warning); + break; + case CS_PROCESSOR: +! ctl_putstr(sys_var[CS_PROCESSOR].text, STR_PROCESSOR, +! sizeof(STR_PROCESSOR) - 1); + break; + case CS_SYSTEM: +! ctl_putstr(sys_var[CS_SYSTEM].text, STR_SYSTEM, +! sizeof(STR_SYSTEM) - 1); + break; + case CS_KEYID: + ctl_putuint(sys_var[CS_KEYID].text, (U_LONG)0); +--- 1266,1277 ---- + ctl_putuint(sys_var[CS_LEAPWARNING].text, (U_LONG)leap_warning); + break; + case CS_PROCESSOR: +! ctl_putstr(sys_var[CS_PROCESSOR].text, str_processor, +! sizeof(str_processor) - 1); + break; + case CS_SYSTEM: +! ctl_putstr(sys_var[CS_SYSTEM].text, str_system, +! sizeof(str_system) - 1); + break; + case CS_KEYID: + ctl_putuint(sys_var[CS_KEYID].text, (U_LONG)0); +*************** +*** 1293,1301 **** + case CS_REFSKEW: + ctl_putlfp(sys_var[CS_REFSKEW].text, &sys_refskew); + break; +! case CS_VERSION: +! ctl_putstr(sys_var[CS_VERSION].text, Version, +! strlen(Version)); + break; + } + } +--- 1279,1338 ---- + case CS_REFSKEW: + ctl_putlfp(sys_var[CS_REFSKEW].text, &sys_refskew); + break; +! case CS_VARLIST: +! { +! char buf[CTL_MAX_DATA_LEN]; +! register char *s, *ss, *t, *be; +! register int i; +! register struct ctl_var *k; +! +! s = buf; +! be = buf + sizeof(buf) - strlen(sys_var[CS_VARLIST].text) - 4; +! if (s > be) +! break; /* really long var name 8-( - Killer */ +! +! strcpy(s, sys_var[CS_VARLIST].text); +! strcat(s, "=\""); +! s += strlen(s); +! t = s; +! +! for (k = sys_var; !(k->flags &EOV); k++) +! { +! i = strlen(k->text); +! if (s+i+1 >= be) +! break; +! if (s != t) +! *s++ = ','; +! strcpy(s, k->text); +! s += i; +! } +! +! for (k = ext_sys_var; k && !(k->flags &EOV); k++) +! { +! ss = k->text; +! if (!ss) +! continue; +! +! while (*ss && *ss != '=') +! ss++; +! +! i = ss - k->text; +! if (s+i+1 >= be) +! break; +! if (s != t) +! *s++ = ','; +! strncpy(s, k->text, i); +! s += i; +! } +! +! if (s+2 >= be) +! break; +! +! *s++ = '"'; +! *s = '\0'; +! +! ctl_putdata(buf, s - buf, 0); +! } + break; + } + } +*************** +*** 1428,1433 **** +--- 1465,1507 ---- + case CP_SENT: + ctl_putuint(peer_var[CP_SENT].text, peer->sent); + break; ++ case CP_VARLIST: ++ { ++ char buf[CTL_MAX_DATA_LEN]; ++ register char *s, *t, *be; ++ register int i; ++ register struct ctl_var *k; ++ ++ s = buf; ++ be = buf + sizeof(buf) - strlen(peer_var[CP_VARLIST].text) - 4; ++ if (s > be) ++ break; /* really long var name 8-( - Killer */ ++ ++ strcpy(s, peer_var[CP_VARLIST].text); ++ strcat(s, "=\""); ++ s += strlen(s); ++ t = s; ++ ++ for (k = peer_var; !(k->flags &EOV); k++) ++ { ++ i = strlen(k->text); ++ if (s+i+1 >= be) ++ break; ++ if (s != t) ++ *s++ = ','; ++ strcpy(s, k->text); ++ s += i; ++ } ++ ++ if (s+2 >= be) ++ break; ++ ++ *s++ = '"'; ++ *s = '\0'; ++ ++ ctl_putdata(buf, s - buf, 0); ++ } ++ break; + } + } + +*************** +*** 1501,1506 **** +--- 1575,1636 ---- + strlen(clock->clockdesc)); + } + break; ++ case CC_VARLIST: ++ { ++ char buf[CTL_MAX_DATA_LEN]; ++ register char *s, *ss, *t, *be; ++ register int i; ++ register struct ctl_var *k; ++ ++ s = buf; ++ be = buf + sizeof(buf) - strlen(clock_var[CC_VARLIST].text) - 4; ++ if (s > be) ++ break; /* really long var name 8-( - Killer */ ++ ++ strcpy(s, clock_var[CC_VARLIST].text); ++ strcat(s, "=\""); ++ s += strlen(s); ++ t = s; ++ ++ for (k = clock_var; !(k->flags &EOV); k++) ++ { ++ i = strlen(k->text); ++ if (s+i+1 >= be) ++ break; ++ if (s != t) ++ *s++ = ','; ++ strcpy(s, k->text); ++ s += i; ++ } ++ ++ for (k = clock->kv_list; k && !(k->flags &EOV); k++) ++ { ++ ss = k->text; ++ if (!ss) ++ continue; ++ ++ while (*ss && *ss != '=') ++ ss++; ++ ++ i = ss - k->text; ++ if (s+i+1 >= be) ++ break; ++ if (s != t) ++ *s++ = ','; ++ strncpy(s, k->text, i); ++ s += i; ++ *s = '\0'; ++ } ++ ++ if (s+2 >= be) ++ break; ++ ++ *s++ = '"'; ++ *s = '\0'; ++ ++ ctl_putdata(buf, s - buf, 0); ++ } ++ break; + } + } + #endif +*************** +*** 1517,1522 **** +--- 1647,1653 ---- + { + register struct ctl_var *v; + register char *cp, *tp; ++ static struct ctl_var eol = { 0, EOV, }; + static char buf[128]; + + /* +*************** +*** 1528,1533 **** +--- 1659,1667 ---- + + if (reqpt >= reqend) + return 0; ++ ++ if (var_list == (struct ctl_var *)0) ++ return &eol; + + /* + * Look for a first character match on the tag. If we find +*************** +*** 1538,1548 **** + while (!(v->flags & EOV)) { + if (!(v->flags & PADDING) && *cp == *(v->text)) { + tp = v->text; +! while (*tp != '\0' && cp < reqend && *cp == *tp) { + cp++; + tp++; + } +! if (*tp == '\0') { + while (cp < reqend && isspace(*cp)) + cp++; + if (cp == reqend || *cp == ',') { +--- 1672,1682 ---- + while (!(v->flags & EOV)) { + if (!(v->flags & PADDING) && *cp == *(v->text)) { + tp = v->text; +! while (*tp != '\0' && *tp != '=' && cp < reqend && *cp == *tp) { + cp++; + tp++; + } +! if ((*tp == '\0') || (*tp == '=')) { + while (cp < reqend && isspace(*cp)) + cp++; + if (cp == reqend || *cp == ',') { +*************** +*** 1685,1692 **** + register struct ctl_var *v; + register int i; + char *valuep; +! u_char wants[(CS_MAXCODE>CP_MAXCODE) ? (CS_MAXCODE+1) : (CP_MAXCODE+1)]; +! int gotvar; + + if (res_associd == 0) { + /* +--- 1819,1826 ---- + register struct ctl_var *v; + register int i; + char *valuep; +! u_char *wants; +! int gotvar = (CS_MAXCODE>CP_MAXCODE) ? (CS_MAXCODE+1) : (CP_MAXCODE+1); + + if (res_associd == 0) { + /* +*************** +*** 1696,1707 **** + rpkt.status = htons(ctlsysstatus()); + if (res_authokay) + ctl_sys_num_events = 0; +! bzero((char *)wants, CS_MAXCODE+1); + gotvar = 0; + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +! ctl_error(CERR_UNKNOWNVAR); +! return; + } + wants[v->code] = 1; + gotvar = 1; +--- 1830,1853 ---- + rpkt.status = htons(ctlsysstatus()); + if (res_authokay) + ctl_sys_num_events = 0; +! gotvar += count_var(ext_sys_var); +! wants = (u_char *)emalloc(gotvar); +! bzero((char *)wants, gotvar); + gotvar = 0; + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +! if ((v = ctl_getitem(ext_sys_var, &valuep)) != 0) { +! if (v->flags & EOV) { +! ctl_error(CERR_UNKNOWNVAR); +! free((char *)wants); +! return; +! } +! wants[CS_MAXCODE+1+v->code] = 1; +! gotvar = 1; +! continue; +! } else { +! break; /* shouldn't happen ! */ +! } + } + wants[v->code] = 1; + gotvar = 1; +*************** +*** 1710,1721 **** + for (i = 1; i <= CS_MAXCODE; i++) + if (wants[i]) + ctl_putsys(i); + } else { + register u_char *cs; + + for (cs = def_sys_var; *cs != 0; cs++) +! ctl_putsys((int)*cs); + } + } else { + register struct peer *peer; + +--- 1856,1876 ---- + for (i = 1; i <= CS_MAXCODE; i++) + if (wants[i]) + ctl_putsys(i); ++ for (i = 0; ext_sys_var && !(ext_sys_var[i].flags & EOV); i++) ++ if (wants[i+CS_MAXCODE+1]) ++ ctl_putdata(ext_sys_var[i].text, ++ strlen(ext_sys_var[i].text), 0); + } else { + register u_char *cs; ++ register struct ctl_var *kv; + + for (cs = def_sys_var; *cs != 0; cs++) +! ctl_putsys((int)*cs); +! for (kv = ext_sys_var; kv && !(kv->flags & EOV); kv++) +! if (kv->flags & DEF) +! ctl_putdata(kv->text, strlen(kv->text), 0); + } ++ free((char *)wants); + } else { + register struct peer *peer; + +*************** +*** 1732,1742 **** + rpkt.status = htons(ctlpeerstatus(peer)); + if (res_authokay) + peer->num_events = 0; +! bzero((char*)wants, CP_MAXCODE+1); + gotvar = 0; + while ((v = ctl_getitem(peer_var, &valuep)) != 0) { + if (v->flags & EOV) { + ctl_error(CERR_UNKNOWNVAR); + return; + } + wants[v->code] = 1; +--- 1887,1899 ---- + rpkt.status = htons(ctlpeerstatus(peer)); + if (res_authokay) + peer->num_events = 0; +! wants = (u_char *)emalloc(gotvar); +! bzero((char*)wants, gotvar); + gotvar = 0; + while ((v = ctl_getitem(peer_var, &valuep)) != 0) { + if (v->flags & EOV) { + ctl_error(CERR_UNKNOWNVAR); ++ free((char *)wants); + return; + } + wants[v->code] = 1; +*************** +*** 1752,1757 **** +--- 1909,1915 ---- + for (cp = def_peer_var; *cp != 0; cp++) + ctl_putpeer((int)*cp, peer); + } ++ free((char *)wants); + } + ctl_flushpkt(0); + } +*************** +*** 1768,1773 **** +--- 1926,1932 ---- + int restrict; + { + register struct ctl_var *v; ++ register int ext_var; + char *valuep; + LONG val; + u_char leapind, leapwarn; +*************** +*** 1795,1831 **** + * Look through the variables. Dump out at the first sign of trouble. + */ + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +! ctl_error(CERR_UNKNOWNVAR); +! return; + } + if (!(v->flags & CAN_WRITE)) { + ctl_error(CERR_PERMISSION); + return; + } +! if (*valuep == '\0' || !atoint(valuep, &val)) { + ctl_error(CERR_BADFMT); + return; + } +! if ((val & ~LEAP_NOTINSYNC) != 0) { + ctl_error(CERR_BADVALUE); + return; + } + +! /* +! * This one seems sane. Save it. +! */ +! switch(v->code) { +! case CS_LEAP: +! case CS_LEAPIND: +! leapind = (u_char)val; +! break; +! case CS_LEAPWARNING: +! leapwarn = (u_char)val; +! break; +! default: +! ctl_error(CERR_UNSPEC); /* our fault, really */ +! return; + } + } + +--- 1954,2013 ---- + * Look through the variables. Dump out at the first sign of trouble. + */ + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { ++ ext_var = 0; + if (v->flags & EOV) { +! if ((v = ctl_getitem(ext_sys_var, &valuep)) != 0) { +! if (v->flags & EOV) { +! ctl_error(CERR_UNKNOWNVAR); +! return; +! } +! ext_var = 1; +! } else { +! break; +! } + } + if (!(v->flags & CAN_WRITE)) { + ctl_error(CERR_PERMISSION); + return; + } +! if (!ext_var && (*valuep == '\0' || !atoint(valuep, &val))) { + ctl_error(CERR_BADFMT); + return; + } +! if (!ext_var && (val & ~LEAP_NOTINSYNC) != 0) { + ctl_error(CERR_BADVALUE); + return; + } + +! if (ext_var) { +! char *s = emalloc(strlen(v->text)+strlen(valuep)+2); +! char *t, *tt = s; +! +! t = v->text; +! while (*t && *t != '=') +! *tt++ = *t++; +! +! *tt++ = '='; +! strcat(tt, valuep); +! +! set_sys_var(s, strlen(s)+1, v->flags); +! free(s); +! } else { +! /* +! * This one seems sane. Save it. +! */ +! switch(v->code) { +! case CS_LEAP: +! case CS_LEAPIND: +! leapind = (u_char)val; +! break; +! case CS_LEAPWARNING: +! leapwarn = (u_char)val; +! break; +! default: +! ctl_error(CERR_UNSPEC); /* our fault, really */ +! return; +! } + } + } + +*************** +*** 1861,1867 **** + register int i; + register struct peer *peer; + char *valuep; +! u_char wants[CC_MAXCODE+1]; + int gotvar; + struct refclockstat clock; + +--- 2043,2049 ---- + register int i; + register struct peer *peer; + char *valuep; +! u_char *wants; + int gotvar; + struct refclockstat clock; + +*************** +*** 1898,1915 **** + /* + * If we got here we have a peer which is a clock. Get his status. + */ + refclock_control(&peer->srcadr, (struct refclockstat *)0, &clock); + + /* + * Look for variables in the packet. + */ + rpkt.status = htons(ctlclkstatus(&clock)); + gotvar = 0; +! bzero((char*)wants, CC_MAXCODE+1); +! while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +! ctl_error(CERR_UNKNOWNVAR); +! return; + } + wants[v->code] = 1; + gotvar = 1; +--- 2080,2112 ---- + /* + * If we got here we have a peer which is a clock. Get his status. + */ ++ clock.kv_list = (struct ctl_var *)0; ++ + refclock_control(&peer->srcadr, (struct refclockstat *)0, &clock); + + /* + * Look for variables in the packet. + */ + rpkt.status = htons(ctlclkstatus(&clock)); ++ gotvar = CC_MAXCODE+1+count_var(clock.kv_list); ++ wants = (u_char *)emalloc(gotvar); ++ bzero((char*)wants, gotvar); + gotvar = 0; +! while ((v = ctl_getitem(clock_var, &valuep)) != 0) { + if (v->flags & EOV) { +! if ((v = ctl_getitem(clock.kv_list, &valuep)) != 0) { +! if (v->flags & EOV) { +! ctl_error(CERR_UNKNOWNVAR); +! free((char*)wants); +! free_varlist(clock.kv_list); +! return; +! } +! wants[CC_MAXCODE+1+v->code] = 1; +! gotvar = 1; +! continue; +! } else { +! break; /* shouldn't happen ! */ +! } + } + wants[v->code] = 1; + gotvar = 1; +*************** +*** 1919,1930 **** +--- 2116,2139 ---- + for (i = 1; i <= CC_MAXCODE; i++) + if (wants[i]) + ctl_putclock(i, &clock, 1); ++ for (i = 0; !(clock.kv_list[i].flags & EOV); i++) ++ if (wants[i+CC_MAXCODE+1]) ++ ctl_putdata(clock.kv_list[i].text, ++ strlen(clock.kv_list[i].text), 0); + } else { + register u_char *cc; ++ register struct ctl_var *kv; + + for (cc = def_clock_var; *cc != 0; cc++) + ctl_putclock((int)*cc, &clock, 0); ++ for (kv = clock.kv_list; kv && !(kv->flags & EOV); kv++) ++ if (kv->flags & DEF) ++ ctl_putdata(kv->text, strlen(kv->text), 0); + } ++ ++ free((char*)wants); ++ free_varlist(clock.kv_list); ++ + ctl_flushpkt(0); + #endif + } +*************** +*** 2237,2249 **** + */ + if (err == EVNT_CLOCKEXCPT) { + struct refclockstat clock; +! refclock_control(&peer->srcadr, + (struct refclockstat *)0, + &clock); + ctl_puthex("refclockstatus", + (U_LONG)ctlclkstatus(&clock)); + for (i = 1; i <= CC_MAXCODE; i++) + ctl_putclock(i, &clock, 0); + } + #endif /*REFCLOCK*/ + } else { +--- 2446,2468 ---- + */ + if (err == EVNT_CLOCKEXCPT) { + struct refclockstat clock; +! struct ctl_var *kv; +! +! clock.kv_list = (struct ctl_var *)0; +! +! refclock_control(&peer->srcadr, + (struct refclockstat *)0, + &clock); + ctl_puthex("refclockstatus", + (U_LONG)ctlclkstatus(&clock)); ++ + for (i = 1; i <= CC_MAXCODE; i++) + ctl_putclock(i, &clock, 0); ++ for (kv = clock.kv_list; kv && !(kv->flags & EOV); kv++) ++ if (kv->flags & DEF) ++ ctl_putdata(kv->text, strlen(kv->text), 0); ++ ++ free_varlist(clock.kv_list); + } + #endif /*REFCLOCK*/ + } else { +*************** +*** 2262,2274 **** +--- 2481,2504 ---- + */ + if (err == EVNT_PEERCLOCK) { + struct refclockstat clock; ++ struct ctl_var *kv; ++ ++ clock.kv_list = (struct ctl_var *)0; ++ + refclock_control(&peer->srcadr, + (struct refclockstat *)0, + &clock); ++ + ctl_puthex("refclockstatus", + (U_LONG)ctlclkstatus(&clock)); ++ + for (i = 1; i <= CC_MAXCODE; i++) + ctl_putclock(i, &clock, 0); ++ for (kv = clock.kv_list; kv && !(kv->flags & EOV); kv++) ++ if (kv->flags & DEF) ++ ctl_putdata(kv->text, strlen(kv->text), 0); ++ ++ free_varlist(clock.kv_list); + } + #endif /*REFCLOCK*/ + } +*************** +*** 2303,2305 **** +--- 2533,2647 ---- + numctlbadop = 0; + numasyncmsgs = 0; + } ++ ++ static unsigned long ++ count_var(k) ++ struct ctl_var *k; ++ { ++ register unsigned long c; ++ ++ c = 0; ++ while (k && !(k++->flags & EOV)) ++ c++; ++ ++ return c; ++ } ++ ++ char * ++ add_var(kv, size, def) ++ struct ctl_var **kv; ++ unsigned long size; ++ int def; ++ { ++ register unsigned long c; ++ register struct ctl_var *k; ++ ++ c = count_var(*kv); ++ ++ k = *kv; ++ *kv = (struct ctl_var *)emalloc((c+2)*sizeof(struct ctl_var)); ++ if (k) ++ { ++ bcopy((char *)k, (char *)*kv, sizeof(struct ctl_var)*c); ++ free((char *)k); ++ } ++ ++ (*kv)[c].code = c; ++ (*kv)[c].text = (char *)emalloc(size); ++ (*kv)[c].flags = def; ++ (*kv)[c+1].code = 0; ++ (*kv)[c+1].text = (char *)0; ++ (*kv)[c+1].flags = EOV; ++ return (*kv)[c].text; ++ } ++ ++ void ++ set_var(kv, data, size, def) ++ struct ctl_var **kv; ++ char *data; ++ unsigned long size; ++ int def; ++ { ++ register struct ctl_var *k; ++ register char *s, *t; ++ ++ if (!data || !size) ++ return; ++ ++ if ((k = *kv)) ++ { ++ while (!(k->flags & EOV)) ++ { ++ s = data; ++ t = k->text; ++ if (t) ++ { ++ while (*t != '=' && *s - *t == 0) ++ { ++ s++; ++ t++; ++ } ++ if (*s == *t && ((*t == '=') || !*t)) ++ { ++ free(k->text); ++ k->text = (char *)emalloc(size); ++ bcopy(data, k->text, size); ++ k->flags = def; ++ return; ++ } ++ } ++ else ++ { ++ k->text = (char *)emalloc(size); ++ bcopy(data, k->text, size); ++ k->flags = def; ++ return; ++ } ++ k++; ++ } ++ } ++ t = add_var(kv, size, def); ++ bcopy(data, t, size); ++ } ++ ++ void ++ set_sys_var(data, size, def) ++ char *data; ++ unsigned long size; ++ int def; ++ { ++ set_var(&ext_sys_var, data, size, def); ++ } ++ ++ void ++ free_varlist(kv) ++ struct ctl_var *kv; ++ { ++ struct ctl_var *k; ++ if (kv) ++ { ++ for (k = kv; !(k->flags & EOV); k++) ++ free(k->text); ++ free((char *)kv); ++ } ++ } +diff -c xntpd/ntp_filegen.c:1.1.1.5 xntpd/ntp_filegen.c:3.12 +*** xntpd/ntp_filegen.c:1.1.1.5 Wed Jan 26 21:53:04 1994 +--- xntpd/ntp_filegen.c Wed Jan 26 21:53:04 1994 +*************** +*** 1,5 **** + /* +! * ntp_filegen.c,v 3.10 1993/12/03 03:55:35 pruy Exp + * + * implements file generations support for NTP + * logfiles and statistic files +--- 1,5 ---- + /* +! * ntp_filegen.c,v 3.12 1994/01/25 19:06:11 kardel Exp + * + * implements file generations support for NTP + * logfiles and statistic files +diff -c xntpd/ntp_request.c:1.1.1.13 xntpd/ntp_request.c:3.13 +*** xntpd/ntp_request.c:1.1.1.13 Wed Jan 26 21:53:18 1994 +--- xntpd/ntp_request.c Wed Jan 26 21:53:18 1994 +*************** +*** 2111,2116 **** +--- 2111,2119 ---- + req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); + return; + } ++ ++ clock.kv_list = (struct ctl_var *)0; ++ + refclock_control(&addr, (struct refclockstat *)0, &clock); + + ic->clockadr = addr.sin_addr.s_addr; +*************** +*** 2128,2133 **** +--- 2131,2138 ---- + ic->fudgeval1 = htonl(clock.fudgeval1); + ic->fudgeval2 = htonl(clock.fudgeval2); + ++ free_varlist(clock.kv_list); ++ + ic = (struct info_clock *)more_pkt(); + } + flush_pkt(); +diff -c xntpd/refclock_parse.c:1.1.1.9 xntpd/refclock_parse.c:3.45 +*** xntpd/refclock_parse.c:1.1.1.9 Wed Jan 26 21:53:39 1994 +--- xntpd/refclock_parse.c Wed Jan 26 21:53:39 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.43 1994/01/23 16:28:39 kardel Exp + * +! * refclock_parse.c,v 3.43 1994/01/23 16:28:39 kardel Exp + * + * generic reference clock driver for receivers + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp + * +! * refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp + * + * generic reference clock driver for receivers + * +*************** +*** 129,135 **** + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.43 1994/01/23 16:28:39 kardel Exp"; + #endif + + /**=========================================================================== +--- 129,135 ---- + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp"; + #endif + + /**=========================================================================== +*************** +*** 243,248 **** +--- 243,249 ---- + * clock specific configuration + */ + l_fp basedelay; /* clock local phase offset */ ++ l_fp ppsdelay; /* clock local pps phase offset */ + + /* + * clock state handling/reporting +*************** +*** 295,300 **** +--- 296,302 ---- + #define NO_END (void (*)())0 + #define NO_DATA (void *)0 + #define NO_FORMAT "" ++ #define NO_PPSDELAY 0 + + #define DCF_ID "DCF" /* generic DCF */ + #define DCF_A_ID "DCFa" /* AM demodulation */ +*************** +*** 497,502 **** +--- 499,505 ---- + void *cl_data; /* local data area for "poll" mechanism */ + u_fp cl_rootdelay; /* rootdelay */ + U_LONG cl_basedelay; /* current offset - unsigned l_fp fractional part */ ++ U_LONG cl_ppsdelay; /* current PPS offset - unsigned l_fp fractional part */ + char *cl_id; /* ID code (usually "DCF") */ + char *cl_description; /* device name */ + char *cl_format; /* fixed format */ +*************** +*** 516,521 **** +--- 519,525 ---- + NO_DATA, + DCFPZF535_ROOTDELAY, + DCFPZF535_BASEDELAY, ++ NO_PPSDELAY, + DCF_P_ID, + DCFPZF535_DESCRIPTION, + NO_FORMAT, +*************** +*** 534,539 **** +--- 538,544 ---- + NO_DATA, + DCFPZF535OCXO_ROOTDELAY, + DCFPZF535OCXO_BASEDELAY, ++ NO_PPSDELAY, + DCF_P_ID, + DCFPZF535OCXO_DESCRIPTION, + NO_FORMAT, +*************** +*** 552,557 **** +--- 557,563 ---- + NO_DATA, + DCFUA31_ROOTDELAY, + DCFUA31_BASEDELAY, ++ NO_PPSDELAY, + DCF_A_ID, + DCFUA31_DESCRIPTION, + NO_FORMAT, +*************** +*** 570,575 **** +--- 576,582 ---- + NO_DATA, + DCF7000_ROOTDELAY, + DCF7000_BASEDELAY, ++ NO_PPSDELAY, + DCF_A_ID, + DCF7000_DESCRIPTION, + NO_FORMAT, +*************** +*** 588,593 **** +--- 595,601 ---- + WSDCF_DATA, + WSDCF_ROOTDELAY, + WSDCF_BASEDELAY, ++ NO_PPSDELAY, + DCF_A_ID, + WSDCF_DESCRIPTION, + WSDCF_FORMAT, +*************** +*** 606,611 **** +--- 614,620 ---- + NO_DATA, + RAWDCF_ROOTDELAY, + CONRAD_BASEDELAY, ++ NO_PPSDELAY, + DCF_A_ID, + CONRAD_DESCRIPTION, + RAWDCF_FORMAT, +*************** +*** 624,629 **** +--- 633,639 ---- + NO_DATA, + RAWDCF_ROOTDELAY, + TIMEBRICK_BASEDELAY, ++ NO_PPSDELAY, + DCF_A_ID, + TIMEBRICK_DESCRIPTION, + RAWDCF_FORMAT, +*************** +*** 642,647 **** +--- 652,658 ---- + GPS166_DATA, + GPS166_ROOTDELAY, + GPS166_BASEDELAY, ++ NO_PPSDELAY, + GPS166_ID, + GPS166_DESCRIPTION, + GPS166_FORMAT, +*************** +*** 660,665 **** +--- 671,677 ---- + TRIMBLESV6_DATA, + TRIMBLESV6_ROOTDELAY, + TRIMBLESV6_BASEDELAY, ++ NO_PPSDELAY, + TRIMBLESV6_ID, + TRIMBLESV6_DESCRIPTION, + TRIMBLESV6_FORMAT, +*************** +*** 2198,2203 **** +--- 2210,2218 ---- + parse->basedelay.l_ui = 0; /* we can only pre-configure delays less than 1 second */ + parse->basedelay.l_uf = parse->parse_type->cl_basedelay; + ++ parse->ppsdelay.l_ui = 0; /* we can only pre-configure delays less than 1 second */ ++ parse->ppsdelay.l_uf = parse->parse_type->cl_ppsdelay; ++ + peer->rootdelay = parse->parse_type->cl_rootdelay; + peer->sstclktype = parse->parse_type->cl_type; + peer->precision = sys_precision; +*************** +*** 2554,2559 **** +--- 2569,2575 ---- + out->badformat = out->baddata = 0; + out->timereset = 0; + out->currentstatus = out->lastevent = CEVNT_NOMINAL; ++ out->kv_list = (struct ctl_var *)0; + } + + if (unit >= MAXUNITS) +*************** +*** 2579,2585 **** + + if (in->haveflags & CLK_HAVETIME2) + { +! /* not USED */ + } + + if (in->haveflags & CLK_HAVEVAL1) +--- 2595,2601 ---- + + if (in->haveflags & CLK_HAVETIME2) + { +! parse->ppsdelay = in->fudgetime2; + } + + if (in->haveflags & CLK_HAVEVAL1) +*************** +*** 2619,2637 **** + if (out) + { + register unsigned LONG sum = 0; +! register char *t; + register struct tm *tm; + register short utcoff; + register char sign; + register int i; + time_t tim; + +! out->haveflags = CLK_HAVETIME1|CLK_HAVEVAL1|CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3; + out->clockdesc = parse->parse_type->cl_description; + + out->fudgetime1 = parse->basedelay; + +! L_CLR(&out->fudgetime2); + + out->fudgeval1 = (LONG)parse->peer->stratum; + +--- 2635,2655 ---- + if (out) + { + register unsigned LONG sum = 0; +! register char *t, *tt; + register struct tm *tm; + register short utcoff; + register char sign; + register int i; + time_t tim; + +! outstatus[0] = '\0'; +! +! out->haveflags = CLK_HAVETIME1|CLK_HAVETIME2|CLK_HAVEVAL1|CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3; + out->clockdesc = parse->parse_type->cl_description; + + out->fudgetime1 = parse->basedelay; + +! out->fudgetime2 = parse->ppsdelay; + + out->fudgeval1 = (LONG)parse->peer->stratum; + +*************** +*** 2657,2667 **** + */ + off = parse->time.parse_stime.fp; + L_SUB(&off, &parse->time.parse_ptime.fp); /* true offset */ +! out->fudgetime2 = off; +! out->haveflags |= CLK_HAVETIME2; + } + } + + /* + * all this for just finding out the +-xxxx part (there are always + * new and changing fields in the standards 8-(). +--- 2675,2691 ---- + */ + off = parse->time.parse_stime.fp; + L_SUB(&off, &parse->time.parse_ptime.fp); /* true offset */ +! tt = add_var(&out->kv_list, 40, RO); +! sprintf(tt, "refclock_ppsskew=%s", lfptoms(&off, 6)); + } + } + ++ if (PARSE_PPS(parse->time.parse_state)) ++ { ++ tt = add_var(&out->kv_list, 80, RO|DEF); ++ sprintf(tt, "refclock_ppstime=\"%s\"", prettydate(&parse->time.parse_ptime.fp)); ++ } ++ + /* + * all this for just finding out the +-xxxx part (there are always + * new and changing fields in the standards 8-(). +*************** +*** 2686,2702 **** + sign = '+'; + } + +! tim = parse->time.parse_time.fp.l_ui - JAN_1970; +! strcpy(outstatus, ctime(&tim)); +! t = strrchr(outstatus, '\n'); +! if (!t) + { +! t = outstatus + strlen(outstatus); +! } + else + { +! sprintf(t, " %c%02d%02d", sign, utcoff / 60, utcoff % 60); +! t += strlen(t); + } + + if (!PARSE_GETTIMECODE(parse, &tmpctl)) +--- 2710,2729 ---- + sign = '+'; + } + +! tt = add_var(&out->kv_list, 128, RO|DEF); +! sprintf(tt, "refclock_time=\""); +! tt += strlen(tt); +! +! if (parse->time.parse_time.fp.l_ui == 0) + { +! strcpy(tt, "\""); +! } + else + { +! strcpy(tt, prettydate(&parse->time.parse_time.fp)); +! t = tt + strlen(tt); +! +! sprintf(t, " (%c%02d%02d)\"", sign, utcoff / 60, utcoff % 60); + } + + if (!PARSE_GETTIMECODE(parse, &tmpctl)) +*************** +*** 2705,2731 **** + } + else + { + /* + * copy PPS flags from last read transaction (informational only) + */ + tmpctl.parsegettc.parse_state |= parse->time.parse_state & + (PARSEB_PPS|PARSEB_S_PPS); + +! if (t) +! { +! *t = ' '; +! (void) parsestate(tmpctl.parsegettc.parse_state, t+1); +! } +! else +! { +! strcat(outstatus, " "); +! (void) parsestate(tmpctl.parsegettc.parse_state, outstatus + strlen(outstatus)); +! } +! strcat(outstatus," <"); + if (tmpctl.parsegettc.parse_count) +! mkascii(outstatus+strlen(outstatus), sizeof(outstatus) - strlen(outstatus) - 1, + tmpctl.parsegettc.parse_buffer, tmpctl.parsegettc.parse_count - 1); +! strcat(outstatus,">"); + parse->badformat += tmpctl.parsegettc.parse_badformat; + } + +--- 2732,2755 ---- + } + else + { ++ tt = add_var(&out->kv_list, 128, RO|DEF); ++ sprintf(tt, "refclock_status=\""); ++ tt += strlen(tt); ++ + /* + * copy PPS flags from last read transaction (informational only) + */ + tmpctl.parsegettc.parse_state |= parse->time.parse_state & + (PARSEB_PPS|PARSEB_S_PPS); + +! (void) parsestate(tmpctl.parsegettc.parse_state, tt); +! +! strcat(tt, "\""); +! + if (tmpctl.parsegettc.parse_count) +! mkascii(outstatus+strlen(outstatus), sizeof(outstatus)- strlen(outstatus) - 1, + tmpctl.parsegettc.parse_buffer, tmpctl.parsegettc.parse_count - 1); +! + parse->badformat += tmpctl.parsegettc.parse_badformat; + } + +*************** +*** 2737,2752 **** + } + else + { +! strcat(outstatus," ("); +! strncat(outstatus, tmpctl.parseformat.parse_buffer, tmpctl.parseformat.parse_count); +! strcat(outstatus,")"); + } + + /* + * gather state statistics + */ + +! t = outstatus + strlen(outstatus); + + for (i = 0; i <= CEVNT_MAX; i++) + { +--- 2761,2780 ---- + } + else + { +! tt = add_var(&out->kv_list, 80, RO|DEF); +! sprintf(tt, "refclock_format=\""); +! +! strncat(tt, tmpctl.parseformat.parse_buffer, tmpctl.parseformat.parse_count); +! strcat(tt,"\""); + } + + /* + * gather state statistics + */ + +! tt = add_var(&out->kv_list, 200, RO|DEF); +! strcpy(tt, "refclock_states=\""); +! tt += strlen(tt); + + for (i = 0; i <= CEVNT_MAX; i++) + { +*************** +*** 2769,2787 **** + + if (stime) + { +! sprintf(t, "%s%s%s: %s (%d.%02d%%)", +! sum ? "; " : " [", + (parse->status == i) ? "*" : "", + clockstatus(i), + l_mktime(stime), + percent / 100, percent % 100); + sum += stime; +! t += strlen(t); + } + } + +! sprintf(t, "; running time: %s]", l_mktime(sum)); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; + out->timereset = parse->timestarted; +--- 2797,2824 ---- + + if (stime) + { +! sprintf(tt, "%s%s%s: %s (%d.%02d%%)", +! sum ? "; " : "", + (parse->status == i) ? "*" : "", + clockstatus(i), + l_mktime(stime), + percent / 100, percent % 100); + sum += stime; +! tt += strlen(tt); + } + } + +! sprintf(tt, "; running time: %s\"", l_mktime(sum)); +! +! tt = add_var(&out->kv_list, 32, RO); +! sprintf(tt, "refclock_id=\"%s\"", parse->parse_type->cl_id); + ++ tt = add_var(&out->kv_list, 80, RO); ++ sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); ++ ++ tt = add_var(&out->kv_list, 128, RO); ++ sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp\""); ++ + out->lencode = strlen(outstatus); + out->lastcode = outstatus; + out->timereset = parse->timestarted; +*************** +*** 3086,3091 **** +--- 3123,3130 ---- + */ + offset = parsetime->parse_ptime.fp; + ++ L_ADD(&offset, &parse->ppsdelay); ++ + if (PARSE_TIMECODE(parsetime->parse_state)) + { + if (M_ISGEQ(off.l_i, off.l_f, -1, 0x80000000) && +*************** +*** 3353,3358 **** +--- 3392,3403 ---- + * History: + * + * refclock_parse.c,v ++ * Revision 3.45 1994/01/25 19:06:27 kardel ++ * 94/01/23 reconcilation ++ * ++ * Revision 3.44 1994/01/25 17:32:23 kardel ++ * settable extended variables ++ * + * Revision 3.43 1994/01/23 16:28:39 kardel + * HAVE_TERMIOS introduced + * +diff -c -r1.1.1.8 lib/numtohost.c +*** lib/numtohost.c:1.1.1.8 1994/01/26 20:12:51 +--- lib/numtohost.c 1994/01/26 21:17:01 +*************** +*** 1,6 **** +--- 1,7 ---- + /* numtohost.c,v 3.1 1993/07/06 01:08:40 jbj Exp + * numtohost - convert network number to host name. + */ ++ #include "ntp_types.h" + #include "ntp_string.h" + #include + diff --git a/usr.sbin/xntpd/patches/patch.30 b/usr.sbin/xntpd/patches/patch.30 new file mode 100644 index 000000000000..55897f971755 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.30 @@ -0,0 +1,73 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa14619; 22 Mar 94 11:53 EST +Received: from jagubox.gsfc.nasa.gov by louie.udel.edu id aa24926; + 22 Mar 94 11:48 EST +Received: by jagubox.gsfc.nasa.gov (Smail3.1.28.1 #2) + id m0pj9dD-000C8UC; Tue, 22 Mar 94 11:48 EST +Message-Id: +From: Jim Jagielski +Subject: Small patch for xntpd 3.3p and A/UX (tickadj) +To: Mills@udel.edu +Date: Tue, 22 Mar 1994 11:48:42 -0500 (EST) +Reply-To: Jim Jagielski +In-Reply-To: <9308051324.aa24396@huey.udel.edu> from "Mills@udel.edu" at Aug 5, 93 01:24:24 pm +X-Mailer: ELM [version 2.4 PL23] +Content-Type: text +Content-Length: 1355 + +This little patch streamlines things a bit for tickadj and A/UX: + +----------->8 cut here -------------------------------- + +*** tickadj.c.orig Mon Mar 14 02:47:28 1994 +--- tickadj.c Tue Mar 22 11:41:19 1994 +*************** +*** 333,342 **** + + #if defined(SYS_AUX3) || defined(SYS_AUX2) + #define X_TICKADJ 0 +! #define X_V 1 +! #define X_TICK 2 + #define X_DEF +! static struct nlist nl[4]; + #endif + + #ifdef NeXT +--- 333,345 ---- + + #if defined(SYS_AUX3) || defined(SYS_AUX2) + #define X_TICKADJ 0 +! #define X_TICK 1 + #define X_DEF +! static struct nlist nl[] = +! { {"tickadj"}, +! {"tick"}, +! {""}, +! }; + #endif + + #ifdef NeXT +*************** +*** 428,440 **** + NULL + }; + struct stat stbuf; +- +- #if defined(SYS_AUX3) || defined(SYS_AUX2) +- strcpy (nl[X_TICKADJ].n_name, "tickadj"); +- strcpy (nl[X_V].n_name, "v"); +- strcpy (nl[X_TICK].n_name, "tick"); +- nl[3].n_name[0] = '\0'; +- #endif + + for (kname = kernels; *kname != NULL; kname++) { + if (stat(*kname, &stbuf) == -1) +--- 431,436 ---- +----------->8 cut here -------------------------------- +-- +#include + Jim Jagielski | + jim@jagubox.gsfc.nasa.gov | "Dead or alive, you're coming with me." + NASA/GSFC, Code 734.4 | RoboCop + Greenbelt, MD 20771 | + diff --git a/usr.sbin/xntpd/patches/patch.31 b/usr.sbin/xntpd/patches/patch.31 new file mode 100644 index 000000000000..33048f9de143 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.31 @@ -0,0 +1,83 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa12734; 27 Mar 94 8:52 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa20329; + 27 Mar 94 8:48 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA05771 (5.65c-6/7.3v-FAU); Sun, 27 Mar 1994 15:48:38 +0200 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA01229 (5.65c-6/7.3m-FAU); Sun, 27 Mar 1994 14:48:37 +0100 +From: Frank Kardel +Message-Id: <199403271348.AA01229@faui43.informatik.uni-erlangen.de> +Subject: minor patches +To: mills@udel.edu +Date: Sun, 27 Mar 94 15:48:32 MET DST +X-Mailer: ELM [version 2.3 PL11] + +Hi, Dave, + +I just got through manually read news (in the spool area 8-( - when +will they ever fix our news installation). + +In order to avoid ptx being picked up in AT&T machine i added hope-fully +an additional check. Why do vendor have to make machine look the +same when they aren't ? I though uname was supposed to find out - I +guess I was wrong - every vendor seems to have his own ideas about +uname and they all do not mix very well. + +The fix to numtohost allows it to compile on ptx - I hope it still +compiles on all others (should though). + +diff -c lib/numtohost.c:1.1.1.9 lib/numtohost.c:3.7 +*** lib/numtohost.c:1.1.1.9 Sun Mar 27 15:36:54 1994 +--- lib/numtohost.c Sun Mar 27 15:36:54 1994 +*************** +*** 1,12 **** +! /* numtohost.c,v 3.1 1993/07/06 01:08:40 jbj Exp + * numtohost - convert network number to host name. + */ +- #include "ntp_types.h" + #include + + #include "ntp_fp.h" +- #include "lib_strbuf.h" + #include "ntp_stdlib.h" + + #define LOOPBACKNET 0x7f000000 + #define LOOPBACKHOST 0x7f000001 +--- 1,11 ---- +! /* + * numtohost - convert network number to host name. + */ + #include + + #include "ntp_fp.h" + #include "ntp_stdlib.h" ++ #include "lib_strbuf.h" + + #define LOOPBACKNET 0x7f000000 + #define LOOPBACKHOST 0x7f000001 +diff -c scripts/Guess.sh:1.1.1.8 scripts/Guess.sh:1.13 +*** scripts/Guess.sh:1.1.1.8 Sun Mar 27 15:38:53 1994 +--- scripts/Guess.sh Sun Mar 27 15:38:53 1994 +*************** +*** 78,84 **** + 3.2.*) + case "$4" in + v*) +! (i386) >/dev/null 2>&1 && guess=ptx;; + esac + esac + fi +--- 78,84 ---- + 3.2.*) + case "$4" in + v*) +! (i386) >/dev/null 2>&1 && [ -f /usr/lib/libseq.a ] && guess=ptx;; + esac + esac + fi +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.32 b/usr.sbin/xntpd/patches/patch.32 new file mode 100644 index 000000000000..2e951cb73ef8 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.32 @@ -0,0 +1,89 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa12910; 27 Mar 94 10:06 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa22473; + 27 Mar 94 10:05 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA09307 (5.65c-6/7.3v-FAU); Sun, 27 Mar 1994 17:05:03 +0200 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA05359 (5.65c-6/7.3m-FAU); Sun, 27 Mar 1994 16:05:01 +0100 +From: Frank Kardel +Message-Id: <199403271505.AA05359@faui43.informatik.uni-erlangen.de> +Subject: more PTX related patches... +To: mills@udel.edu +Date: Sun, 27 Mar 94 17:04:56 MET DST +X-Mailer: ELM [version 2.3 PL11] + +Hi, Dave ! + +And another patche to make parse compile on PTX (Sequents +SysVR2 version). + +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/parse/parse.c,v +retrieving revision 3.23 +retrieving revision 3.24 +diff -c -r3.23 -r3.24 +*** parse/parse.c:3.23 1994/03/25 13:09:02 +--- parse/parse.c 1994/03/27 15:01:36 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp + * +! * parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp + * + * Parser module for reference clock + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.24 1994/03/27 15:01:36 kardel Exp + * +! * parse.c,v 3.24 1994/03/27 15:01:36 kardel Exp + * + * Parser module for reference clock + * +*************** +*** 29,34 **** +--- 29,38 ---- + #include "sys/time.h" + #include "sys/errno.h" + ++ #include "ntp_fp.h" ++ #include "ntp_unixtime.h" ++ #include "ntp_calendar.h" ++ + #include "ntp_machine.h" + + #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM) +*************** +*** 49,58 **** + #endif + #endif + +- #include "ntp_fp.h" +- #include "ntp_unixtime.h" +- #include "ntp_calendar.h" +- + #include "parse.h" + + #include "ntp_stdlib.h" +--- 53,58 ---- +*************** +*** 1162,1167 **** +--- 1162,1170 ---- + * History: + * + * parse.c,v ++ * Revision 3.24 1994/03/27 15:01:36 kardel ++ * reorder include file to cope with PTX ++ * + * Revision 3.23 1994/03/25 13:09:02 kardel + * considering FIXEDONLY entries only in FIXEDONLY mode + * +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.33 b/usr.sbin/xntpd/patches/patch.33 new file mode 100644 index 000000000000..e7d193409b6c --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.33 @@ -0,0 +1,75 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa13737; 27 Mar 94 15:27 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa29101; + 27 Mar 94 15:23 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA24270 (5.65c-6/7.3v-FAU); Sun, 27 Mar 1994 22:23:35 +0200 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA07515 (5.65c-6/7.3m-FAU); Sun, 27 Mar 1994 21:23:34 +0100 +From: Frank Kardel +Message-Id: <199403272023.AA07515@faui43.informatik.uni-erlangen.de> +Subject: and for patch 33? +To: mills@udel.edu +Date: Sun, 27 Mar 94 22:23:30 MET DST +X-Mailer: ELM [version 2.3 PL11] + +This should get you to Patch 33. or higher. + - gcc 2.5.8 (from Per Hedeland - gcc 2.5.8 is just + causing to many poeple to complain 8-()_ + - a an note what one can do in Config.local in HACKermode. + +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/RELNOTES,v +retrieving revision 1.1.1.11 +diff -c -r1.1.1.11 RELNOTES +*** 1.1.1.11 1994/01/30 17:08:20 +--- RELNOTES 1994/03/27 19:40:27 +*************** +*** 31,36 **** +--- 31,40 ---- + For custom tailored configuration copying Config.local.dist to Config.local + and editing Config.local to suit the local needs is neccessary (at most + 3 lines to change), or use one of the make's above and then tweak it. ++ Config.local can also be used to override common settings from the ++ machines/* files like the AUTHDEFS= to select very specific configurations. ++ Please use this feature with care and don't be disappointed if it doesn't ++ work the way you expect. + + (2) Type "make" to compile everything of general interest. Expect few or + no warnings using cc and a moderate level of warnings using gcc. +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/include/l_stdlib.h,v +retrieving revision 1.1.1.6 +diff -c -r1.1.1.6 l_stdlib.h +*** include/l_stdlib.h:1.1.1.6 1994/01/28 13:07:49 +--- include/l_stdlib.h 1994/03/27 19:34:40 +*************** +*** 70,80 **** + + extern int close P((int)); + extern int ioctl P((int, int, char *)); +! extern int read P((int, char *, unsigned)); + extern int rename P((char *, char *)); +! extern int write P((int, char *, int)); +! extern int unlink P((char *)); +! extern int link P((char *, char *)); + + #ifdef FILE + extern int fclose P((FILE *)); +--- 70,80 ---- + + extern int close P((int)); + extern int ioctl P((int, int, char *)); +! extern int read P((int, void *, unsigned)); + extern int rename P((char *, char *)); +! extern int write P((int, const void *, unsigned)); +! extern int unlink P((const char *)); +! extern int link P((const char *, const char *)); + + #ifdef FILE + extern int fclose P((FILE *)); +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.34 b/usr.sbin/xntpd/patches/patch.34 new file mode 100644 index 000000000000..a3828895ab86 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.34 @@ -0,0 +1,303 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa02155; 25 Mar 94 8:47 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa05544; + 25 Mar 94 8:45 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA27199 (5.65c-6/7.3v-FAU); Fri, 25 Mar 1994 14:45:13 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA06935 (5.65c-6/7.3m-FAU); Fri, 25 Mar 1994 14:45:11 +0100 +From: Frank Kardel +Message-Id: <199403251345.AA06935@faui43.informatik.uni-erlangen.de> +Subject: bugfixes for parse & ntpq enhancements +To: mills@udel.edu +Date: Fri, 25 Mar 94 14:45:05 MET +X-Mailer: ELM [version 2.3 PL11] + +Hi Dave, + +I have a 2 bug fixes and an ntpq enhancement: + - parse bitmap initialisation fixed + - allow for large offsets in refclock_parse (>4 min 8-() + - decode the flash bits in cooked mode + +diff -c ntpq/ntpq.c:1.1.1.21 ntpq/ntpq.c:3.22 +*** ntpq/ntpq.c:1.1.1.21 Fri Mar 25 14:32:38 1994 +--- ntpq/ntpq.c Fri Mar 25 14:32:38 1994 +*************** +*** 75,80 **** +--- 75,81 ---- + #define OC 12 /* integer, print in octal */ + #define MD 13 /* mode */ + #define AR 14 /* array of times */ ++ #define TST 15 /* test flags */ + #define EOV 255 /* end of table */ + + +*************** +*** 145,151 **** + { CP_RECEIVED, UI, "received" }, /* 31 */ + { CP_SENT, UI, "sent" }, /* 32 */ + { CP_FILTERROR, AR, "filterror" }, /* 33 */ +! { CP_FLASH, ST, "flash"}, /* 34 */ + { CP_DISP, AR, "disp" }, /* 35 */ + /* + * These are duplicate entires so that we can +--- 146,152 ---- + { CP_RECEIVED, UI, "received" }, /* 31 */ + { CP_SENT, UI, "sent" }, /* 32 */ + { CP_FILTERROR, AR, "filterror" }, /* 33 */ +! { CP_FLASH, TST, "flash"}, /* 34 */ + { CP_DISP, AR, "disp" }, /* 35 */ + /* + * These are duplicate entires so that we can +*************** +*** 189,194 **** +--- 190,209 ---- + }; + + /* ++ * flasher bits ++ */ ++ static char *tstflagnames[] = { ++ "DUPLICATE PKT", ++ "BOGUS PKT", ++ "PROTO UNSYNC", ++ "PEER BOUNDS", ++ "BAD AUTH", ++ "PEER CLOCK UNSYNC", ++ "BAD STRATUM", ++ "ROOT BOUNDS" ++ }; ++ ++ /* + * Leap values + */ + struct codestring leap_codes[] = { +*************** +*** 2836,2842 **** + output(fp, name, buf); + } + +! + + /* + * cookedprint - output variables in cooked mode +--- 2851,2895 ---- + output(fp, name, buf); + } + +! static char * +! tstflags(val) +! U_LONG val; +! { +! register char *cb, *s; +! register int i; +! register char *sep; +! +! sep = ""; +! i = 0; +! s = cb = &circ_buf[nextcb][0]; +! if (++nextcb >= NUMCB) +! nextcb = 0; +! +! sprintf(cb, "0x%x", val); +! cb += strlen(cb); +! if (val <= ((1<<8)-1)) { +! if (!val) { +! strcat(cb, ""); +! cb += strlen(cb); +! } else { +! *cb++ = '<'; +! while (val) { +! if (val & 0x1) { +! sprintf(cb, "%s%s", sep, tstflagnames[i]); +! sep = ";"; +! cb += strlen(cb); +! } +! i++; +! val >>= 1; +! } +! *cb++ = '>'; +! } +! } else { +! *cb++ = '?'; +! } +! *cb = '\0'; +! return s; +! } + + /* + * cookedprint - output variables in cooked mode +*************** +*** 2994,2999 **** +--- 3047,3059 ---- + outputarr(fp, name, narr, lfparr); + break; + ++ case TST: ++ if (!decodeuint(value, &uval)) ++ output_raw = '?'; ++ else ++ output(fp, name, tstflags(uval)); ++ break; ++ + default: + (void) fprintf(stderr, + "Internal error in cookedprint, %s=%s, fmt %d\n", +diff -c parse/parse.c:1.1.1.10 parse/parse.c:3.23 +*** parse/parse.c:1.1.1.10 Fri Mar 25 14:33:02 1994 +--- parse/parse.c Fri Mar 25 14:33:02 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * +! * parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp + * + * Parser module for reference clock + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp + * +! * parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp + * + * Parser module for reference clock + * +*************** +*** 178,183 **** +--- 178,187 ---- + { + fmt = clockformats[i]; + ++ if (!(parseio->parse_flags & PARSE_FIXED_FMT) && ++ (fmt->flags & CVT_FIXEDONLY)) ++ continue; ++ + if (fmt->flags & F_START) + { + index = fmt->startsym / 8; +*************** +*** 1158,1163 **** +--- 1162,1170 ---- + * History: + * + * parse.c,v ++ * Revision 3.23 1994/03/25 13:09:02 kardel ++ * considering FIXEDONLY entries only in FIXEDONLY mode ++ * + * Revision 3.22 1994/02/25 12:34:49 kardel + * allow for converter generated utc times + * +diff -c xntpd/refclock_parse.c:1.1.1.13 xntpd/refclock_parse.c:3.53 +*** xntpd/refclock_parse.c:1.1.1.13 Fri Mar 25 14:35:07 1994 +--- xntpd/refclock_parse.c Fri Mar 25 14:35:08 1994 +*************** +*** 1,8 **** + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * +! * refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * + * generic reference clock driver for receivers + * +--- 1,8 ---- + #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) + /* +! * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp + * +! * refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp + * + * generic reference clock driver for receivers + * +*************** +*** 129,135 **** + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp"; + #endif + + /**=========================================================================== +--- 129,135 ---- + #include "parse.h" + + #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) +! static char rcsid[]="refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp"; + #endif + + /**=========================================================================== +*************** +*** 2824,2830 **** + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +--- 2824,2830 ---- + sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); + + tt = add_var(&out->kv_list, 128, RO); +! sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp\""); + + out->lencode = strlen(outstatus); + out->lastcode = outstatus; +*************** +*** 3103,3109 **** + L_ADD(&off, &offset); + rectime = off; /* this makes org time and xmt time somewhat artificial */ + +! if (parse->flags & PARSE_STAT_FILTER) + { + struct timeval usecerror; + /* +--- 3103,3113 ---- + L_ADD(&off, &offset); + rectime = off; /* this makes org time and xmt time somewhat artificial */ + +! L_SUB(&off, &parsetime->parse_stime.fp); +! +! if ((parse->flags & PARSE_STAT_FILTER) && +! (off.l_i > -60) && +! (off.l_i < 60)) /* take usec error only if within +- 60 secs */ + { + struct timeval usecerror; + /* +*************** +*** 3115,3124 **** + sTVTOTS(&usecerror, &off); + L_ADD(&off, &offset); + } +- else +- { +- L_SUB(&off, &parsetime->parse_stime.fp); +- } + } + + if (PARSE_PPS(parsetime->parse_state) && CL_PPS(parse->unit)) +--- 3119,3124 ---- +*************** +*** 3409,3414 **** +--- 3409,3420 ---- + * History: + * + * refclock_parse.c,v ++ * Revision 3.53 1994/03/25 13:07:39 kardel ++ * fixed offset calculation for large (>4 Min) offsets ++ * ++ * Revision 3.52 1994/03/03 09:58:00 kardel ++ * stick -kv in cvs is no fun ++ * + * Revision 3.49 1994/02/20 13:26:00 kardel + * rcs id cleanup + * +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.35 b/usr.sbin/xntpd/patches/patch.35 new file mode 100644 index 000000000000..e6b1ea4436d7 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.35 @@ -0,0 +1,914 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa25410; 3 Apr 94 18:04 EDT +Received: from adrastea.lcs.mit.edu by louie.udel.edu id aa09227; + 3 Apr 94 17:56 EDT +Received: by adrastea.lcs.mit.edu; id AA26407; Sun, 3 Apr 1994 17:56:48 -0400 +Date: Sun, 3 Apr 1994 17:56:48 -0400 +From: Garrett Wollman +Message-Id: <9404032156.AA26407@adrastea.lcs.mit.edu> +To: Dave Mills +Subject: xntpd 3.3p changes for FreeBSD + +This still doesn't solve the 18-second discrepancy. However, the +patch file below shows the current differences between xntp3.3p and +the FreeBSD version of same, deleted files not included. I have also +included the Makefiles that we use to provide some idea of our build +structure. (Thankfully, xntp---unlike some other popular pieces of +software---has a sane directory structure to begin with, so it isn't +nearly as difficult to handle this sort of thing than it is with, say, +GCC.) + +diff -c /dev/null 386BSD/src/contrib/xntpd/Makefile.inc:1.3 +*** /dev/null Sun Apr 3 13:42:15 1994 +--- 386BSD/src/contrib/xntpd/Makefile.inc Sun Apr 3 13:42:15 1994 +*************** +*** 0 **** +--- 1,7 ---- ++ DEFS_LOCAL=-DREFCLOCK -DPARSE ++ NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD -DHAVE_TERMIOS ++ AUTHDEFS= -DMD5 ++ CLOCKDEFS= -DLOCAL_CLOCK -DPST -DWWVB -DAS2201 -DGOES -DGPSTM -DOMEGA \ ++ -DLEITCH -DTRAK ++ CFLAGS+= ${NTPDEFS} ${DEFS_LOCAL} ${AUTHDEFS} ${CLOCKDEFS} ${COPTS} ++ BINDIR?= /usr/sbin +diff -c /dev/null 386BSD/src/contrib/xntpd/README.FreeBSD:1.5 +*** /dev/null Sun Apr 3 13:42:15 1994 +--- 386BSD/src/contrib/xntpd/README.FreeBSD Sun Apr 3 13:42:15 1994 +*************** +*** 0 **** +--- 1,78 ---- ++ This version of NTP was converted to the BSD-style Makefile system by ++ Garrett Wollman (wollman@freefall.cdrom.com); it is based on version ++ 3.3p (late beta) from the University of Delaware. ++ ++ Besides the Makefile changes, the DES code has been completely removed ++ in order to make this code exportable. If you have a legal copy of ++ `authdes.c', you can just add it to the lib/ directory and add `-DDES' ++ to the AUTHDEFS in Makefile.inc. ++ ++ You can change CLOCKDEFS in the same file to add other reference clocks. ++ ++ ---------------------------------------------------- ++ Support for Conrad electronic's "DCF-77 Uhr, Mobil". ++ ---------------------------------------------------- ++ Conrad electronic in Germany,, Phone (+49) 962230111 (?), sells a gadget ++ called "DCF77 Uhr, mobil", which is a DCF77 timecode receiver with a ++ rs-232 interface. The price is around DM130. ++ 9-pin interface is Order# 97 94 57 66 ++ 25-pin interface is Order# 97 94 81 66 ++ ++ You must define ++ -DDCF77 -DPPS -DFREEBSD_CONRAD -DDEBUG ++ when you compile xntpd. You can later remove -DDEBUG, if you feel like it. ++ ++ You must also have ++ options COM_BIDIR ++ defined in your kernel, and finally the ttyport you intend to use must ++ have special interrupt vector: ++ device sio1 at isa? port "IO_COM2" tty irq 3 vector siointrts ++ ^^^^^^^^^^^^ ++ connect the radio-clock to the tty port and link it to /dev/refclock-0: ++ ++ cd /dev ++ sh MAKEDEV cua1 ++ ln -s /dev/cua01 /dev/refclock-0 ++ ++ make a directory to gather statistics in: ++ mkdir /var/tmp/ntp ++ ++ Create a /etc/ntp.conf along these lines: ++ ++ # DCF77 without PPS ++ server 127.127.8.20 ++ # DCF77 with PPS ++ #server 127.127.8.148 prefer ++ ++ driftfile /var/tmp/ntp/ntp.drift ++ statsdir /var/tmp/ntp ++ statistics loopstats ++ statistics peerstats ++ statistics clockstats ++ filegen peerstats file peerstats type day enable ++ filegen loopstats file loopstats type day enable ++ filegen clockstats file clockstats type day enable ++ ++ Try to start it: ++ comcontrol ttyd1 bidir ++ tickadj -A ++ xntpd -d -d -d ++ ++ You should see the red LED flash on the receiver every second now. You ++ may have to experiment a bit with the location, and possibly adjust the ++ minute variable resistor inside to get a good signal. Be aware, that just ++ because you see the light flash, is not the same as the signal being ++ received by the computer. The chip doing the work in the reciver uses ++ less than 1 micro-ampere, so even if RTS isn't pulled low, it will happily ++ receive, but be unable to buffer the signal to the rs-232 levels needed. ++ ++ You can see what's going on in /var/log/messages, and query the ++ daemon using xntpdc and ntpq, in particular the "clockvar" command ++ of ntpq will tell about the clocks healt. ++ ++ I live in Slagelse, Denmark, which is ~1000 Km from Mainflingen, yet ++ I have +/- 2 ms precision from this cheap gadget. If you have a very ++ stable signal, you can use the 'pps' address instead to improve your ++ timing. ++ ++ Have fun... Poul-Henning Kamp +diff -c /dev/null 386BSD/src/contrib/xntpd/authstuff/Makefile:1.2 +*** /dev/null Sun Apr 3 13:42:19 1994 +--- 386BSD/src/contrib/xntpd/authstuff/Makefile Sun Apr 3 13:42:20 1994 +*************** +*** 0 **** +--- 1,27 ---- ++ # ++ # $Id: Makefile,v 1.2 1993/12/22 11:32:10 rgrimes Exp $ ++ # ++ # Most of the programs in this directory are completely useless for the ++ # NTP configuration that we provide by default. ++ # We provide the `md5' program as a public service. ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= ${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= ${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= md5 ++ ++ SRCS= md5driver.c ++ NOMAN= ++ ++ install: ++ ++ .include +diff -c 386BSD/src/contrib/xntpd/authstuff/md5driver.c:1.1.1.2 386BSD/src/contrib/xntpd/authstuff/md5driver.c:1.2 +*** 386BSD/src/contrib/xntpd/authstuff/md5driver.c:1.1.1.2 Sun Apr 3 13:42:20 1994 +--- 386BSD/src/contrib/xntpd/authstuff/md5driver.c Sun Apr 3 13:42:20 1994 +*************** +*** 30,36 **** +--- 30,38 ---- + #endif /* SYS_BSDI */ + #include "md5.h" + ++ #ifndef MD5 + #define MD5 ++ #endif + #include "ntp_string.h" + #include "ntp_stdlib.h" + +diff -c /dev/null 386BSD/src/contrib/xntpd/clockstuff/Makefile:1.1 +*** /dev/null Sun Apr 3 13:42:21 1994 +--- 386BSD/src/contrib/xntpd/clockstuff/Makefile Sun Apr 3 13:42:21 1994 +*************** +*** 0 **** +--- 1,16 ---- ++ # ++ # $Id: Makefile,v 1.1 1993/12/21 21:06:24 wollman Exp $ ++ # ++ ++ PROG= propdelay ++ LIBADD= -L${.CURDIR}/../lib -lntp -lm ++ DPADD= ${.CURDIR}/../lib/libntp.a ++ ++ SRCS= propdelay.c ++ NOMAN= ++ ++ install: ++ ++ CLEANFILES+= chutest clktest chutest.o clktest.o ++ ++ .include +diff -c /dev/null 386BSD/src/contrib/xntpd/lib/Makefile:1.5 +*** /dev/null Sun Apr 3 13:43:01 1994 +--- 386BSD/src/contrib/xntpd/lib/Makefile Sun Apr 3 13:43:01 1994 +*************** +*** 0 **** +--- 1,30 ---- ++ # ++ # $Id: Makefile,v 1.5 1994/04/03 20:37:05 wollman Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ SRCS= atoint.c atolfp.c atouint.c auth12crypt.c authdecrypt.c authdes.c \ ++ authencrypt.c authkeys.c authparity.c authreadkeys.c authusekey.c \ ++ buftvtots.c caljulian.c calleapwhen.c caltontp.c calyearstart.c \ ++ clocktime.c dofptoa.c dolfptoa.c emalloc.c fptoa.c fptoms.c \ ++ gettstamp.c hextoint.c hextolfp.c humandate.c inttoa.c \ ++ lib_strbuf.c mfptoa.c mfptoms.c modetoa.c mstolfp.c \ ++ msutotsf.c netof.c numtoa.c refnumtoa.c numtohost.c octtoint.c \ ++ prettydate.c ranny.c tsftomsu.c tstotv.c tvtoa.c tvtots.c \ ++ uglydate.c uinttoa.c utvtoa.c clocktypes.c \ ++ md5.c a_md5encrypt.c a_md5decrypt.c \ ++ a_md512crypt.c decodenetnum.c systime.c msyslog.c syssignal.c \ ++ findconfig.c getopt.c ++ ++ NOMAN= ++ NOPROFILE= ++ LIB= ntp ++ CLEANFILES+=authdes.c ++ ++ install: ++ ++ authdes.c: authdes.c.export ++ cp ${.CURDIR}/authdes.c.export authdes.c ++ ++ .include +diff -c /dev/null 386BSD/src/contrib/xntpd/ntpdate/Makefile:1.3 +*** /dev/null Sun Apr 3 13:43:27 1994 +--- 386BSD/src/contrib/xntpd/ntpdate/Makefile Sun Apr 3 13:43:27 1994 +*************** +*** 0 **** +--- 1,28 ---- ++ # ++ # $Id: Makefile,v 1.3 1993/12/22 11:32:56 rgrimes Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= -L${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= -L${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= ntpdate ++ MAN8= ${.CURDIR}/../doc/ntpdate.8 ++ CLEANFILES+= .version version.c ++ ++ SRCS= ntpdate.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion ntpdate ++ ++ .include +diff -c /dev/null 386BSD/src/contrib/xntpd/ntpq/Makefile:1.3 +*** /dev/null Sun Apr 3 13:43:28 1994 +--- 386BSD/src/contrib/xntpd/ntpq/Makefile Sun Apr 3 13:43:29 1994 +*************** +*** 0 **** +--- 1,29 ---- ++ # ++ # $Id: Makefile,v 1.3 1993/12/22 11:33:07 rgrimes Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= -L${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= -L${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= ntpq ++ MAN8= ${.CURDIR}/../doc/ntpq.8 ++ CLEANFILES+= .version version.c ++ BINDIR= /usr/bin ++ ++ SRCS= ntpq.c ntpq_ops.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion ntpq ++ ++ .include +diff -c 386BSD/src/contrib/xntpd/ntpq/ntpq.c:1.1.1.2 386BSD/src/contrib/xntpd/ntpq/ntpq.c:1.2 +*** 386BSD/src/contrib/xntpd/ntpq/ntpq.c:1.1.1.2 Sun Apr 3 13:43:30 1994 +--- 386BSD/src/contrib/xntpd/ntpq/ntpq.c Sun Apr 3 13:43:30 1994 +*************** +*** 301,307 **** + static int decodearr P((char *, int *, l_fp *)); + static char * getcode P((int, struct codestring *)); + static void help P((struct parse *, FILE *)); +! #if defined(sgi) || defined(SYS_BSDI) + static int helpsort P((const void *, const void *)); + #else + static int helpsort P((char **, char **)); +--- 301,307 ---- + static int decodearr P((char *, int *, l_fp *)); + static char * getcode P((int, struct codestring *)); + static void help P((struct parse *, FILE *)); +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + static int helpsort P((const void *, const void *)); + #else + static int helpsort P((char **, char **)); +*************** +*** 335,341 **** + static void endoutput P((FILE *)); + static void outputarr P((FILE *, char *, int, l_fp *)); + static void cookedprint P((int, int, char *, int, FILE *)); +! #if defined(sgi) || defined(SYS_BSDI) + static int assoccmp P((const void *, const void *)); + #else + static int assoccmp P((struct association *, struct association *)); +--- 335,341 ---- + static void endoutput P((FILE *)); + static void outputarr P((FILE *, char *, int, l_fp *)); + static void cookedprint P((int, int, char *, int, FILE *)); +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + static int assoccmp P((const void *, const void *)); + #else + static int assoccmp P((struct association *, struct association *)); +*************** +*** 1888,1894 **** + for (xcp = opcmds; xcp->keyword != 0; xcp++) + cmdsort[n++] = xcp->keyword; + +! #if defined(sgi) || defined(SYS_BSDI) + qsort((void *)cmdsort, n, sizeof(char *), helpsort); + #else + qsort((char *)cmdsort, n, sizeof(char *), helpsort); +--- 1888,1894 ---- + for (xcp = opcmds; xcp->keyword != 0; xcp++) + cmdsort[n++] = xcp->keyword; + +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + qsort((void *)cmdsort, n, sizeof(char *), helpsort); + #else + qsort((char *)cmdsort, n, sizeof(char *), helpsort); +*************** +*** 1934,1940 **** + * helpsort - do hostname qsort comparisons + */ + static int +! #if defined(sgi) || defined(SYS_BSDI) + helpsort(t1, t2) + const void *t1; + const void *t2; +--- 1934,1940 ---- + * helpsort - do hostname qsort comparisons + */ + static int +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + helpsort(t1, t2) + const void *t1; + const void *t2; +*************** +*** 3028,3034 **** + sortassoc() + { + if (numassoc > 1) +! #if defined(sgi) || defined(SYS_BSDI) + qsort((void *)assoc_cache, numassoc, + sizeof(struct association), assoccmp); + #else +--- 3028,3034 ---- + sortassoc() + { + if (numassoc > 1) +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + qsort((void *)assoc_cache, numassoc, + sizeof(struct association), assoccmp); + #else +*************** +*** 3042,3048 **** + * assoccmp - compare two associations + */ + static int +! #if defined(sgi) || defined(SYS_BSDI) + assoccmp(t1, t2) + const void *t1; + const void *t2; +--- 3042,3048 ---- + * assoccmp - compare two associations + */ + static int +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + assoccmp(t1, t2) + const void *t1; + const void *t2; +diff -c /dev/null 386BSD/src/contrib/xntpd/ntptrace/Makefile:1.2 +*** /dev/null Sun Apr 3 13:43:31 1994 +--- 386BSD/src/contrib/xntpd/ntptrace/Makefile Sun Apr 3 13:43:31 1994 +*************** +*** 0 **** +--- 1,28 ---- ++ # ++ # $Id: Makefile,v 1.2 1993/12/22 11:33:14 rgrimes Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= -L${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= -L${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= ntptrace ++ MAN8= ${.CURDIR}/../doc/ntptrace.8 ++ CLEANFILES+= .version version.c ++ ++ SRCS= ntptrace.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion ntptrace ++ ++ .include +diff -c /dev/null 386BSD/src/contrib/xntpd/parse/Makefile:1.1 +*** /dev/null Sun Apr 3 13:43:32 1994 +--- 386BSD/src/contrib/xntpd/parse/Makefile Sun Apr 3 13:43:32 1994 +*************** +*** 0 **** +--- 1,19 ---- ++ # ++ # $Id: Makefile,v 1.1 1993/12/21 20:04:14 wollman Exp $ ++ # ++ ++ PARSEFLAGS= -DCLOCK_SCHMID -DCLOCK_DCF7000 -DCLOCK_MEINBERG \ ++ -DCLOCK_RAWDCF -DCLOCK_TRIMSV6 ++ ++ CFLAGS+= -I${.CURDIR}/../include ${PARSEFLAGS} ++ ++ SRCS= parse.c parse_conf.c clk_meinberg.c clk_schmid.c clk_rawdcf.c \ ++ clk_dcf7000.c clk_trimble.c ++ ++ NOMAN= ++ NOPROFILE= ++ LIB= parse ++ ++ install: ++ ++ .include +diff -c 386BSD/src/contrib/xntpd/scripts/mkversion:1.1.1.1 386BSD/src/contrib/xntpd/scripts/mkversion:1.2 +*** 386BSD/src/contrib/xntpd/scripts/mkversion:1.1.1.1 Sun Apr 3 13:43:49 1994 +--- 386BSD/src/contrib/xntpd/scripts/mkversion Sun Apr 3 13:43:49 1994 +*************** +*** 9,20 **** + echo $RUN > .version + + DATE="`date`" + + if [ -r VERSION ]; then + VERSION=VERSION + else + VERSION=../VERSION +! fi + + if [ -f "$VERSION" ]; then + FLAGS="`egrep '^[0-9a-zA-Z_]+=' "$VERSION" | tr '\012' ';'` " +--- 9,23 ---- + echo $RUN > .version + + DATE="`date`" ++ TOPDIR=`echo $0 | sed -e 's;mkversion;..;'` + + if [ -r VERSION ]; then + VERSION=VERSION ++ else if [ -r ${TOPDIR}/VERSION ]; then ++ VERSION=${TOPDIR}/VERSION + else + VERSION=../VERSION +! fi; fi + + if [ -f "$VERSION" ]; then + FLAGS="`egrep '^[0-9a-zA-Z_]+=' "$VERSION" | tr '\012' ';'` " +diff -c /dev/null 386BSD/src/contrib/xntpd/util/Makefile:1.2 +*** /dev/null Sun Apr 3 13:43:53 1994 +--- 386BSD/src/contrib/xntpd/util/Makefile Sun Apr 3 13:43:54 1994 +*************** +*** 0 **** +--- 1,28 ---- ++ # ++ # $Id: Makefile,v 1.2 1993/12/22 11:33:28 rgrimes Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= -L${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= -L${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= tickadj ++ MAN8= ${.CURDIR}/../doc/tickadj.8 ++ CLEANFILES+= .version version.c ++ ++ SRCS= tickadj.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion tickadj ++ ++ .include +diff -c /dev/null 386BSD/src/contrib/xntpd/xntpd/Makefile:1.5 +*** /dev/null Sun Apr 3 13:43:56 1994 +--- 386BSD/src/contrib/xntpd/xntpd/Makefile Sun Apr 3 13:43:56 1994 +*************** +*** 0 **** +--- 1,45 ---- ++ # ++ # $Id: Makefile,v 1.5 1994/04/03 20:37:26 wollman Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= ${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= ${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ .if exists(${.CURDIR}/../parse/obj) ++ LDADD+= -L${.CURDIR}/../parse/obj ++ DPADD+= ${.CURDIR}/../parse/obj/libparse.a ++ .else ++ LDADD+= -L${.CURDIR}/../parse ++ DPADD+= ${.CURDIR}/../parse/libparse.a ++ .endif ++ ++ LDADD+= -lntp -lparse ++ ++ PROG= xntpd ++ MAN8= ${.CURDIR}/../doc/xntpd.8 ++ CLEANFILES+= .version version.c ++ ++ SRCS= ntp_config.c ntp_control.c ntp_io.c ntp_leap.c \ ++ ntp_loopfilter.c ntp_monitor.c ntp_peer.c ntp_proto.c \ ++ ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \ ++ ntp_unixclock.c ntp_util.c ntpd.c refclock_chu.c \ ++ refclock_conf.c refclock_local.c refclock_pst.c \ ++ refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ ++ refclock_parse.c refclock_as2201.c refclock_omega.c \ ++ refclock_tpro.c refclock_leitch.c refclock_irig.c \ ++ refclock_msfees.c refclock_gpstm.c refclock_trak.c ntp_intres.c \ ++ ntp_filegen.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion xntpd ++ ++ .include +diff -c 386BSD/src/contrib/xntpd/xntpd/ntp_control.c:1.1.1.3 386BSD/src/contrib/xntpd/xntpd/ntp_control.c:1.3 +*** 386BSD/src/contrib/xntpd/xntpd/ntp_control.c:1.1.1.3 Sun Apr 3 13:43:59 1994 +--- 386BSD/src/contrib/xntpd/xntpd/ntp_control.c Sun Apr 3 13:44:00 1994 +*************** +*** 264,278 **** + /* + * System and processor definitions. These will change for the gizmo board. + */ +! #ifndef STR_SYSTEM +! #define STR_SYSTEM "UNIX" +! #endif +! #ifndef STR_PROCESSOR +! #define STR_PROCESSOR "unknown" +! #endif +! +! static char str_system[] = STR_SYSTEM; +! static char str_processor[] = STR_PROCESSOR; + + /* + * Trap structures. We only allow a few of these, and send +--- 264,271 ---- + /* + * System and processor definitions. These will change for the gizmo board. + */ +! #include +! static struct utsname utsname; + + /* + * Trap structures. We only allow a few of these, and send +*************** +*** 433,438 **** +--- 426,433 ---- + { + int i; + ++ uname(&utsname); ++ + ctl_clr_stats(); + + ctl_auth_keyid = 0; +*************** +*** 1267,1278 **** + ctl_putuint(sys_var[CS_LEAPWARNING].text, (U_LONG)leap_warning); + break; + case CS_PROCESSOR: +! ctl_putstr(sys_var[CS_PROCESSOR].text, str_processor, +! sizeof(str_processor) - 1); + break; + case CS_SYSTEM: +! ctl_putstr(sys_var[CS_SYSTEM].text, str_system, +! sizeof(str_system) - 1); + break; + case CS_KEYID: + ctl_putuint(sys_var[CS_KEYID].text, (U_LONG)0); +--- 1262,1273 ---- + ctl_putuint(sys_var[CS_LEAPWARNING].text, (U_LONG)leap_warning); + break; + case CS_PROCESSOR: +! ctl_putstr(sys_var[CS_PROCESSOR].text, utsname.machine, +! strlen(utsname.machine)); + break; + case CS_SYSTEM: +! ctl_putstr(sys_var[CS_SYSTEM].text, utsname.sysname, +! strlen(utsname.sysname)); + break; + case CS_KEYID: + ctl_putuint(sys_var[CS_KEYID].text, (U_LONG)0); +diff -c 386BSD/src/contrib/xntpd/xntpd/refclock_parse.c:1.1.1.3 386BSD/src/contrib/xntpd/xntpd/refclock_parse.c:1.3 +*** 386BSD/src/contrib/xntpd/xntpd/refclock_parse.c:1.1.1.3 Sun Apr 3 13:44:01 1994 +--- 386BSD/src/contrib/xntpd/xntpd/refclock_parse.c Sun Apr 3 13:44:01 1994 +*************** +*** 30,35 **** +--- 30,37 ---- + * PPS - supply loopfilter with PPS samples (if configured) + * PPSPPS - notify loopfilter of PPS file descriptor + * ++ * FREEBSD_CONRAD - Make very cheap "Conrad DCF77 RS-232" gadget work ++ * with FreeBSD. + * TTY defines: + * HAVE_BSD_TTYS - currently unsupported + * HAVE_SYSV_TTYS - will use termio.h +*************** +*** 82,87 **** +--- 84,92 ---- + #include + + #include ++ #ifdef FREEBSD_CONRAD ++ #include ++ #endif + extern int errno; + + #if !defined(STREAM) && !defined(HAVE_SYSV_TTYS) && !defined(HAVE_BSD_TTYS) && !defined(HAVE_TERMIOS) +*************** +*** 440,446 **** +--- 445,456 ---- + #define RAWDCF_ROOTDELAY 0x00000364 /* 13 ms */ + #define RAWDCF_FORMAT "RAW DCF77 Timecode" + #define RAWDCF_MAXUNSYNC (0) /* sorry - its a true receiver - no signal - no time */ ++ ++ #ifdef FREEBSD_CONRAD ++ #define RAWDCF_CFLAG (CS8|CREAD|CLOCAL) ++ #else + #define RAWDCF_CFLAG (B50|CS8|CREAD|CLOCAL) ++ #endif + #define RAWDCF_IFLAG 0 + #define RAWDCF_OFLAG 0 + #define RAWDCF_LFLAG 0 +*************** +*** 1482,1492 **** +--- 1492,1513 ---- + struct parseunit *parse = (struct parseunit *)rbufp->recv_srcclock; + register int count; + register char *s; ++ #ifdef FREEBSD_CONRAD ++ struct timeval foo; ++ #endif ++ + /* + * eat all characters, parsing then and feeding complete samples + */ + count = rbufp->recv_length; + s = rbufp->recv_buffer; ++ #ifdef FREEBSD_CONRAD ++ ioctl(parse->fd,TIOCTIMESTAMP,&foo); ++ TVTOTS(&foo, &rbufp->recv_time); ++ rbufp->recv_time.l_uf += TS_ROUNDBIT; ++ rbufp->recv_time.l_ui += JAN_1970; ++ rbufp->recv_time.l_uf &= TS_MASK; ++ #endif + + while (count--) + { +*************** +*** 2271,2277 **** + tm.c_iflag = clockinfo[type].cl_iflag; + tm.c_oflag = clockinfo[type].cl_oflag; + tm.c_lflag = clockinfo[type].cl_lflag; +! + if (TTY_SETATTR(fd232, &tm) == -1) + { + syslog(LOG_ERR, "PARSE receiver #%d: parse_start: tcsetattr(%d, &tm): %m", unit, fd232); +--- 2292,2301 ---- + tm.c_iflag = clockinfo[type].cl_iflag; + tm.c_oflag = clockinfo[type].cl_oflag; + tm.c_lflag = clockinfo[type].cl_lflag; +! #ifdef FREEBSD_CONRAD +! tm.c_ispeed = 50; +! tm.c_ospeed = 50; +! #endif + if (TTY_SETATTR(fd232, &tm) == -1) + { + syslog(LOG_ERR, "PARSE receiver #%d: parse_start: tcsetattr(%d, &tm): %m", unit, fd232); +*************** +*** 2314,2319 **** +--- 2338,2358 ---- + return 0; /* well, ok - special initialisation broke */ + } + ++ #ifdef FREEBSD_CONRAD ++ { ++ int i,j; ++ struct timeval tv; ++ ioctl(parse->fd,TIOCTIMESTAMP,&tv); ++ j = TIOCM_RTS; ++ i = ioctl(fd232, TIOCMBIC, &j); ++ if (i < 0) { ++ syslog(LOG_ERR, ++ "PARSE receiver #%d: lowrts_poll: failed to lower RTS: %m", ++ CL_UNIT(parse->unit)); ++ } ++ } ++ #endif ++ + strcpy(tmp_ctl.parseformat.parse_buffer, parse->parse_type->cl_format); + tmp_ctl.parseformat.parse_count = strlen(tmp_ctl.parseformat.parse_buffer); + +diff -c 386BSD/src/contrib/xntpd/xntpd/refclock_trak.c:1.1.1.1 386BSD/src/contrib/xntpd/xntpd/refclock_trak.c:1.2 +*** 386BSD/src/contrib/xntpd/xntpd/refclock_trak.c:1.1.1.1 Sun Apr 3 13:44:02 1994 +--- 386BSD/src/contrib/xntpd/xntpd/refclock_trak.c Sun Apr 3 13:44:02 1994 +*************** +*** 14,19 **** +--- 14,21 ---- + #include "ntp_refclock.h" + #include "ntp_unixtime.h" + ++ static void gps_send(); ++ + #if defined(HAVE_BSD_TTYS) + #include + #endif /* HAVE_BSD_TTYS */ +*************** +*** 841,847 **** + /* + * usually trak_receive can get a timestamp every second + */ +! #ifndef TRAKPPS && TRAKCLK + gettstamp(&gps->lastrec); + #endif + gps->polls++; +--- 843,849 ---- + /* + * usually trak_receive can get a timestamp every second + */ +! #if !defined(TRAKPPS) && !defined(TRAKCLK) + gettstamp(&gps->lastrec); + #endif + gps->polls++; +diff -c /dev/null 386BSD/src/contrib/xntpd/xntpdc/Makefile:1.2 +*** /dev/null Sun Apr 3 13:44:03 1994 +--- 386BSD/src/contrib/xntpd/xntpdc/Makefile Sun Apr 3 13:44:03 1994 +*************** +*** 0 **** +--- 1,28 ---- ++ # ++ # $Id: Makefile,v 1.2 1993/12/22 11:34:00 rgrimes Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= -L${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= -L${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= xntpdc ++ MAN8= ${.CURDIR}/../doc/xntpdc.8 ++ CLEANFILES+= .version version.c ++ ++ SRCS= ntpdc.c ntpdc_ops.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion xntpdc ++ ++ .include +diff -c 386BSD/src/contrib/xntpd/xntpdc/ntpdc.c:1.1.1.3 386BSD/src/contrib/xntpd/xntpdc/ntpdc.c:1.2 +*** 386BSD/src/contrib/xntpd/xntpdc/ntpdc.c:1.1.1.3 Sun Apr 3 13:44:04 1994 +--- 386BSD/src/contrib/xntpd/xntpdc/ntpdc.c Sun Apr 3 13:44:04 1994 +*************** +*** 53,59 **** + static int getarg P((char *, int, arg_v *)); + static int getnetnum P((char *, U_LONG *, char *)); + static void help P((struct parse *, FILE *)); +! #if defined(sgi) || defined(SYS_BSDI) + static int helpsort P((const void *, const void *)); + #else + static int helpsort P((char **, char **)); +--- 53,59 ---- + static int getarg P((char *, int, arg_v *)); + static int getnetnum P((char *, U_LONG *, char *)); + static void help P((struct parse *, FILE *)); +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + static int helpsort P((const void *, const void *)); + #else + static int helpsort P((char **, char **)); +*************** +*** 1153,1159 **** + for (xcp = opcmds; xcp->keyword != 0; xcp++) + cmdsort[n++] = xcp->keyword; + +! #if defined(sgi) || defined(SYS_BSDI) + qsort((void *)cmdsort, n, sizeof(char *), helpsort); + #else + qsort((char *)cmdsort, n, sizeof(char *), helpsort); +--- 1153,1159 ---- + for (xcp = opcmds; xcp->keyword != 0; xcp++) + cmdsort[n++] = xcp->keyword; + +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + qsort((void *)cmdsort, n, sizeof(char *), helpsort); + #else + qsort((char *)cmdsort, n, sizeof(char *), helpsort); +*************** +*** 1199,1205 **** + * helpsort - do hostname qsort comparisons + */ + static int +! #if defined(sgi) || defined(SYS_BSDI) + helpsort(t1, t2) + const void *t1; + const void *t2; +--- 1199,1205 ---- + * helpsort - do hostname qsort comparisons + */ + static int +! #if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) + helpsort(t1, t2) + const void *t1; + const void *t2; +diff -c /dev/null 386BSD/src/contrib/xntpd/xntpres/Makefile:1.2 +*** /dev/null Sun Apr 3 13:44:05 1994 +--- 386BSD/src/contrib/xntpd/xntpres/Makefile Sun Apr 3 13:44:05 1994 +*************** +*** 0 **** +--- 1,28 ---- ++ # ++ # $Id: Makefile,v 1.2 1993/12/22 11:34:09 rgrimes Exp $ ++ # ++ ++ CFLAGS+= -I${.CURDIR}/../include ++ ++ .if exists(${.CURDIR}/../lib/obj) ++ LDADD+= -L${.CURDIR}/../lib/obj ++ DPADD+= -L${.CURDIR}/../lib/obj/libntp.a ++ .else ++ LDADD+= -L${.CURDIR}/../lib ++ DPADD+= -L${.CURDIR}/../lib/libntp.a ++ .endif ++ ++ LDADD+= -lntp ++ ++ PROG= xntpres ++ NOMAN= ++ CLEANFILES+= .version version.c ++ ++ SRCS= xntpres.c version.c ++ ++ beforedepend: version.c ++ ++ version.c: ${.CURDIR}/../VERSION ++ ${.CURDIR}/../scripts/mkversion xntpres ++ ++ .include + +-GAWollman + +-- +Garrett A. Wollman | Shashish is simple, it's discreet, it's brief. ... +wollman@lcs.mit.edu | Shashish is the bonding of hearts in spite of distance. +formerly known as | It is a bond more powerful than absence. We like people +wollman@emba.uvm.edu | who like Shashish. - Claude McKenzie + Florent Vollant +[no save] + diff --git a/usr.sbin/xntpd/patches/patch.36 b/usr.sbin/xntpd/patches/patch.36 new file mode 100644 index 000000000000..b90df0d4c2eb --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.36 @@ -0,0 +1,42 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa18708; 7 Apr 94 14:50 EDT +Received: from mudshark.artisoft.com by louie.udel.edu id aa16541; + 7 Apr 94 14:46 EDT +Received: by mudshark.artisoft.com id AA11987 + (5.67b/IDA-1.5 for mills@udel.edu); Thu, 7 Apr 1994 11:46:32 -0700 +Date: Thu, 7 Apr 1994 11:46:32 -0700 +From: Matt Day +Message-Id: <199404071846.AA11987@mudshark.artisoft.com> +To: mills@udel.edu +Subject: XNTP bug on Linux + +adjtime() on Linux fails if you try to adjust more than 131072 +microseconds. This causes `ntpdate' to fail on Linux when the system +clock is off by more than 131072 microseconds but less than +NTPDATE_THRESHOLD (500 ms). + +Reducing NTPDATE_THRESHOLD to less than 131072 microseconds fixed the +problem. + +From the comments in the code for Linux's adjtime(), it looks like this +problem might go away someday. + +Thanks! + +*** ntpdate.h- Tue Aug 24 14:29:30 1993 +--- ntpdate.h Thu Apr 7 11:33:53 1994 +*************** +*** 54,60 **** +--- 54,64 ---- + * are close, or step the time if the times are farther apart. The + * following defines what is "close". + */ ++ #ifdef linux ++ #define NTPDATE_THRESHOLD (FP_SECOND / 8) /* 1/8 second */ ++ #else + #define NTPDATE_THRESHOLD (FP_SECOND >> 1) /* 1/2 second */ ++ #endif + + /* + * When doing adjustments, ntpdate actually overadjusts (currently + diff --git a/usr.sbin/xntpd/patches/patch.37 b/usr.sbin/xntpd/patches/patch.37 new file mode 100644 index 000000000000..e17267f57e97 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.37 @@ -0,0 +1,204 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa25219; 8 Apr 94 17:07 EDT +Received: from ni.umd.edu by louie.udel.edu id aa03359; 8 Apr 94 16:58 EDT +Received: by ni.umd.edu id AA18341 + (5.65c/IDA-1.4.4 for ntp-list); Fri, 8 Apr 1994 16:55:09 -0400 +Received: from RUTGERS.EDU by ni.umd.edu with SMTP id AA18337 + (5.65c/IDA-1.4.4 for ); Fri, 8 Apr 1994 16:55:02 -0400 +Received: from unipress-link.rutgers.edu by rutgers.edu (5.59/SMI4.0/RU1.5/3.08) + id AA16356; Fri, 8 Apr 94 16:54:44 EDT +Received: from huh.unipress.com by repo.unipress.com (4.1/SMI-4.1/UniPress022294.2) + id AA10459; Fri, 8 Apr 94 16:54:36 EDT via +Message-Id: <9404082054.AA10459@repo.unipress.com> +To: ntp@ni.umd.edu +Subject: Re: xntp for univel/unix-ware on x86 +Date: Fri, 08 Apr 94 16:54:31 -0400 +From: Ray Schnitzler + + +I am happy (but not particularly proud - it's more than a + little rough around the edges) to report a working + xntpd for Univel. + +It wound up being a hack on solaris, svr4, and (for the lack + of kernel tickadj) irix. + +util/tickadj does *not* work, even for controlling 'tick'. + I'm not sure what the right behavior should be. + +Most of the changes are signalled by SYS_UNIVEL, as + initiated by OS=univel. + +There are many additional loose ends, which are not terribly + important to me to clean up, since the univel is a + very low usage machine, here, and my because + employer expects me to be working on other things, + altogether. + +Nevertheless, it seems to work. + +Special thanks go to Denton Gentry for advice along the way. + + +Enjoy. + + +Here are the changes I made. First, the (new) + machines/univel file, and then the (rest of the) + context diffs: + +*** /dev/null Fri Apr 8 16:49:24 1994 +--- machines/univel Fri Apr 8 12:38:20 1994 +*************** +*** 0 **** +--- 1,10 ---- ++ SHELL= /bin/sh ++ RANLIB= ls # ar does the work of ranlib under System V ++ DEFS= -DSYS_UNIVEL -DSTREAMS_TLI -DHAVE_TERMIOS ++ AUTHDEFS= -DDES -DMD5 ++ CLOCKDEFS= ++ DAEMONLIBS= -lnsl -lsocket -lelf ++ RESLIB= -lnsl -lsocket -lelf ++ INSTALL=$(TOP)scripts/install.sh ++ SHELL= /bin/sh ++ RANLIB= ls # ar does the work of ranlib under System V +*** authstuff/authspeed.c.orig Thu Jan 27 09:03:12 1994 +--- authstuff/authspeed.c Fri Apr 8 14:19:35 1994 +*************** +*** 2,8 **** + * authspeed - figure out how LONG it takes to do an NTP encryption + */ + +! #if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) + #define FAKE_RUSAGE + #endif + +--- 2,8 ---- + * authspeed - figure out how LONG it takes to do an NTP encryption + */ + +! #if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) || defined(SYS_UNIVEL) + #define FAKE_RUSAGE + #endif +*** include/ntp_if.h.orig Mon Nov 15 16:21:29 1993 +--- include/ntp_if.h Fri Apr 8 14:51:49 1994 +*************** +*** 16,21 **** +--- 16,25 ---- + #include + #endif + ++ #if defined(SYS_UNIVEL) ++ #include ++ #endif ++ + #if defined(SYS_PTX) || defined(SYS_SINIXM) + #include + #include +*** include/ntp_machine.h.orig Mon Mar 14 02:47:02 1994 +--- include/ntp_machine.h Fri Apr 8 14:45:42 1994 +*************** +*** 526,531 **** +--- 526,563 ---- + #endif + + /* ++ * Univel SVR4 on intel x86 processor ++ */ ++ #if defined(SYS_UNIVEL) ++ /* #define _POSIX_SOURCE */ ++ #define NTP_POSIX_SOURCE ++ #define HAVE_ATT_NICE ++ #define HAVE_READKMEM ++ #define USE_PROTOTYPES ++ #undef HAVE_ATT_SETPGRP ++ #define UDP_WILDCARD_DELIVERY ++ #define HAVE_SIGNALED_IO ++ #define USE_TTY_SIGPOLL ++ #define USE_UDP_SIGPOLL ++ #define STREAM ++ #define STREAMS ++ #ifndef STREAMS_TLI ++ /*#define STREAMS_TLI*/ ++ #endif ++ /* #define USE_STREAMS_DEVICE_FOR_IF_CONFIG */ ++ #undef STEP_SLEW /* TWO step */ ++ #define LOCK_PROCESS ++ #undef SYSV_TIMEOFDAY ++ #define SIZE_RETURNED_IN_BUFFER ++ #define RETSIGTYPE void ++ #include ++ #include ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Univel" ++ #endif ++ #endif ++ ++ /* + * DomainOS + */ + #if defined(SYS_DOMAINOS) +*** xntpd/ntp_unixclock.c.orig Thu Feb 3 00:20:20 1994 +--- xntpd/ntp_unixclock.c Fri Apr 8 14:40:55 1994 +*************** +*** 255,260 **** +--- 255,277 ---- + /* Define the following to be what the tick and tickadj variables are + * called in your kernel. + */ ++ #if defined(SYS_UNIVEL) ++ /* ++ * clock_parms - return the local clock tickadj and tick parameters ++ * ++ * The values set here were determined experimentally on a 486 system ++ * I'm not confident in them. - RAS ++ * ++ */ ++ static void ++ clock_parms(tickadj, tick) ++ U_LONG *tickadj; ++ U_LONG *tick; ++ { ++ *tick = 10000; /* microseconds */ ++ *tickadj = 80; /* microseconds */ ++ } ++ #else /* SYS_UNIVEL */ + + #if defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SYS_SVR4) || defined(SYS_PTX) + #define K_TICKADJ_NAME "tickadj" +*************** +*** 421,427 **** + } + #endif /* sgi */ + +- + #ifdef NOKMEM + + #ifndef HZ +--- 438,443 ---- +*************** +*** 571,573 **** +--- 587,590 ---- + *tick = (U_LONG)txc.tick; + } + #endif /* SYS_LINUX */ ++ #endif /* SYS_UNIVEL */ +*** xntpd/ntpd.c.orig Wed Feb 16 22:09:35 1994 +--- xntpd/ntpd.c Fri Apr 8 16:35:57 1994 +*************** +*** 14,20 **** + #include + #endif + +! #if defined(SYS_SVR4) + #include + #endif + +--- 14,20 ---- + #include + #endif + +! #if defined(SYS_SVR4) || defined (SYS_UNIVEL) + #include + #endif + diff --git a/usr.sbin/xntpd/patches/patch.38 b/usr.sbin/xntpd/patches/patch.38 new file mode 100644 index 000000000000..dddba69eb06c --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.38 @@ -0,0 +1,226 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa09565; 11 Apr 94 13:04 EDT +Received: from ni.umd.edu by louie.udel.edu id aa10661; 11 Apr 94 12:57 EDT +Received: by ni.umd.edu id AA00787 + (5.65c/IDA-1.4.4 for ntp-list); Mon, 11 Apr 1994 12:50:20 -0400 +Received: from RUTGERS.EDU by ni.umd.edu with SMTP id AA00783 + (5.65c/IDA-1.4.4 for ); Mon, 11 Apr 1994 12:50:13 -0400 +Received: from unipress-link.rutgers.edu by rutgers.edu (5.59/SMI4.0/RU1.5/3.08) + id AA26905; Mon, 11 Apr 94 12:49:43 EDT +Received: from huh.unipress.com by repo.unipress.com (4.1/SMI-4.1/UniPress022294.2) + id AA03031; Mon, 11 Apr 94 12:49:27 EDT via +Message-Id: <9404111649.AA03031@repo.unipress.com> +To: ntp@ni.umd.edu +Subject: Re: xntp for univel/unix-ware on x86 +Date: Mon, 11 Apr 94 12:49:25 -0400 +From: Ray Schnitzler + + +As seems usual, every patch is followed by a re-patch. This + is a (modified) re-posting of patches to make xntp + work on unixware svr4. It now uses + machines/unixware1 and SYS_UNIXWARE1 (instead of + univel, as suggested by J J Farrell), and now + includes some RELNOTES and COPYRIGHT text (as + suggested by Dave) + +It is still rough, but it still works. The tickadj utility + still does *not* work, even for controlling 'tick'. + I'm not sure what the right behavior should be since + there is no 'tickadj' kernel var. + +In addition to the credits I mentioned above, special thanks + go to Denton Gentry for advice along the way. + + +Enjoy. + +Ray Schnitzler +UniPress Software, Inc. +------------------------------------------------------------ +Here are the changes I made. First, the (new) + machines/univel file, and then the (rest of the) + context diffs: + +*** machines/unixware1.3.3p Fri Apr 8 16:48:35 1994 +--- machines/unixware1 Mon Apr 11 11:08:10 1994 +*************** +*** 0 **** +--- 1,10 ---- ++ SHELL= /bin/sh ++ RANLIB= ls # ar does the work of ranlib under System V ++ DEFS= -DSYS_UNIXWARE1 -DSTREAMS_TLI -DHAVE_TERMIOS -DCONFIG_FILE=\\"/usr/local/etc/ntp.conf\\" ++ AUTHDEFS= -DDES -DMD5 ++ CLOCKDEFS= ++ DAEMONLIBS= -lnsl -lsocket -lelf ++ RESLIB= -lnsl -lsocket -lelf ++ INSTALL=$(TOP)scripts/install.sh ++ SHELL= /bin/sh ++ RANLIB= ls # ar does the work of ranlib under System V +*** COPYRIGHT.3.3p Thu Feb 3 00:20:07 1994 +--- COPYRIGHT Mon Apr 11 10:47:24 1994 +*************** +*** 55,58 **** +--- 55,59 ---- + * Torsten Duwe (Linux Port) + * Paul A Vixie (TrueTime GPS driver) + * Jim Jagielski (A/UX port) ++ * Ray Schnitzler (First pass at a Unixware1 port.) + */ +*** RELNOTES.3.3p Thu Jan 27 09:33:09 1994 +--- RELNOTES Mon Apr 11 11:14:35 1994 +*************** +*** 140,145 **** +--- 140,146 ---- + PC BSD/386 1.0 gcc LOCAL_CLOCK possibly see "build problems" + PC Linux (pl14) gcc LOCAL_CLOCK (dw 93/10/30) + PC Dell SVR4 v2.2 gcc ? (tl 93/12/30) ++ PC Unixware1/SVR4 cc no tickadj, ? (ras 93/04/11) + NCR3445 NCR SVR4 cc LOCAL_CLOCK (tm 93/11/29) + + pb: Piete Brooks +*************** +*** 149,154 **** +--- 150,156 ---- + tl: Tony Lill + tm: Tom Moore + jmj: Jim Jagielski ++ ras: Ray Schnitzler + + Build Problems (and workaround): + +*** authstuff/authspeed.c.3.3p Thu Jan 27 09:03:12 1994 +--- authstuff/authspeed.c Mon Apr 11 10:29:47 1994 +*************** +*** 2,8 **** + * authspeed - figure out how LONG it takes to do an NTP encryption + */ + +! #if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) + #define FAKE_RUSAGE + #endif + +--- 2,8 ---- + * authspeed - figure out how LONG it takes to do an NTP encryption + */ + +! #if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) || defined(SYS_UNIXWARE1) + #define FAKE_RUSAGE + #endif + +*** include/ntp_if.h.3.3p Mon Nov 15 16:21:29 1993 +--- include/ntp_if.h Mon Apr 11 10:30:21 1994 +*************** +*** 16,21 **** +--- 16,25 ---- + #include + #endif + ++ #if defined(SYS_UNIXWARE1) ++ #include ++ #endif ++ + #if defined(SYS_PTX) || defined(SYS_SINIXM) + #include + #include +*** include/ntp_machine.h.3.3p Mon Mar 14 02:47:02 1994 +--- include/ntp_machine.h Mon Apr 11 10:31:11 1994 +*************** +*** 526,531 **** +--- 526,565 ---- + #endif + + /* ++ * (Univel/Novell) Unixware1 SVR4 on intel x86 processor ++ */ ++ #if defined(SYS_UNIXWARE1) ++ /* #define _POSIX_SOURCE */ ++ #undef HAVE_ATT_SETPGRP ++ #define USE_PROTOTYPES ++ #define NTP_POSIX_SOURCE ++ #define HAVE_ATT_NICE ++ #define HAVE_READKMEM ++ #define USE_TTY_SIGPOLL ++ #define USE_UDP_SIGPOLL ++ #define UDP_WILDCARD_DELIVERY ++ #undef HAVE_SIGNALED_IO ++ #define STREAM ++ #define STREAMS ++ #ifndef STREAMS_TLI ++ /*#define STREAMS_TLI*/ ++ #endif ++ /* #define USE_STREAMS_DEVICE_FOR_IF_CONFIG */ ++ #undef STEP_SLEW /* TWO step */ ++ #define LOCK_PROCESS ++ #define NO_SIGNED_CHAR_DECL ++ #undef SYSV_TIMEOFDAY ++ #define SIZE_RETURNED_IN_BUFFER ++ #define RETSIGTYPE void ++ #include ++ #include ++ #include ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX/Unixware1" ++ #endif ++ #endif ++ ++ /* + * DomainOS + */ + #if defined(SYS_DOMAINOS) +*** xntpd/ntp_unixclock.c.3.3p Thu Feb 3 00:20:20 1994 +--- xntpd/ntp_unixclock.c Mon Apr 11 10:33:23 1994 +*************** +*** 255,260 **** +--- 255,277 ---- + /* Define the following to be what the tick and tickadj variables are + * called in your kernel. + */ ++ #if defined(SYS_UNIXWARE1) ++ /* ++ * clock_parms - return the local clock tickadj and tick parameters ++ * ++ * The values set here were determined experimentally on a 486 system ++ * I'm not confident in them. - RAS ++ * ++ */ ++ static void ++ clock_parms(tickadj, tick) ++ U_LONG *tickadj; ++ U_LONG *tick; ++ { ++ *tick = 10000; /* microseconds */ ++ *tickadj = 80; /* microseconds */ ++ } ++ #else /* SYS_UNIXWARE1 */ + + #if defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SYS_SVR4) || defined(SYS_PTX) + #define K_TICKADJ_NAME "tickadj" +*************** +*** 571,573 **** +--- 587,590 ---- + *tick = (U_LONG)txc.tick; + } + #endif /* SYS_LINUX */ ++ #endif /* SYS_UNIXWARE1 */ +*** xntpd/ntpd.c.3.3p Wed Feb 16 22:09:35 1994 +--- xntpd/ntpd.c Mon Apr 11 10:33:58 1994 +*************** +*** 14,20 **** + #include + #endif + +! #if defined(SYS_SVR4) + #include + #endif + +--- 14,21 ---- + #include + #endif + +! /* Shouldn't this test for HAVE_TERMIOS - RAS */ +! #if defined(SYS_SVR4) || defined (SYS_UNIXWARE1) + #include + #endif + + diff --git a/usr.sbin/xntpd/patches/patch.39 b/usr.sbin/xntpd/patches/patch.39 new file mode 100644 index 000000000000..12e09fefcdf7 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.39 @@ -0,0 +1,78 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa21593; 13 Apr 94 8:23 EDT +Received: from jagubox.gsfc.nasa.gov by louie.udel.edu id aa20245; + 13 Apr 94 8:15 EDT +Received: by jagubox.gsfc.nasa.gov (Smail3.1.28.1 #2) + id m0pr3rH-0005s0C; Wed, 13 Apr 94 08:15 EDT +Message-Id: +From: Jim Jagielski +Subject: Minor change for ntp_loopfilter (and loop.c) in 3.3q +To: Mills@udel.edu +Date: Wed, 13 Apr 1994 08:15:55 -0400 (EDT) +Reply-To: Jim Jagielski +In-Reply-To: <9308051324.aa24396@huey.udel.edu> from "Mills@udel.edu" at Aug 5, 93 01:24:24 pm +X-Mailer: ELM [version 2.4 PL23] +Content-Type: text +Content-Length: 1738 + +One of the changes between 3.3p and 3.3q was the format change of the syslog +message when the clock is reset when xntpd sees a "large" offset. This change +is nice, but it would be "better" is the notice also made mention of whether +the reset was a step or slew (as defined by SLEWALWAYS). + +This patch adds that: +*** xntpd/Oloop.c Wed Apr 13 08:05:09 1994 +--- xntpd/loop.c Wed Apr 13 08:06:32 1994 +*************** +*** 458,464 **** + lfptoa(fp_offset, 6)); + return (0); + } +! syslog(LOG_NOTICE, "clock reset %s\n", + lfptoa(fp_offset, 6)); + step_systime(fp_offset); + clock_adjust = 0; +--- 458,469 ---- + lfptoa(fp_offset, 6)); + return (0); + } +! syslog(LOG_NOTICE, "clock reset (%s) %s\n", +! #ifdef SLEWALWAYS +! "slew", +! #else +! "step", +! #endif + lfptoa(fp_offset, 6)); + step_systime(fp_offset); + clock_adjust = 0; +*** xntpd/Ontp_loopfilter.c Wed Apr 13 08:05:23 1994 +--- xntpd/ntp_loopfilter.c Wed Apr 13 08:07:03 1994 +*************** +*** 458,464 **** + lfptoa(fp_offset, 6)); + return (0); + } +! syslog(LOG_NOTICE, "clock reset %s\n", + lfptoa(fp_offset, 6)); + step_systime(fp_offset); + clock_adjust = 0; +--- 458,469 ---- + lfptoa(fp_offset, 6)); + return (0); + } +! syslog(LOG_NOTICE, "clock reset (%s) %s\n", +! #ifdef SLEWALWAYS +! "slew", +! #else +! "step", +! #endif + lfptoa(fp_offset, 6)); + step_systime(fp_offset); + clock_adjust = 0; +-- +#include + Jim Jagielski | "Is this something you can share with + jim@jagubox.gsfc.nasa.gov | the rest of us Amazing Larry!!??" + NASA/GSFC, Code 734.4 | Pee Wee + Greenbelt, MD 20771 | + diff --git a/usr.sbin/xntpd/patches/patch.4 b/usr.sbin/xntpd/patches/patch.4 new file mode 100644 index 000000000000..ef06ee907f04 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.4 @@ -0,0 +1,4719 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa12898; 26 Jan 94 21:06 EST +Received: from sony.com by louie.udel.edu id aa05924; 26 Jan 94 21:01 EST +Received: by sony.com id AA18168; Wed, 26 Jan 94 18:00:44 -0800 +X-Btw: sony.com is also sonygate.sony.com +Received: by mail1.gw.in.sel.sony.com id AA25072; Wed, 26 Jan 94 18:00:43 -0800 +Received: by mail1.sjc.in.sel.sony.com id AA13634; Wed, 26 Jan 94 18:00:41 -0800 +Received: by morality.sjc.hw.sony.com; id AA23624; Wed, 26 Jan 94 18:00:40 -0800 +Date: Wed, 26 Jan 94 18:00:40 -0800 +From: Paul Vixie +Message-Id: <9401270200.AA23624@morality.sjc.hw.sony.com> +To: mills@udel.edu +Subject: diffs against 3.3c (26-jan 11:36) +Cc: paul@vix.com + +These have been tested on BSD/386 1.0 and on HP-UX 8.??. I have more to do, +but this is the last I'm going to do before 3.3d (or whatever) comes out with +the other patches you're expecting. I need to have a day with just me and NTP +and everybody else with their mits outa the code while I finish the portability +stuff. + +*** /tmp/RCSA023397 Wed Jan 26 17:56:22 1994 +--- adjtime/adjtimed.c Wed Jan 26 16:33:27 1994 +*************** +*** 42,47 **** + + double atof(); +! extern int optind; +! extern char *optarg; + + int InitClockRate(); +--- 42,47 ---- + + double atof(); +! extern int ntp_optind; +! extern char *ntp_optarg; + + int InitClockRate(); +*************** +*** 84,88 **** + openlog("adjtimed", LOG_PID, LOG_LOCAL6); + +! while ((ch = getopt(argc, argv, "hkrvdfp:")) != EOF) { + switch (ch) { + case 'k': +--- 84,88 ---- + openlog("adjtimed", LOG_PID, LOG_LOCAL6); + +! while ((ch = ntp_getopt(argc, argv, "hkrvdfp:")) != EOF) { + switch (ch) { + case 'k': +*************** +*** 114,118 **** + + case 'p': +! if ((RATE = atof(optarg)) <= 0.0 || RATE >= 100.0) { + fputs("adjtimed: percentage must be between 0.0 and 100.0\n", stderr); + exit(1); +--- 114,118 ---- + + case 'p': +! if ((RATE = atof(ntp_optarg)) <= 0.0 || RATE >= 100.0) { + fputs("adjtimed: percentage must be between 0.0 and 100.0\n", stderr); + exit(1); +*** /tmp/RCSA023401 Wed Jan 26 17:56:23 1994 +--- authstuff/authspeed.c Wed Jan 26 16:33:28 1994 +*************** +*** 66,75 **** + int i; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; + loops = DEFLOOPS; +! while ((c = getopt_l(argc, argv, "cdmn:")) != EOF) + switch (c) { + case 'c': +--- 66,75 ---- + int i; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; + loops = DEFLOOPS; +! while ((c = ntp_getopt(argc, argv, "cdmn:")) != EOF) + switch (c) { + case 'c': +*************** +*** 83,91 **** + break; + case 'n': +! loops = atoi(optarg); + if (loops <= 0) { + (void) fprintf(stderr, + "%s: %s is unlikely to be a useful number of loops\n", +! progname, optarg); + errflg++; + } +--- 83,91 ---- + break; + case 'n': +! loops = atoi(ntp_optarg); + if (loops <= 0) { + (void) fprintf(stderr, + "%s: %s is unlikely to be a useful number of loops\n", +! progname, ntp_optarg); + errflg++; + } +*************** +*** 95,99 **** + break; + } +! if (errflg || optind == argc) { + (void) fprintf(stderr, + "usage: %s [-d] [-n loops] [ -c ] auth.samplekeys\n", +--- 95,99 ---- + break; + } +! if (errflg || ntp_optind == argc) { + (void) fprintf(stderr, + "usage: %s [-d] [-n loops] [ -c ] auth.samplekeys\n", +*************** +*** 109,113 **** + + init_auth(); +! authreadkeys(argv[optind]); + for (i = 0; i < 16; i++) { + if (!auth_havekey(i + domd5)) { +--- 109,113 ---- + + init_auth(); +! authreadkeys(argv[ntp_optind]); + for (i = 0; i < 16; i++) { + if (!auth_havekey(i + domd5)) { +*** /tmp/RCSA023401 Wed Jan 26 17:56:23 1994 +--- authstuff/keyparity.c Wed Jan 26 16:33:28 1994 +*************** +*** 50,58 **** + int keytype; + U_LONG key[2]; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "adno:s")) != EOF) + switch (c) { + case 'a': +--- 50,58 ---- + int keytype; + U_LONG key[2]; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "adno:s")) != EOF) + switch (c) { + case 'a': +*************** +*** 69,76 **** + break; + case 'o': +! if (*optarg == 'n') { + ntpoutflag = 1; + gotoopt = 1; +! } else if (*optarg == 's') { + ntpoutflag = 0; + gotoopt = 1; +--- 69,76 ---- + break; + case 'o': +! if (*ntp_optarg == 'n') { + ntpoutflag = 1; + gotoopt = 1; +! } else if (*ntp_optarg == 's') { + ntpoutflag = 0; + gotoopt = 1; +*************** +*** 86,90 **** + break; + } +! if (errflg || optind == argc) { + (void) fprintf(stderr, + "usage: %s -n|-s [-a] [-o n|s] key [...]\n", +--- 86,90 ---- + break; + } +! if (errflg || ntp_optind == argc) { + (void) fprintf(stderr, + "usage: %s -n|-s [-a] [-o n|s] key [...]\n", +*************** +*** 119,127 **** + keytype = KEY_TYPE_STD; + +! for (; optind < argc; optind++) { +! if (!decodekey(keytype, argv[optind], key)) { + (void) fprintf(stderr, + "%s: format of key %s invalid\n", +! progname, argv[optind]); + exit(1); + } +--- 119,127 ---- + keytype = KEY_TYPE_STD; + +! for (; ntp_optind < argc; ntp_optind++) { +! if (!decodekey(keytype, argv[ntp_optind], key)) { + (void) fprintf(stderr, + "%s: format of key %s invalid\n", +! progname, argv[ntp_optind]); + exit(1); + } +*************** +*** 243,247 **** + * Make up key from ascii representation + */ +! bzero(keybytes, sizeof(keybytes)); + for (i = 0; i < 8 && i < len; i++) + keybytes[i] = *cp++ << 1; +--- 243,247 ---- + * Make up key from ascii representation + */ +! memset(keybytes, 0, sizeof(keybytes)); + for (i = 0; i < 8 && i < len; i++) + keybytes[i] = *cp++ << 1; +*** /tmp/RCSA023401 Wed Jan 26 17:56:23 1994 +--- authstuff/makeIPFP.c Wed Jan 26 16:33:28 1994 +*************** +*** 29,37 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +--- 29,37 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +*************** +*** 184,188 **** + int octbits; + +! bzero((char *)bits, sizeof bits); + + /* +--- 184,188 ---- + int octbits; + +! memset((char *)bits, 0, sizeof bits); + + /* +*** /tmp/RCSA023401 Wed Jan 26 17:56:23 1994 +--- authstuff/makePC1.c Wed Jan 26 16:33:28 1994 +*************** +*** 26,34 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +--- 26,34 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +*************** +*** 83,88 **** + u_char d[28]; + +! bzero((char *)c, sizeof c); +! bzero((char *)d, sizeof d); + + for (i = 0; i < 28; i++) { +--- 83,88 ---- + u_char d[28]; + +! memset((char *)c, 0, sizeof c); +! memset((char *)d, 0, sizeof d); + + for (i = 0; i < 28; i++) { +*************** +*** 141,145 **** + u_char bits[64]; + +! bzero((char *)bits, sizeof bits); + + printf("static U_LONG PC1_CL[8] = {"); +--- 141,145 ---- + u_char bits[64]; + +! memset((char *)bits, 0, sizeof bits); + + printf("static U_LONG PC1_CL[8] = {"); +*** /tmp/RCSA023401 Wed Jan 26 17:56:24 1994 +--- authstuff/makePC2.c Wed Jan 26 16:33:28 1994 +*************** +*** 27,35 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +--- 27,35 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +*************** +*** 88,92 **** + u_char res[24]; + +! bzero((char *)res, sizeof res); + + for (i = 0; i < 24; i++) { +--- 88,92 ---- + u_char res[24]; + +! memset((char *)res, 0, sizeof res); + + for (i = 0; i < 24; i++) { +*************** +*** 118,122 **** + u_char res[24]; + +! bzero((char *)res, sizeof res); + + for (i = 0; i < 24; i++) { +--- 118,122 ---- + u_char res[24]; + +! memset((char *)res, 0, sizeof res); + + for (i = 0; i < 24; i++) { +*************** +*** 169,173 **** + u_char bits[28]; + +! bzero((char *)bits, sizeof bits); + + printf("static U_LONG PC2_C[4][64] = {"); +--- 169,173 ---- + u_char bits[28]; + +! memset((char *)bits, 0, sizeof bits); + + printf("static U_LONG PC2_C[4][64] = {"); +*** /tmp/RCSA023401 Wed Jan 26 17:56:24 1994 +--- authstuff/makeSP.c Wed Jan 26 16:33:28 1994 +*************** +*** 26,34 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +--- 26,34 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +*************** +*** 166,170 **** + int sixbits; + +! bzero((char *)bits, sizeof bits); + printf("static U_LONG SP[8][64] = {"); + for (selno = 0; selno < 8; selno++) { +--- 166,170 ---- + int sixbits; + +! memset((char *)bits, 0, sizeof bits); + printf("static U_LONG SP[8][64] = {"); + for (selno = 0; selno < 8; selno++) { +*** /tmp/RCSA023401 Wed Jan 26 17:56:24 1994 +--- authstuff/mkrandkeys.c Wed Jan 26 16:33:28 1994 +*************** +*** 35,40 **** + U_LONG tmp; + char *passwd; +! extern int optind; +! extern char *optarg; + extern char *getpass(); + +--- 35,40 ---- + U_LONG tmp; + char *passwd; +! extern int ntp_optind; +! extern char *ntp_optarg; + extern char *getpass(); + +*************** +*** 42,46 **** + progname = argv[0]; + passwd = NULL; +! while ((c = getopt_l(argc, argv, "dnp:s")) != EOF) + switch (c) { + case 'd': +--- 42,46 ---- + progname = argv[0]; + passwd = NULL; +! while ((c = ntp_getopt(argc, argv, "dnp:s")) != EOF) + switch (c) { + case 'd': +*************** +*** 51,55 **** + break; + case 'p': +! passwd = optarg; + break; + case 's': +--- 51,55 ---- + break; + case 'p': +! passwd = ntp_optarg; + break; + case 's': +*************** +*** 62,70 **** + + numkeys = 0; +! for (; !errflg && optind < argc; optind++) { +! c = atoi(argv[optind]); + if (c <= 0 || c > 15) { + (void) fprintf(stderr, "%s: invalid key number `%s'\n", +! progname, argv[optind]); + exit(2); + } +--- 62,70 ---- + + numkeys = 0; +! for (; !errflg && ntp_optind < argc; ntp_optind++) { +! c = atoi(argv[ntp_optind]); + if (c <= 0 || c > 15) { + (void) fprintf(stderr, "%s: invalid key number `%s'\n", +! progname, argv[ntp_optind]); + exit(2); + } +*** /tmp/RCSA023401 Wed Jan 26 17:56:24 1994 +--- authstuff/omakeIPFP.c Wed Jan 26 16:33:29 1994 +*************** +*** 35,43 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +--- 35,43 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "d")) != EOF) + switch (c) { + case 'd': +*************** +*** 189,193 **** + int quadbits; + +! bzero((char *)bits, sizeof bits); + + /* +--- 189,193 ---- + int quadbits; + +! memset((char *)bits, 0, sizeof bits); + + /* +*** /tmp/RCSA023419 Wed Jan 26 17:56:25 1994 +--- clockstuff/chutest.c Wed Jan 26 16:33:29 1994 +*************** +*** 69,78 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + void init_chu(); + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "cdfpt")) != EOF) + switch (c) { + case 'c': +--- 69,78 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + void init_chu(); + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "cdfpt")) != EOF) + switch (c) { + case 'c': +*************** +*** 108,112 **** + break; + } +! if (errflg || optind+1 != argc) { + #ifdef STREAM + (void) fprintf(stderr, "usage: %s [-dft] tty_device\n", +--- 108,112 ---- + break; + } +! if (errflg || ntp_optind+1 != argc) { + #ifdef STREAM + (void) fprintf(stderr, "usage: %s [-dft] tty_device\n", +*************** +*** 127,131 **** + + (void) gettimeofday(&lasttv, (struct timezone *)0); +! c = openterm(argv[optind]); + init_chu(); + #ifdef STREAM +--- 127,131 ---- + + (void) gettimeofday(&lasttv, (struct timezone *)0); +! c = openterm(argv[ntp_optind]); + init_chu(); + #ifdef STREAM +*** /tmp/RCSA023419 Wed Jan 26 17:56:25 1994 +--- clockstuff/clktest.c Wed Jan 26 16:33:29 1994 +*************** +*** 106,111 **** + struct sgttyb ttyb; + struct itimerval itimer; +! extern int optind; +! extern char *optarg; + int alarming(); + int ioready(); +--- 106,111 ---- + struct sgttyb ttyb; + struct itimerval itimer; +! extern int ntp_optind; +! extern char *ntp_optarg; + int alarming(); + int ioready(); +*************** +*** 115,119 **** + magic[0] = 0; + #endif +! while ((c = getopt_l(argc, argv, "a:b:c:dfs:t:")) != EOF) + switch (c) { + #ifdef CLKLDISC +--- 115,119 ---- + magic[0] = 0; + #endif +! while ((c = ntp_getopt(argc, argv, "a:b:c:dfs:t:")) != EOF) + switch (c) { + #ifdef CLKLDISC +*************** +*** 121,125 **** + #endif + case 'c': +! if (!atouint(optarg, &tmp)) { + (void) fprintf(stderr, + "%s: argument for -%c must be integer\n", +--- 121,125 ---- + #endif + case 'c': +! if (!atouint(ntp_optarg, &tmp)) { + (void) fprintf(stderr, + "%s: argument for -%c must be integer\n", +*************** +*** 140,144 **** + break; + case 'b': +! if (!atouint(optarg, &tmp)) { + errflg++; + break; +--- 140,144 ---- + break; + case 'b': +! if (!atouint(ntp_optarg, &tmp)) { + errflg++; + break; +*************** +*** 164,175 **** + break; + case 's': +! cmdlen = strlen(optarg); + if (cmdlen == 0) + errflg++; + else +! cmd = optarg; + break; + case 't': +! if (!atouint(optarg, &tmp)) + errflg++; + else { +--- 164,175 ---- + break; + case 's': +! cmdlen = strlen(ntp_optarg); + if (cmdlen == 0) + errflg++; + else +! cmd = ntp_optarg; + break; + case 't': +! if (!atouint(ntp_optarg, &tmp)) + errflg++; + else { +*************** +*** 182,186 **** + break; + } +! if (errflg || optind+1 != argc) { + (void) fprintf(stderr, + #ifdef CLKLDISC +--- 182,186 ---- + break; + } +! if (errflg || ntp_optind+1 != argc) { + (void) fprintf(stderr, + #ifdef CLKLDISC +*************** +*** 200,209 **** + + if (docmd) +! fd = open(argv[optind], O_RDWR, 0777); + else +! fd = open(argv[optind], O_RDONLY, 0777); + if (fd == -1) { + (void) fprintf(stderr, "%s: open(%s): ", progname, +! argv[optind]); + perror(""); + exit(1); +--- 200,209 ---- + + if (docmd) +! fd = open(argv[ntp_optind], O_RDWR, 0777); + else +! fd = open(argv[ntp_optind], O_RDONLY, 0777); + if (fd == -1) { + (void) fprintf(stderr, "%s: open(%s): ", progname, +! argv[ntp_optind]); + perror(""); + exit(1); +*** /tmp/RCSA023419 Wed Jan 26 17:56:25 1994 +--- clockstuff/propdelay.c Wed Jan 26 16:33:29 1994 +*************** +*** 141,149 **** + double lat2, long2; + double lat3, long3; +! extern int optind; +! extern char *optarg; + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "dh:CWG")) != EOF) + switch (c) { + case 'd': +--- 141,149 ---- + double lat2, long2; + double lat3, long3; +! extern int ntp_optind; +! extern char *ntp_optarg; + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "dh:CWG")) != EOF) + switch (c) { + case 'd': +*************** +*** 152,159 **** + case 'h': + hflag++; +! height = atof(optarg); + if (height <= 0.0) { + (void) fprintf(stderr, "height %s unlikely\n", +! optarg); + errflg++; + } +--- 152,159 ---- + case 'h': + hflag++; +! height = atof(ntp_optarg); + if (height <= 0.0) { + (void) fprintf(stderr, "height %s unlikely\n", +! ntp_optarg); + errflg++; + } +*************** +*** 172,177 **** + break; + } +! if (errflg || (!(Cflag || Wflag || Gflag) && optind+4 != argc) || +! ((Cflag || Wflag || Gflag) && optind+2 != argc)) { + (void) fprintf(stderr, + "usage: %s [-d] [-h height] lat1 long1 lat2 long2\n", +--- 172,177 ---- + break; + } +! if (errflg || (!(Cflag || Wflag || Gflag) && ntp_optind+4 != argc) || +! ((Cflag || Wflag || Gflag) && ntp_optind+2 != argc)) { + (void) fprintf(stderr, + "usage: %s [-d] [-h height] lat1 long1 lat2 long2\n", +*************** +*** 186,193 **** + + if (!(Cflag || Wflag || Gflag)) { +! lat1 = latlong(argv[optind], 1); +! long1 = latlong(argv[optind + 1], 0); +! lat2 = latlong(argv[optind + 2], 1); +! long2 = latlong(argv[optind + 3], 0); + if (hflag) { + doit(lat1, long1, lat2, long2, height, ""); +--- 186,193 ---- + + if (!(Cflag || Wflag || Gflag)) { +! lat1 = latlong(argv[ntp_optind], 1); +! long1 = latlong(argv[ntp_optind + 1], 0); +! lat2 = latlong(argv[ntp_optind + 2], 1); +! long2 = latlong(argv[ntp_optind + 3], 0); + if (hflag) { + doit(lat1, long1, lat2, long2, height, ""); +*************** +*** 202,207 **** + * Compute delay from WWV + */ +! lat1 = latlong(argv[optind], 1); +! long1 = latlong(argv[optind + 1], 0); + lat2 = latlong(wwvlat, 1); + long2 = latlong(wwvlong, 0); +--- 202,207 ---- + * Compute delay from WWV + */ +! lat1 = latlong(argv[ntp_optind], 1); +! long1 = latlong(argv[ntp_optind + 1], 0); + lat2 = latlong(wwvlat, 1); + long2 = latlong(wwvlong, 0); +*************** +*** 229,234 **** + } + } else if (Cflag) { +! lat1 = latlong(argv[optind], 1); +! long1 = latlong(argv[optind + 1], 0); + lat2 = latlong(chulat, 1); + long2 = latlong(chulong, 0); +--- 229,234 ---- + } + } else if (Cflag) { +! lat1 = latlong(argv[ntp_optind], 1); +! long1 = latlong(argv[ntp_optind + 1], 0); + lat2 = latlong(chulat, 1); + long2 = latlong(chulong, 0); +*************** +*** 244,249 **** + lat1 = latlong(goes_up_lat, 1); + long1 = latlong(goes_up_long, 0); +! lat3 = latlong(argv[optind], 1); +! long3 = latlong(argv[optind + 1], 0); + + lat2 = latlong(goes_sat_lat, 1); +--- 244,249 ---- + lat1 = latlong(goes_up_lat, 1); + long1 = latlong(goes_up_long, 0); +! lat3 = latlong(argv[ntp_optind], 1); +! long3 = latlong(argv[ntp_optind + 1], 0); + + lat2 = latlong(goes_sat_lat, 1); +*** /tmp/RCSA023428 Wed Jan 26 17:56:27 1994 +--- conf/Config.CHATHAM Wed Jan 26 16:33:29 1994 +*************** +*** 90,96 **** + # CLOCKDEFS= line below. This flag affects xntpd only. + # +- # There is an occurance of a call to rindex() in the daemon. You may +- # have to include a -Drindex=strrchr to get this to load right. +- # + # To change the location of the configuration file, use a + # -DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar. +--- 90,93 ---- +*************** +*** 110,114 **** + # generated by the pps signal. Only one of these flags should be defined. + # +! DEFS= -DUSELIBKVM -DDEBUG -DSTREAM -DREFCLOCK -DNO_SIGNED_CHAR_DECL -DPPS -DPPSDEV -DXNTP_RETROFIT_STDLIB -DHAVE_UNISTD_H + + # +--- 107,111 ---- + # generated by the pps signal. Only one of these flags should be defined. + # +! DEFS= -DUSELIBKVM -DDEBUG -DSTREAM -DREFCLOCK -DNO_SIGNED_CHAR_DECL -DPPS -DPPSDEV -DXNTP_RETROFIT_STDLIB -DNTP_POSIX_SOURCE + + # +*** /tmp/RCSA023428 Wed Jan 26 17:56:27 1994 +--- conf/Config.MONOMOY Wed Jan 26 16:33:29 1994 +*************** +*** 85,91 **** + # CLOCKDEFS= line below. This flag affects xntpd only. + # +- # There is an occurance of a call to rindex() in the daemon. You may +- # have to include a -Drindex=strrchr to get this to load right. +- # + # To change the location of the configuration file, use a + # -DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar. +--- 85,88 ---- +*************** +*** 105,109 **** + # be used) + # +! DEFS= -DBSDI -DUSELIBKVM -DDEBUG -DREFCLOCK -DPPS -DCONFIG_FILE=\\"/usr/local/etc/xntp.conf\\" -DHAVE_UNISTD_H + + # +--- 102,106 ---- + # be used) + # +! DEFS= -DBSDI -DUSELIBKVM -DDEBUG -DREFCLOCK -DPPS -DCONFIG_FILE=\\"/usr/local/etc/xntp.conf\\" -DNTP_POSIX_SOURCE + + # +*** /tmp/RCSA023428 Wed Jan 26 17:56:27 1994 +--- conf/Config.TIGER Wed Jan 26 16:33:30 1994 +*************** +*** 81,87 **** + # CLOCKDEFS= line below. This flag affects xntpd only. + # +- # There is an occurance of a call to rindex() in the daemon. You may +- # have to include a -Drindex=strrchr to get this to load right. +- # + # To change the location of the configuration file, use a + # -DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar. +--- 81,84 ---- +*************** +*** 101,105 **** + # be used) + # +! DEFS= -DREFCLOCK -DS_CHAR_DEFINED -DREADKMEM -DDEBUG -DPLL -DXNTP_RETROFIT_STDLIB -DHAVE_UNISTD_H + + # +--- 98,102 ---- + # be used) + # +! DEFS= -DREFCLOCK -DS_CHAR_DEFINED -DREADKMEM -DDEBUG -DPLL -DXNTP_RETROFIT_STDLIB -DNTP_POSIX_SOURCE + + # +*** /tmp/RCSA023428 Wed Jan 26 17:56:27 1994 +--- conf/Config.TRURO Wed Jan 26 16:33:30 1994 +*************** +*** 87,93 **** + # CLOCKDEFS= line below. This flag affects xntpd only. + # +- # There is an occurance of a call to rindex() in the daemon. You may +- # have to include a -Drindex=strrchr to get this to load right. +- # + # To change the location of the configuration file, use a + # -DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar. +--- 87,90 ---- +*************** +*** 110,114 **** + # generated by the pps signal. Only one of these flags should be defined. + # +! DEFS= -DDEBUG -DSTREAM -DREFCLOCK -DNO_SIGNED_CHAR_DECL -DSLEWALWAYS -DSOLARIS -DPPS -DSTUPID_SIGNAL -DXNTP_RETROFIT_STDLIB -DHAVE_UNISTD_H + + # +--- 107,111 ---- + # generated by the pps signal. Only one of these flags should be defined. + # +! DEFS= -DDEBUG -DSTREAM -DREFCLOCK -DNO_SIGNED_CHAR_DECL -DSLEWALWAYS -DSOLARIS -DPPS -DSTUPID_SIGNAL -DXNTP_RETROFIT_STDLIB -DNTP_POSIX_SOURCE + + # +*** /tmp/RCSA023441 Wed Jan 26 17:56:29 1994 +--- include/l_stdlib.h Wed Jan 26 16:33:30 1994 +*************** +*** 39,43 **** + #if !defined(NTP_POSIX_SOURCE) + extern int atoi P((char *)); +- extern void bcopy P((char *, char *, int)); + extern int dup2 P((int, int)); + extern int execve P((char *, char **,char **)); +--- 39,42 ---- +*************** +*** 51,58 **** + #endif + +- #ifndef bzero /* XXX macro prototyping clash */ +- extern void bzero P((char *, int)); +- extern int bcmp P((char *, char *, int)); +- #endif + extern char *mktemp P((char *)); + +--- 50,53 ---- +*************** +*** 193,200 **** + #ifndef NTP_POSIX_SOURCE + extern int atoi P((char *)); +- extern void bcopy P((char *, char *, int)); +- extern void bzero P((char *, int)); +- extern int bcmp P((char *, char *, int)); +- extern void bcopy P((char *, char *, int)); + extern int execve P((char *, char **,char **)); + extern int fork P((void)); +--- 188,191 ---- +*** /tmp/RCSA023441 Wed Jan 26 17:56:29 1994 +--- include/ntp.h Wed Jan 26 16:33:30 1994 +*************** +*** 329,333 **** + + /* +! * Definitions for the clear() routine. We use bzero() to clear + * the parts of the peer structure which go to zero. These are + * used to calculate the start address and length of the area. +--- 329,333 ---- + + /* +! * Definitions for the clear() routine. We use memset() to clear + * the parts of the peer structure which go to zero. These are + * used to calculate the start address and length of the area. +*** /tmp/RCSA023441 Wed Jan 26 17:56:29 1994 +--- include/ntp_machine.h Wed Jan 26 16:33:31 1994 +*************** +*** 1,3 **** +! /* ntp_compat.h,v 3.1 1993/07/06 01:06:49 jbj Exp + * Collect all machine dependent idiosyncrasies in one place. + */ +--- 1,3 ---- +! /* ntp_machine.h,v 3.1 1993/07/06 01:06:49 jbj Exp + * Collect all machine dependent idiosyncrasies in one place. + */ +*************** +*** 53,61 **** + + THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about +! kernal mucking. + + NTP_POSIX_SOURCE - Use POSIX functions over bsd functions and att functions. + This is NOT the same as _POSIX_SOURCE. +! It is much weeker! + + +--- 53,61 ---- + + THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about +! kernel mucking. + + NTP_POSIX_SOURCE - Use POSIX functions over bsd functions and att functions. + This is NOT the same as _POSIX_SOURCE. +! It is much weaker! + + +*************** +*** 95,99 **** + UNIX V.4 machines implement a sockets library on top of streams. + When requesting the IP interface configuration with an ioctl(2) calll, +! an arrat of ifreq structures are placed in the provided buffer. Some + implementations also place the length of the buffer information in + the first integer position of the buffer. +--- 95,99 ---- + UNIX V.4 machines implement a sockets library on top of streams. + When requesting the IP interface configuration with an ioctl(2) calll, +! an array of ifreq structures are placed in the provided buffer. Some + implementations also place the length of the buffer information in + the first integer position of the buffer. +*************** +*** 115,121 **** + RETSIGTYPE - Define signal function type. + NO_SIGNED_CHAR_DECL - No "signed char" see include/ntp.h +! LOCK_PROCESS - Have plock. + UDP_WILDCARD_DELIVERY +! - these systems deliver broadcast pakets to the wildcard + port instead to a port bound to the interface bound + to the correct broadcast address - are these +--- 115,121 ---- + RETSIGTYPE - Define signal function type. + NO_SIGNED_CHAR_DECL - No "signed char" see include/ntp.h +! LOCK_PROCESS - Have plock. + UDP_WILDCARD_DELIVERY +! - these systems deliver broadcast packets to the wildcard + port instead to a port bound to the interface bound + to the correct broadcast address - are these +*************** +*** 122,133 **** + implementations broken or did the spec change ? + +- HAVE_UNISTD_H - Maybe should be part of NTP_POSIX_SOURCE ? +- + You could just put the defines on the DEFS line in machines/ file. +! I don't since there are lost of different types compiler that a systemm might +! have, some that can do proto typing and others that cannot on the saem system. +! I get a chanse to twiddle some of the configuration paramasters at compile +! time based on compler/machine combinatsions by using this include file. +! See convex, aix and sun configurations see how complex it get. + + */ +--- 122,135 ---- + implementations broken or did the spec change ? + + You could just put the defines on the DEFS line in machines/ file. +! I don't since there are lots of different types of compiler that a system might +! have, some that can do prototyping and others that cannot on the saem system. +! I get a chance to twiddle some of the configuration paramasters at compile +! time based on compler/machine combinations by using this include file. +! See convex, aix and sun configurations see how complex it gets. +! +! Note that it _is_ considered reasonable to add some system-specific defines +! to the machine/ file if it would be too inconvenient to puzzle them out +! in this file. + + */ +*************** +*** 145,152 **** + * Keep USE_PROTOTYPES and _NO_PROTO in step. + */ +! #if defined(_NO_PROTO)&&defined(USE_PROTOTYPES) + #undef USE_PROTOTYPES + #endif +! #if !defined(_NO_PROTO)&&!defined(USE_PROTOTYPES) + #define USE_PROTOTYPES + #endif +--- 147,154 ---- + * Keep USE_PROTOTYPES and _NO_PROTO in step. + */ +! #if defined(_NO_PROTO) && defined(USE_PROTOTYPES) + #undef USE_PROTOTYPES + #endif +! #if !defined(_NO_PROTO) && !defined(USE_PROTOTYPES) + #define USE_PROTOTYPES + #endif +*************** +*** 204,208 **** + * Convex + */ +! #if defined(SYS_CONVEXOS10)||defined(SYS_CONVEXOS9) + #define HAVE_SIGNALED_IO + #define HAVE_N_UN +--- 206,210 ---- + * Convex + */ +! #if defined(SYS_CONVEXOS10) || defined(SYS_CONVEXOS9) + #define HAVE_SIGNALED_IO + #define HAVE_N_UN +*************** +*** 213,221 **** + #define NO_SIGNED_CHAR_DECL + #else +! #if defined(__stdc__)&&!defined(USE_PROTOTYPES) + #define USE_PROTOTYPES + #endif +! #if !defined(__stdc__)&&defined(USE_PROTOTYPES) +! #undef USE_PROTOTYPES + #endif + #define NTP_POSIX_SOURCE +--- 215,223 ---- + #define NO_SIGNED_CHAR_DECL + #else +! #if defined(__stdc__) && !defined(USE_PROTOTYPES) + #define USE_PROTOTYPES + #endif +! #if !defined(__stdc__) && defined(USE_PROTOTYPES) +! #undef USE_PROTOTYPES + #endif + #define NTP_POSIX_SOURCE +*************** +*** 253,257 **** + * AUX + */ +! #if defined(SYS_AUX2)||defined(SYS_AUX3) + #define NO_SIGNED_CHAR_DECL + #define HAVE_READKMEM +--- 255,259 ---- + * AUX + */ +! #if defined(SYS_AUX2) || defined(SYS_AUX3) + #define NO_SIGNED_CHAR_DECL + #define HAVE_READKMEM +*************** +*** 292,296 **** + #define NTP_POSIX_SOURCE + #define HAVE_SIGNALED_IO +- #define HAVE_UNISTD_H + #define NO_SIGNED_CHAR_DECL + #define LOCK_PROCESS +--- 294,297 ---- +*************** +*** 302,305 **** +--- 303,308 ---- + #define HAVE_READKMEM + #endif ++ #define getdtablesize() sysconf(_SC_OPEN_MAX) ++ #define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) + #endif + +*************** +*** 313,316 **** +--- 316,320 ---- + #define HAVE_BSD_NICE + #define HAVE_BSD_TTYS ++ #define HAVE_TERMIOS + #endif + +*************** +*** 342,346 **** + + /* +! * DECOSF1 + */ + #if defined(SYS_DECOSF1) +--- 346,350 ---- + + /* +! * DEC AXP OSF/1 + */ + #if defined(SYS_DECOSF1) +*************** +*** 354,357 **** +--- 358,362 ---- + /* + * I386 ++ * XXX - what OS? + */ + #if defined(SYS_I386) +*************** +*** 412,416 **** + + /* +! * Sony + */ + #if defined(SYS_SONY) +--- 417,421 ---- + + /* +! * Sony NEWS + */ + #if defined(SYS_SONY) +*************** +*** 422,425 **** +--- 427,431 ---- + /* + * VAX ++ * XXX - VMS? + */ + #if defined(SYS_VAX) +*************** +*** 435,439 **** + #define HAVE_ATT_SETPGRP + #define USE_PROTOTYPES +- #define HAVE_UNISTD_H + #define NTP_POSIX_SOURCE + #define HAVE_ATT_NICE +--- 441,444 ---- +*************** +*** 484,490 **** + #endif /* NTP_SYSCALLS_STD */ + +! #if !defined(HAVE_ATT_NICE) && !defined(HAVE_BSD_NICE) && !defined(HAVE_NO_NICE) + ERROR You_must_define_one_of_the_HAVE_xx_NICE_defines + #endif + + #endif /* __ntp_machine */ +--- 489,545 ---- + #endif /* NTP_SYSCALLS_STD */ + +! #if !defined(HAVE_ATT_NICE) \ +! && !defined(HAVE_BSD_NICE) \ +! && !defined(HAVE_NO_NICE) + ERROR You_must_define_one_of_the_HAVE_xx_NICE_defines + #endif ++ ++ ++ #if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN) ++ ++ # if defined(XNTP_AUTO_ENDIAN) ++ # include ++ ++ # if BYTE_ORDER == BIG_ENDIAN ++ # define XNTP_BIG_ENDIAN ++ # endif ++ # if BYTE_ORDER == LITTLE_ENDIAN ++ # define XNTP_LITTLE_ENDIAN ++ # endif ++ ++ # else /* AUTO */ ++ ++ # ifdef WORDS_BIGENDIAN ++ # define XNTP_BIG_ENDIAN 1 ++ # else ++ # define XNTP_LITTLE_ENDIAN 1 ++ # endif ++ ++ # endif /* AUTO */ ++ ++ #endif /* !BIG && !LITTLE */ ++ ++ /* ++ * Byte order woes. The DES code is sensitive to byte order. This ++ * used to be resolved by calling ntohl() and htonl() to swap things ++ * around, but this turned out to be quite costly on Vaxes where those ++ * things are actual functions. The code now straightens out byte ++ * order troubles on its own, with no performance penalty for little ++ * end first machines, but at great expense to cleanliness. ++ */ ++ #if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN) ++ /* ++ * Pick one or the other. ++ */ ++ BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION ++ #endif ++ ++ #if defined(XNTP_BIG_ENDIAN) && defined(XNTP_LITTLE_ENDIAN) ++ /* ++ * Pick one or the other. ++ */ ++ BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION ++ #endif ++ + + #endif /* __ntp_machine */ +*** /tmp/RCSA023441 Wed Jan 26 17:56:30 1994 +--- include/ntp_select.h Wed Jan 26 16:33:31 1994 +*************** +*** 15,19 **** + #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) + #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +! #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) + #endif + +--- 15,19 ---- + #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) + #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +! #define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) + #endif + +*** /tmp/RCSA023441 Wed Jan 26 17:56:30 1994 +--- include/ntp_stdlib.h Wed Jan 26 16:33:31 1994 +*************** +*** 48,52 **** + extern int clocktime P((int, int, int, int, int, U_LONG, U_LONG *, U_LONG *)); + extern char * emalloc P((u_int)); +! extern int getopt_l P((int, char **, char *)); + extern void init_auth P((void)); + extern void init_lib P((void)); +--- 48,52 ---- + extern int clocktime P((int, int, int, int, int, U_LONG, U_LONG *, U_LONG *)); + extern char * emalloc P((u_int)); +! extern int ntp_getopt P((int, char **, char *)); + extern void init_auth P((void)); + extern void init_lib P((void)); +*** /tmp/RCSA023441 Wed Jan 26 17:56:30 1994 +--- include/ntp_string.h Wed Jan 26 16:33:31 1994 +*************** +*** 1,4 **** + /* +! * Define bcopy, bzero, and bcmp and string op's + */ + +--- 1,4 ---- + /* +! * Define string ops: strchr strrchr memcmp memmove memset + */ + +*************** +*** 8,27 **** + #ifdef NTP_POSIX_SOURCE + +! #if defined(HAVE_MEMORY_H) +! #include +! #endif +! +! #include +! +! #define bcopy(s1,s2,n) memcpy(s2, s1, n) +! #define bzero(s,n) memset(s, 0, n) +! #define bcmp(s1,s2,n) memcmp(s1, s2, n) + + #else /* NTP_POSIX_SOURCE */ + +! #include + +! #define strrchr rindex +! #define strchr index + + #endif /* NTP_POSIX_SOURCE */ +--- 8,27 ---- + #ifdef NTP_POSIX_SOURCE + +! # if defined(HAVE_MEMORY_H) +! # include +! # endif + ++ # include ++ + #else /* NTP_POSIX_SOURCE */ + +! # include + +! # define strchr(s,c) index(s,c) +! # define strrchr(s,c) rindex(s,c) +! # define memcmp(a,b,c) bcmp(a,b,c) +! # define memmove(t,f,c) bcopy(f,t,c) +! # define memset(a,x,c) if (x == 0x00) bzero(a,c) else ntp_memset((char*)a,x,c) +! void ntp_memset P((char *, int, int)); + + #endif /* NTP_POSIX_SOURCE */ +*** /tmp/RCSA023456 Wed Jan 26 17:56:31 1994 +--- kernel/tty_clk_STREAMS.c Wed Jan 26 16:33:31 1994 +*************** +*** 63,67 **** + + /* +! * God only knows why, but linking with strchr() and index() fail + * on my system, so here's a renamed copy. + */ +--- 63,67 ---- + + /* +! * God only knows why, but linking with strchr() fails + * on my system, so here's a renamed copy. + */ +*** /tmp/RCSA023460 Wed Jan 26 17:56:32 1994 +--- lib/a_md512crypt.c Wed Jan 26 16:33:31 1994 +*************** +*** 81,86 **** + MD5Final(&ctx); + +! bcopy((char *)ctx.digest, (char *) &pkt[NOCRYPT_LONGS + length/sizeof(U_LONG)], +! BLOCK_OCTETS); +! return 4 + BLOCK_OCTETS; + } +--- 81,87 ---- + MD5Final(&ctx); + +! memmove((char *) &pkt[NOCRYPT_LONGS + length/sizeof(U_LONG)], +! (char *) ctx.digest, +! BLOCK_OCTETS); +! return (4 + BLOCK_OCTETS); + } +*** /tmp/RCSA023460 Wed Jan 26 17:56:33 1994 +--- lib/a_md5decrypt.c Wed Jan 26 16:33:32 1994 +*************** +*** 55,58 **** + MD5Final(&ctx); + +! return (0 == bcmp((char *)ctx.digest, (char *)pkt + length + 4, BLOCK_OCTETS)); + } +--- 55,60 ---- + MD5Final(&ctx); + +! return (!memcmp((char *)ctx.digest, +! (char *)pkt + length + 4, +! BLOCK_OCTETS)); + } +*** /tmp/RCSA023460 Wed Jan 26 17:56:33 1994 +--- lib/a_md5encrypt.c Wed Jan 26 16:33:32 1994 +*************** +*** 64,68 **** + MD5Final(&ctx); + +! bcopy((char *)ctx.digest, (char *) &pkt[NOCRYPT_LONGS + len], BLOCK_OCTETS); +! return 4 + BLOCK_OCTETS; /* return size of key and MAC */ + } +--- 64,70 ---- + MD5Final(&ctx); + +! memmove((char *)&pkt[NOCRYPT_LONGS + len], +! (char *)ctx.digest, +! BLOCK_OCTETS); +! return (4 + BLOCK_OCTETS); /* return size of key and MAC */ + } +*** /tmp/RCSA023460 Wed Jan 26 17:56:33 1994 +--- lib/authdes.c Wed Jan 26 16:33:32 1994 +*************** +*** 4,31 **** + #include "ntp_stdlib.h" + +- #if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN) +- +- #if defined(XNTP_AUTO_ENDIAN) +- #include +- +- #if BYTE_ORDER == BIG_ENDIAN +- #define XNTP_BIG_ENDIAN +- #endif +- #if BYTE_ORDER == LITTLE_ENDIAN +- #define XNTP_LITTLE_ENDIAN +- #endif +- +- #else /* AUTO */ +- +- #ifdef WORDS_BIGENDIAN +- #define XNTP_BIG_ENDIAN 1 +- #else +- #define XNTP_LITTLE_ENDIAN 1 +- #endif +- +- #endif /* AUTO */ +- +- #endif /* !BIG && !LITTLE */ +- + /* + * There are two entries in here. auth_subkeys() called to +--- 4,7 ---- +*************** +*** 33,58 **** + * auth_des() is called to do the actual encryption/decryption + */ +- +- /* +- * Byte order woes. The DES code is sensitive to byte order. This +- * used to be resolved by calling ntohl() and htonl() to swap things +- * around, but this turned out to be quite costly on Vaxes where those +- * things are actual functions. The code now straightens out byte +- * order troubles on its own, with no performance penalty for little +- * end first machines, but at great expense to cleanliness. +- */ +- #if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN) +- /* +- * Pick one or the other. +- */ +- BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION +- #endif +- +- #if defined(XNTP_BIG_ENDIAN) && defined(XNTP_LITTLE_ENDIAN) +- /* +- * Pick one or the other. +- */ +- BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION +- #endif + + /* +--- 9,12 ---- +*** /tmp/RCSA023460 Wed Jan 26 17:56:33 1994 +--- lib/authkeys.c Wed Jan 26 16:33:32 1994 +*************** +*** 110,114 **** + * Initialize hash table and free list + */ +! bzero((char *)key_hash, sizeof key_hash); + cache_flags = cache_keyid = 0; + +--- 110,114 ---- + * Initialize hash table and free list + */ +! memset((char *)key_hash, 0, sizeof key_hash); + cache_flags = cache_keyid = 0; + +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/authusekey.c Wed Jan 26 16:33:32 1994 +*************** +*** 97,101 **** + * Make up key from ascii representation + */ +! bzero((char *) keybytes, sizeof(keybytes)); + for (i = 0; i < 8 && i < len; i++) + keybytes[i] = *cp++ << 1; +--- 97,101 ---- + * Make up key from ascii representation + */ +! memset((char *) keybytes, 0, sizeof(keybytes)); + for (i = 0; i < 8 && i < len; i++) + keybytes[i] = *cp++ << 1; +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/dofptoa.c Wed Jan 26 16:33:33 1994 +*************** +*** 32,36 **** + * Zero out the buffer + */ +! bzero((char *)cbuf, sizeof cbuf); + + /* +--- 32,36 ---- + * Zero out the buffer + */ +! memset((char *)cbuf, 0, sizeof cbuf); + + /* +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/dolfptoa.c Wed Jan 26 16:33:33 1994 +*************** +*** 33,37 **** + * Zero the character buffer + */ +! bzero((char *) cbuf, sizeof(cbuf)); + + /* +--- 33,37 ---- + * Zero the character buffer + */ +! memset((char *) cbuf, 0, sizeof(cbuf)); + + /* +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/getopt.c Wed Jan 26 16:33:33 1994 +*************** +*** 5,9 **** + * Henry Spencer, changed for 4.3BSD compatibility (in addition to System V). + * It allows rescanning of an option list by setting optind to 0 before +! * calling. Thanks to Dennis Ferguson for the appropriate modifications. + * + * This file is in the Public Domain. +--- 5,11 ---- + * Henry Spencer, changed for 4.3BSD compatibility (in addition to System V). + * It allows rescanning of an option list by setting optind to 0 before +! * calling, which is why we use it even if the system has its own (in fact, +! * this one has a unique name so as not to conflict with the system's). +! * Thanks to Dennis Ferguson for the appropriate modifications. + * + * This file is in the Public Domain. +*************** +*** 21,57 **** + #endif /* lint */ + +! char *optarg; /* Global argument pointer. */ +! #ifndef __convex__ +! int optind = 0; /* Global argv index. */ +! #else /* __convex__ */ +! extern int optind; /* Global argv index. */ +! #endif /* __convex__ */ + +- /* +- * N.B. use following at own risk +- */ +- #ifndef __convex__ +- int opterr = 1; /* for compatibility, should error be printed? */ +- #else /* __convex__ */ +- extern int opterr; /* for compatibility, should error be printed? */ +- #endif /* __convex__ */ +- int optopt; /* for compatibility, option character checked */ +- + static char *scan = NULL; /* Private scan pointer. */ + + /* +! * Print message about a bad option. Watch this definition, it's +! * not a single statement. + */ +! #define BADOPT(mess, ch) if (opterr) { \ +! fputs(argv[0], stderr); \ +! fputs(mess, stderr); \ +! (void) putc(ch, stderr); \ +! (void) putc('\n', stderr); \ +! } \ +! return('?') + + int +! getopt_l(argc, argv, optstring) + int argc; + char *argv[]; +--- 23,53 ---- + #endif /* lint */ + +! char *ntp_optarg; /* Global argument pointer. */ +! int ntp_optind = 0; /* Global argv index. */ +! int ntp_opterr = 1; /* for compatibility, should error be printed? */ +! int ntp_optopt; /* for compatibility, option character checked */ + + static char *scan = NULL; /* Private scan pointer. */ ++ static char *prog = "amnesia"; + + /* +! * Print message about a bad option. + */ +! static int +! badopt(mess, ch) +! char *mess; +! int ch; +! { +! if (ntp_opterr) { +! fputs(prog, stderr); +! fputs(mess, stderr); +! (void) putc(ch, stderr); +! (void) putc('\n', stderr); +! } +! return ('?'); +! } + + int +! ntp_getopt(argc, argv, optstring) + int argc; + char *argv[]; +*************** +*** 61,85 **** + register char *place; + +! optarg = NULL; + +! if (optind == 0) { + scan = NULL; +! optind++; + } + + if (scan == NULL || *scan == '\0') { +! if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') +! return EOF; +! if (argv[optind][1] == '-' && argv[optind][2] == '\0') { +! optind++; +! return EOF; + } + +! scan = argv[optind]+1; +! optind++; + } + + c = *scan++; +! optopt = c & 0377; + for (place = optstring; place != NULL && *place != '\0'; ++place) + if (*place == c) +--- 57,85 ---- + register char *place; + +! prog = argv[0]; +! ntp_optarg = NULL; + +! if (ntp_optind == 0) { + scan = NULL; +! ntp_optind++; + } + + if (scan == NULL || *scan == '\0') { +! if (ntp_optind >= argc +! || argv[ntp_optind][0] != '-' +! || argv[ntp_optind][1] == '\0') { +! return (EOF); +! } +! if (argv[ntp_optind][1] == '-' +! && argv[ntp_optind][2] == '\0') { +! ntp_optind++; +! return (EOF); + } + +! scan = argv[ntp_optind++]+1; + } + + c = *scan++; +! ntp_optopt = c & 0377; + for (place = optstring; place != NULL && *place != '\0'; ++place) + if (*place == c) +*************** +*** 87,91 **** + + if (place == NULL || *place == '\0' || c == ':' || c == '?') { +! BADOPT(": unknown option -", c); + } + +--- 87,91 ---- + + if (place == NULL || *place == '\0' || c == ':' || c == '?') { +! return (badopt(": unknown option -", c)); + } + +*************** +*** 93,106 **** + if (*place == ':') { + if (*scan != '\0') { +! optarg = scan; + scan = NULL; +! } else if (optind >= argc) { +! BADOPT(": option requires argument -", c); + } else { +! optarg = argv[optind]; +! optind++; + } + } + +! return c&0377; + } +--- 93,105 ---- + if (*place == ':') { + if (*scan != '\0') { +! ntp_optarg = scan; + scan = NULL; +! } else if (ntp_optind >= argc) { +! return (badopt(": option requires argument -", c)); + } else { +! ntp_optarg = argv[ntp_optind++]; + } + } + +! return (c & 0377); + } +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/machines.c Wed Jan 26 16:33:33 1994 +*************** +*** 1,18 **** +! /* +! * provide special support for peculiar architectures + * + * Real bummers unite ! + */ + + #ifdef SYS_PTX + #include + #include +! int settimeofday(tvp) + struct timeval *tvp; + { +! return stime(&tvp->tv_sec); /* lie as bad as SysVR4 */ + } + +! int gettimeofday(tvp) + struct timeval *tvp; + { +--- 1,24 ---- +! /* machines.c - provide special support for peculiar architectures + * + * Real bummers unite ! ++ * ++ * $Id:$ + */ + ++ #include "ntp_stdlib.h" ++ + #ifdef SYS_PTX + #include + #include +! +! int +! settimeofday(tvp) + struct timeval *tvp; + { +! return (stime(&tvp->tv_sec)); /* lie as bad as SysVR4 */ + } + +! int +! gettimeofday(tvp) + struct timeval *tvp; + { +*************** +*** 21,118 **** + * this is also the most logical syscall for such a function + */ +! return get_process_stats(tvp, PS_SELF, (struct procstats *) 0, +! (struct procstats *) 0); +! } +! #endif +! +! #ifdef SYS_HPUX +! /* hpux.c,v 3.1 1993/07/06 01:08:23 jbj Exp +! * hpux.c -- compatibility routines for HP-UX. +! * XXX many of these are not needed anymore. +! */ +! #include "ntp_machine.h" +! +! #ifdef HAVE_UNISTD_H +! #include +! #endif +! #include +! +! #include "ntp_stdlib.h" +! +! #if (SYS_HPUX < 8) +! char +! *index(s, c) +! register char *s; +! register int c; +! { +! return strchr (s, c); +! } +! +! +! char +! *rindex(s, c) +! register char *s; +! register int c; +! { +! return strrchr (s, c); +! } +! +! +! int +! bcmp(a, b, count) +! register char *a, *b; +! register int count; +! { +! return memcmp (a, b, count); +! } +! +! +! void +! bcopy(from, to, count) +! register char *from; +! register char *to; +! register int count; +! { +! if ((to == from) || (count <= 0)) +! return; +! +! if ((to > from) && (to <= (from + count))) { +! to += count; +! from += count; +! +! do { +! *--to = *--from; +! } while (--count); +! } +! else { +! do { +! *to++ = *from++; +! } while (--count); +! } +! } +! +! +! void +! bzero(area, count) +! register char *area; +! register int count; +! { +! memset(area, 0, count); + } + #endif + +! +! getdtablesize() +! { +! return(sysconf(_SC_OPEN_MAX)); +! } +! +! +! int +! setlinebuf(a_stream) +! FILE *a_stream; + { +! return setvbuf(a_stream, (char *) NULL, _IOLBF, 0); + } +! +! #endif +--- 27,43 ---- + * this is also the most logical syscall for such a function + */ +! return (get_process_stats(tvp, PS_SELF, (struct procstats *) 0, +! (struct procstats *) 0)); + } + #endif + +! #if !defined(NTP_POSIX_SOURCE) +! void +! ntp_memset(a, x, c) +! char *a; +! int x, c; + { +! while (c-- > 0) +! *a++ = x; + } +! #endif /*POSIX*/ +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/numtohost.c Wed Jan 26 16:37:59 1994 +*************** +*** 2,6 **** + * numtohost - convert network number to host name. + */ +- #include "ntp_string.h" + #include + +--- 2,5 ---- +*** /tmp/RCSA023460 Wed Jan 26 17:56:34 1994 +--- lib/systime.c Wed Jan 26 16:33:33 1994 +*************** +*** 346,350 **** + */ + if (oldtime != timetv.tv_sec) { +! bzero((char *)&ut, sizeof(ut)); + ut.ut_type = OLD_TIME; + ut.ut_time = oldtime; +--- 346,350 ---- + */ + if (oldtime != timetv.tv_sec) { +! memset((char *)&ut, 0, sizeof(ut)); + ut.ut_type = OLD_TIME; + ut.ut_time = oldtime; +*** /tmp/RCSA023486 Wed Jan 26 17:56:35 1994 +--- machines/bsdi Wed Jan 26 16:33:33 1994 +*************** +*** 1,5 **** + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_BSDI -DHAVE_TERMIOS + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK +--- 1,5 ---- + RANLIB= ranlib + DEFS_LOCAL=-DREFCLOCK +! DEFS= -DSYS_BSDI + AUTHDEFS= -DDES -DMD5 + CLOCKDEFS= -DLOCAL_CLOCK +*** /tmp/RCSA023490 Wed Jan 26 17:56:36 1994 +--- ntpdate/ntpdate.c Wed Jan 26 16:33:34 1994 +*************** +*** 168,173 **** + int errflg; + int c; +! extern char *optarg; +! extern int optind; + extern char *Version; + +--- 168,173 ---- + int errflg; + int c; +! extern char *ntp_optarg; +! extern int ntp_optind; + extern char *Version; + +*************** +*** 179,186 **** + * Decode argument list + */ +! while ((c = getopt_l(argc, argv, "a:bde:k:o:p:qst:v")) != EOF) + switch (c) { + case 'a': +! c = atoi(optarg); + sys_authenticate = 1; + sys_authkey = (U_LONG)c; +--- 179,186 ---- + * Decode argument list + */ +! while ((c = ntp_getopt(argc, argv, "a:bde:k:o:p:qst:v")) != EOF) + switch (c) { + case 'a': +! c = atoi(ntp_optarg); + sys_authenticate = 1; + sys_authkey = (U_LONG)c; +*************** +*** 193,201 **** + break; + case 'e': +! if (!atolfp(optarg, &tmp) + || tmp.l_ui != 0) { + (void) fprintf(stderr, + "%s: encryption delay %s is unlikely\n", +! progname, optarg); + errflg++; + } else { +--- 193,201 ---- + break; + case 'e': +! if (!atolfp(ntp_optarg, &tmp) + || tmp.l_ui != 0) { + (void) fprintf(stderr, + "%s: encryption delay %s is unlikely\n", +! progname, ntp_optarg); + errflg++; + } else { +*************** +*** 204,214 **** + break; + case 'k': +! key_file = optarg; + break; + case 'o': +! sys_version = atoi(optarg); + break; + case 'p': +! c = atoi(optarg); + if (c <= 0 || c > NTP_SHIFT) { + (void) fprintf(stderr, +--- 204,214 ---- + break; + case 'k': +! key_file = ntp_optarg; + break; + case 'o': +! sys_version = atoi(ntp_optarg); + break; + case 'p': +! c = atoi(ntp_optarg); + if (c <= 0 || c > NTP_SHIFT) { + (void) fprintf(stderr, +*************** +*** 227,234 **** + break; + case 't': +! if (!atolfp(optarg, &tmp)) { + (void) fprintf(stderr, + "%s: timeout %s is undecodeable\n", +! progname, optarg); + errflg++; + } else { +--- 227,234 ---- + break; + case 't': +! if (!atolfp(ntp_optarg, &tmp)) { + (void) fprintf(stderr, + "%s: timeout %s is undecodeable\n", +! progname, ntp_optarg); + errflg++; + } else { +*************** +*** 249,253 **** + } + +! sys_maxservers = argc - optind; + if (errflg || sys_maxservers == 0) { + (void) fprintf(stderr, +--- 249,253 ---- + } + +! sys_maxservers = argc - ntp_optind; + if (errflg || sys_maxservers == 0) { + (void) fprintf(stderr, +*************** +*** 294,299 **** + * Add servers we are going to be polling + */ +! for ( ; optind < argc; optind++) +! addserver(argv[optind]); + + if (sys_numservers == 0) { +--- 294,299 ---- + * Add servers we are going to be polling + */ +! for ( ; ntp_optind < argc; ntp_optind++) +! addserver(argv[ntp_optind]); + + if (sys_numservers == 0) { +*************** +*** 1031,1035 **** + + server = (struct server *)emalloc(sizeof(struct server)); +! bzero((char *)server, sizeof(struct server)); + + server->srcadr.sin_family = AF_INET; +--- 1031,1035 ---- + + server = (struct server *)emalloc(sizeof(struct server)); +! memset((char *)server, 0, sizeof(struct server)); + + server->srcadr.sin_family = AF_INET; +*************** +*** 1189,1193 **** + struct sockaddr_in addr; + +! bzero((char *)&addr, sizeof addr); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +--- 1189,1193 ---- + struct sockaddr_in addr; + +! memset((char *)&addr, 0, sizeof addr); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +*************** +*** 1483,1490 **** + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! bcopy(hp->h_addr, (char *)num, sizeof(U_LONG)); +! return 1; + } +! return 0; + } + +--- 1483,1490 ---- + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! memmove((char *)num, hp->h_addr, sizeof(U_LONG)); +! return (1); + } +! return (0); + } + +*************** +*** 1520,1524 **** + if (pp->stratum == 1) { + junk[4] = 0; +! bcopy((char *)&pp->refid, junk, 4); + str = junk; + } else { +--- 1520,1524 ---- + if (pp->stratum == 1) { + junk[4] = 0; +! memmove(junk, (char *)&pp->refid, 4); + str = junk; + } else { +*** /tmp/RCSA023494 Wed Jan 26 17:56:37 1994 +--- ntpq/ntpq.c Wed Jan 26 16:33:34 1994 +*************** +*** 510,515 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + delay_time.l_ui = 0; +--- 510,515 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + delay_time.l_ui = 0; +*************** +*** 517,524 **** + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "c:dinp")) != EOF) + switch (c) { + case 'c': +! ADDCMD(optarg); + break; + case 'd': +--- 517,524 ---- + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "c:dinp")) != EOF) + switch (c) { + case 'c': +! ADDCMD(ntp_optarg); + break; + case 'd': +*************** +*** 544,552 **** + exit(2); + } +! if (optind == argc) { + ADDHOST(DEFHOST); + } else { +! for (; optind < argc; optind++) +! ADDHOST(argv[optind]); + } + +--- 544,552 ---- + exit(2); + } +! if (ntp_optind == argc) { + ADDHOST(DEFHOST); + } else { +! for (; ntp_optind < argc; ntp_optind++) +! ADDHOST(argv[ntp_optind]); + } + +*************** +*** 983,987 **** + * Copy the data into the data buffer. + */ +! bcopy((char *)rpkt.data, (char *)pktdata + offset, count); + + /* +--- 983,987 ---- + * Copy the data into the data buffer. + */ +! memmove((char *)pktdata + offset, (char *)rpkt.data, count); + + /* +*************** +*** 1051,1055 **** + */ + if (qsize > 0) { +! bcopy(qdata, (char *)qpkt.data, qsize); + pktsize = qsize + CTL_HEADER_LEN; + while (pktsize & (sizeof(U_LONG)-1)) { +--- 1051,1055 ---- + */ + if (qsize > 0) { +! memmove((char *)qpkt.data, qdata, qsize); + pktsize = qsize + CTL_HEADER_LEN; + while (pktsize & (sizeof(U_LONG)-1)) { +*************** +*** 1542,1546 **** + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! bcopy(hp->h_addr, (char *)num, sizeof(U_LONG)); + if (fullhost != 0) + (void) strcpy(fullhost, hp->h_name); +--- 1542,1546 ---- + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! memmove((char *)num, hp->h_addr, sizeof(U_LONG)); + if (fullhost != 0) + (void) strcpy(fullhost, hp->h_name); +*** /tmp/RCSA023494 Wed Jan 26 17:56:37 1994 +--- ntpq/ntpq_ops.c Wed Jan 26 16:33:34 1994 +*************** +*** 218,221 **** +--- 218,222 ---- + /* + * strsave - save a string ++ * XXX - should be in libntp.a + */ + static char * +*************** +*** 232,237 **** + } + +! bcopy(str, cp, len); +! return cp; + } + +--- 233,238 ---- + } + +! memmove(cp, str, len); +! return (cp); + } + +*************** +*** 373,381 **** + if (cp != data) + *cp++ = ','; +! bcopy(vl->name, cp, namelen); + cp += namelen; + if (valuelen != 0) { + *cp++ = '='; +! bcopy(vl->value, cp, valuelen); + cp += valuelen; + } +--- 374,382 ---- + if (cp != data) + *cp++ = ','; +! memmove(cp, vl->name, namelen); + cp += namelen; + if (valuelen != 0) { + *cp++ = '='; +! memmove(cp, vl->value, valuelen); + cp += valuelen; + } +*************** +*** 601,605 **** + return; + +! bzero((char *)tmplist, sizeof(tmplist)); + if (pcmd->nargs >= 2) + doaddvlist(tmplist, pcmd->argval[1].string); +--- 602,606 ---- + return; + +! memset((char *)tmplist, 0, sizeof(tmplist)); + if (pcmd->nargs >= 2) + doaddvlist(tmplist, pcmd->argval[1].string); +*************** +*** 632,636 **** + return; + +! bzero((char *)tmplist, sizeof(tmplist)); + doaddvlist(tmplist, pcmd->argval[1].string); + +--- 633,637 ---- + return; + +! memset((char *)tmplist, 0, sizeof(tmplist)); + doaddvlist(tmplist, pcmd->argval[1].string); + +*************** +*** 691,695 **** + return; + +! bzero((char *)tmplist, sizeof(tmplist)); + if (pcmd->nargs >= 2) + doaddvlist(tmplist, pcmd->argval[1].string); +--- 692,696 ---- + return; + +! memset((char *)tmplist, 0, sizeof(tmplist)); + if (pcmd->nargs >= 2) + doaddvlist(tmplist, pcmd->argval[1].string); +*************** +*** 803,807 **** + return; + +! bzero((char *)tmplist, sizeof(tmplist)); + if (pcmd->nargs >= 3) + doaddvlist(tmplist, pcmd->argval[2].string); +--- 804,808 ---- + return; + +! memset((char *)tmplist, 0, sizeof(tmplist)); + if (pcmd->nargs >= 3) + doaddvlist(tmplist, pcmd->argval[2].string); +*************** +*** 1283,1287 **** + extern struct ctl_var peer_var[]; + +! bzero((char *)havevar, sizeof(havevar)); + gettstamp(&ts); + +--- 1284,1288 ---- + extern struct ctl_var peer_var[]; + +! memset((char *)havevar, 0, sizeof(havevar)); + gettstamp(&ts); + +*** /tmp/RCSA023500 Wed Jan 26 17:56:38 1994 +--- ntptrace/ntptrace.c Wed Jan 26 16:33:35 1994 +*************** +*** 112,117 **** + int errflg; + int c; +! extern char *optarg; +! extern int optind; + extern char *Version; + +--- 112,117 ---- + int errflg; + int c; +! extern char *ntp_optarg; +! extern int ntp_optind; + extern char *Version; + +*************** +*** 122,126 **** + * Decode argument list + */ +! while ((c = getopt_l(argc, argv, "do:nr:t:v")) != EOF) + switch (c) { + case 'd': +--- 122,126 ---- + * Decode argument list + */ +! while ((c = ntp_getopt(argc, argv, "do:nr:t:v")) != EOF) + switch (c) { + case 'd': +*************** +*** 131,138 **** + break; + case 'o': +! sys_version = atoi(optarg); + break; + case 'r': +! sys_retries = atoi(optarg); + if (sys_retries < 1) { + (void)fprintf(stderr, +--- 131,138 ---- + break; + case 'o': +! sys_version = atoi(ntp_optarg); + break; + case 'r': +! sys_retries = atoi(ntp_optarg); + if (sys_retries < 1) { + (void)fprintf(stderr, +*************** +*** 143,147 **** + break; + case 't': +! sys_timeout = atoi(optarg); + if (sys_timeout < 1) { + (void)fprintf(stderr, +--- 143,147 ---- + break; + case 't': +! sys_timeout = atoi(ntp_optarg); + if (sys_timeout < 1) { + (void)fprintf(stderr, +*************** +*** 161,165 **** + } + +! if (errflg || (argc - optind) > 1) { + (void) fprintf(stderr, + "usage: %s [-vnd] [-r retries] [-t timeout] [server]\n", +--- 161,165 ---- + } + +! if (errflg || (argc - ntp_optind) > 1) { + (void) fprintf(stderr, + "usage: %s [-vnd] [-r retries] [-t timeout] [server]\n", +*************** +*** 183,188 **** + syslog(LOG_NOTICE, "%s", Version); + +! if ((argc - optind) == 1) +! firstserver = addservbyname(argv[optind]); + else + firstserver = addservbyname("localhost"); +--- 183,188 ---- + syslog(LOG_NOTICE, "%s", Version); + +! if ((argc - ntp_optind) == 1) +! firstserver = addservbyname(argv[ntp_optind]); + else + firstserver = addservbyname("localhost"); +*************** +*** 503,507 **** + + server = (struct server *)emalloc(sizeof(struct server)); +! bzero((char *)server, sizeof(struct server)); + + server->srcadr.sin_family = AF_INET; +--- 503,507 ---- + + server = (struct server *)emalloc(sizeof(struct server)); +! memset((char *)server, 0, sizeof(struct server)); + + server->srcadr.sin_family = AF_INET; +*************** +*** 617,621 **** + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! bcopy(hp->h_addr, (char *)num, sizeof(U_LONG)); + return 1; + } +--- 617,621 ---- + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! memmove((char *)num, hp->h_addr, sizeof(U_LONG)); + return 1; + } +*************** +*** 736,740 **** + if (pp->stratum == 1) { + junk[4] = 0; +! bcopy((char *)&pp->refid, junk, 4); + str = junk; + (void) fprintf(fp, "'%s'", str); +--- 736,740 ---- + if (pp->stratum == 1) { + junk[4] = 0; +! memmove(junk, (char *)&pp->refid, 4); + str = junk; + (void) fprintf(fp, "'%s'", str); +*** /tmp/RCSA023505 Wed Jan 26 17:56:39 1994 +--- parse/util/testdcf.c Wed Jan 26 16:33:35 1994 +*************** +*** 353,357 **** + } + +! bzero(term.c_cc, sizeof(term.c_cc)); + term.c_cc[VMIN] = 1; + term.c_cflag = B50|CS8|CREAD|CLOCAL; +--- 353,357 ---- + } + +! memset(term.c_cc, 0, sizeof(term.c_cc)); + term.c_cc[VMIN] = 1; + term.c_cflag = B50|CS8|CREAD|CLOCAL; +*** /tmp/RCSA023510 Wed Jan 26 17:56:40 1994 +--- ppsclock/ppstest/ppstest.c Wed Jan 26 16:33:35 1994 +*************** +*** 103,107 **** + speed_t speed = B4800; + +! bzero((char *)&termios, sizeof(termios)); + termios.c_cflag = CS8 | CREAD | CLOCAL; + termios.c_iflag = IGNCR; +--- 103,107 ---- + speed_t speed = B4800; + +! memset((char *)&termios, 0, sizeof(termios)); + termios.c_cflag = CS8 | CREAD | CLOCAL; + termios.c_iflag = IGNCR; +*** /tmp/RCSA023525 Wed Jan 26 17:56:43 1994 +--- scripts/autoconf Wed Jan 26 16:33:35 1994 +*************** +*** 324,329 **** + { + test -n "$verbose" && \ +! echo ' defining' HAVE_UNISTD_H +! DEFS="$DEFS -DHAVE_UNISTD_H=1" + } + +--- 324,329 ---- + { + test -n "$verbose" && \ +! echo ' defining' NTP_POSIX_SOURCE +! DEFS="$DEFS -DNTP_POSIX_SOURCE=1" + } + +*** /tmp/RCSA023535 Wed Jan 26 17:56:46 1994 +--- util/Makefile.tmpl Wed Jan 26 16:33:35 1994 +*************** +*** 33,37 **** + + tickadj: $(TKOBJS) +! $(CC) $(COPTS) -o $@ $(TKOBJS) $(DAEMONLIBS) $(RESLIB) $(COMPAT) + + ntptime: $(NTOBJS) +--- 33,37 ---- + + tickadj: $(TKOBJS) +! $(CC) $(COPTS) -o $@ $(TKOBJS) $(LIB) $(DAEMONLIBS) $(RESLIB) $(COMPAT) + + ntptime: $(NTOBJS) +*** /tmp/RCSA023535 Wed Jan 26 17:56:47 1994 +--- util/ntptime.c Wed Jan 26 16:33:36 1994 +*************** +*** 38,42 **** + extern int sigvec P((int, struct sigvec *, struct sigvec *)); + void pll_trap P((void)); +- extern int getopt_l P((int, char **, char *)); + + static struct sigvec newsigsys; /* new sigvec status */ +--- 38,41 ---- +*************** +*** 52,57 **** + char *argv[]; + { +! extern int optind; +! extern char *optarg; + int status; + struct ntptimeval ntv; +--- 51,56 ---- + char *argv[]; + { +! extern int ntp_optind; +! extern char *ntp_optarg; + int status; + struct ntptimeval ntv; +*************** +*** 67,71 **** + ntx.mode = 0; + progname = argv[0]; +! while ((c = getopt_l(argc, argv, optargs)) != EOF) switch (c) { + case 'c': + cost++; +--- 66,70 ---- + ntx.mode = 0; + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, optargs)) != EOF) switch (c) { + case 'c': + cost++; +*************** +*** 73,81 **** + case 'e': + ntx.mode |= ADJ_ESTERROR; +! ntx.esterror = atoi(optarg); + break; + case 'f': + ntx.mode |= ADJ_FREQUENCY; +! ntx.frequency = (int) (atof(optarg) * (1 << SHIFT_USEC)); + if (ntx.frequency < (-100 << SHIFT_USEC) + || ntx.frequency > ( 100 << SHIFT_USEC)) errflg++; +--- 72,81 ---- + case 'e': + ntx.mode |= ADJ_ESTERROR; +! ntx.esterror = atoi(ntp_optarg); + break; + case 'f': + ntx.mode |= ADJ_FREQUENCY; +! ntx.frequency = (int) (atof(ntp_optarg) +! * (1 << SHIFT_USEC)); + if (ntx.frequency < (-100 << SHIFT_USEC) + || ntx.frequency > ( 100 << SHIFT_USEC)) errflg++; +*************** +*** 83,91 **** + case 'm': + ntx.mode |= ADJ_MAXERROR; +! ntx.maxerror = atoi(optarg); + break; + case 'o': + ntx.mode |= ADJ_OFFSET; +! ntx.offset = atoi(optarg); + break; + case 'r': +--- 83,91 ---- + case 'm': + ntx.mode |= ADJ_MAXERROR; +! ntx.maxerror = atoi(ntp_optarg); + break; + case 'o': + ntx.mode |= ADJ_OFFSET; +! ntx.offset = atoi(ntp_optarg); + break; + case 'r': +*************** +*** 94,98 **** + case 's': + ntx.mode |= ADJ_STATUS; +! ntx.status = atoi(optarg); + if (ntx.status < 0 || ntx.status > 4) errflg++; + break; +--- 94,98 ---- + case 's': + ntx.mode |= ADJ_STATUS; +! ntx.status = atoi(ntp_optarg); + if (ntx.status < 0 || ntx.status > 4) errflg++; + break; +*************** +*** 99,103 **** + case 't': + ntx.mode |= ADJ_TIMECONST; +! ntx.time_constant = atoi(optarg); + if (ntx.time_constant < 0 || ntx.time_constant > MAXTC) + errflg++; +--- 99,103 ---- + case 't': + ntx.mode |= ADJ_TIMECONST; +! ntx.time_constant = atoi(ntp_optarg); + if (ntx.time_constant < 0 || ntx.time_constant > MAXTC) + errflg++; +*************** +*** 106,110 **** + errflg++; + } +! if (errflg || (optind != argc)) { + (void) fprintf(stderr, + "usage: %s [-%s]\n\n\ +--- 106,110 ---- + errflg++; + } +! if (errflg || (ntp_optind != argc)) { + (void) fprintf(stderr, + "usage: %s [-%s]\n\n\ +*** /tmp/RCSA023535 Wed Jan 26 17:56:47 1994 +--- util/tickadj.c Wed Jan 26 16:33:36 1994 +*************** +*** 62,68 **** + static void writevar P((int, unsigned long, int)); + static void readvar P((int, unsigned long, int *)); +- #ifndef NTP_POSIX_SOURCE +- extern int getopt P((int, char **, char *)); +- #endif + + /* +--- 62,65 ---- +*************** +*** 76,81 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + unsigned long tickadj_offset; + unsigned long tick_offset; +--- 73,78 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + unsigned long tickadj_offset; + unsigned long tick_offset; +*************** +*** 95,99 **** + + progname = argv[0]; +! while ((c = getopt(argc, argv, "a:Adkqpst:")) != EOF) + switch (c) { + case 'd': +--- 92,96 ---- + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "a:Adkqpst:")) != EOF) + switch (c) { + case 'd': +*************** +*** 110,118 **** + break; + case 'a': +! writetickadj = atoi(optarg); + if (writetickadj <= 0) { + (void) fprintf(stderr, + "%s: unlikely value for tickadj: %s\n", +! progname, optarg); + errflg++; + } +--- 107,115 ---- + break; + case 'a': +! writetickadj = atoi(ntp_optarg); + if (writetickadj <= 0) { + (void) fprintf(stderr, + "%s: unlikely value for tickadj: %s\n", +! progname, ntp_optarg); + errflg++; + } +*************** +*** 125,133 **** + break; + case 't': +! writetick = atoi(optarg); + if (writetick <= 0) { + (void) fprintf(stderr, + "%s: unlikely value for tick: %s\n", +! progname, optarg); + errflg++; + } +--- 122,130 ---- + break; + case 't': +! writetick = atoi(ntp_optarg); + if (writetick <= 0) { + (void) fprintf(stderr, + "%s: unlikely value for tick: %s\n", +! progname, ntp_optarg); + errflg++; + } +*************** +*** 137,141 **** + break; + } +! if (errflg || optind != argc) { + (void) fprintf(stderr, + "usage: %s [-Aqsp] [-a newadj] [-t newtick]\n", progname); +--- 134,138 ---- + break; + } +! if (errflg || ntp_optind != argc) { + (void) fprintf(stderr, + "usage: %s [-Aqsp] [-a newadj] [-t newtick]\n", progname); +*** /tmp/RCSA023543 Wed Jan 26 17:56:49 1994 +--- xntpd/ntp_config.c Wed Jan 26 16:33:36 1994 +*************** +*** 341,345 **** + int errflg; + int c; +! extern int optind; + + debug = 0; /* no debugging by default */ +--- 341,345 ---- + int errflg; + int c; +! extern int ntp_optind; + + debug = 0; /* no debugging by default */ +*************** +*** 353,357 **** + * 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 getopt_l() is explicitly reusable, by the + * way. Your own mileage may vary. + */ +--- 353,357 ---- + * 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. + */ +*************** +*** 362,366 **** + * Decode argument list + */ +! while ((c = getopt_l(argc, argv, xntp_options)) != EOF) + switch (c) { + case 'd': +--- 362,366 ---- + * Decode argument list + */ +! while ((c = ntp_getopt(argc, argv, xntp_options)) != EOF) + switch (c) { + case 'd': +*************** +*** 374,378 **** + } + +! if (errflg || optind != argc) { + (void) fprintf(stderr, + "usage: %s [ -bd ] [ -c config_file ]\n", progname); +--- 374,378 ---- + } + +! if (errflg || ntp_optind != argc) { + (void) fprintf(stderr, + "usage: %s [ -bd ] [ -c config_file ]\n", progname); +*************** +*** 379,383 **** + exit(2); + } +! optind = 0; /* reset optind to restart getopt_l */ + + if (debug) { +--- 379,383 ---- + exit(2); + } +! ntp_optind = 0; /* reset optind to restart ntp_getopt() */ + + if (debug) { +*************** +*** 427,432 **** + int have_keyfile; + char keyfile[MAXFILENAME]; +! extern int optind; +! extern char *optarg; + extern U_LONG info_auth_keyid; + FILEGEN *filegen; +--- 427,432 ---- + int have_keyfile; + char keyfile[MAXFILENAME]; +! extern int ntp_optind; +! extern char *ntp_optarg; + extern U_LONG info_auth_keyid; + FILEGEN *filegen; +*************** +*** 451,455 **** + * Decode argument list + */ +! while ((c = getopt_l(argc, argv, xntp_options)) != EOF) { + switch (c) { + case 'a': +--- 451,455 ---- + * Decode argument list + */ +! while ((c = ntp_getopt(argc, argv, xntp_options)) != EOF) { + switch (c) { + case 'a': +*************** +*** 460,464 **** + break; + case 'c': +! config_file = optarg; + break; + case 'd': +--- 460,464 ---- + break; + case 'c': +! config_file = ntp_optarg; + break; + case 'd': +*************** +*** 474,481 **** + l_fp tmp; + +! if (!atolfp(optarg, &tmp)) { + syslog(LOG_ERR, + "command line encryption delay value %s undecodable", +! optarg); + errflg++; + } else if (tmp.l_ui != 0) { +--- 474,481 ---- + l_fp tmp; + +! if (!atolfp(ntp_optarg, &tmp)) { + syslog(LOG_ERR, + "command line encryption delay value %s undecodable", +! ntp_optarg); + errflg++; + } else if (tmp.l_ui != 0) { +*************** +*** 482,486 **** + syslog(LOG_ERR, + "command line encryption delay value %s is unlikely", +! optarg); + errflg++; + } else { +--- 482,486 ---- + syslog(LOG_ERR, + "command line encryption delay value %s is unlikely", +! ntp_optarg); + errflg++; + } else { +*************** +*** 491,500 **** + + case 'f': +! stats_config(STATS_FREQ_FILE, optarg); + break; + + case 'k': +! getauthkeys(optarg); +! if ((int)strlen(optarg) >= MAXFILENAME) { + syslog(LOG_ERR, + "key file name too LONG (>%d, sigh), no name resolution possible", +--- 491,500 ---- + + case 'f': +! stats_config(STATS_FREQ_FILE, ntp_optarg); + break; + + case 'k': +! getauthkeys(ntp_optarg); +! if ((int)strlen(ntp_optarg) >= MAXFILENAME) { + syslog(LOG_ERR, + "key file name too LONG (>%d, sigh), no name resolution possible", +*************** +*** 502,506 **** + } else { + have_keyfile = 1; +! (void)strcpy(keyfile, optarg); + } + break; +--- 502,506 ---- + } else { + have_keyfile = 1; +! (void)strcpy(keyfile, ntp_optarg); + } + break; +*************** +*** 507,511 **** + + case 'p': +! stats_config(STATS_PID_FILE, optarg); + break; + +--- 507,511 ---- + + case 'p': +! stats_config(STATS_PID_FILE, ntp_optarg); + break; + +*************** +*** 514,525 **** + l_fp tmp; + +! if (!atolfp(optarg, &tmp)) { + syslog(LOG_ERR, + "command line broadcast delay value %s undecodable", +! optarg); + } else if (tmp.l_ui != 0) { + syslog(LOG_ERR, + "command line broadcast delay value %s is unlikely", +! optarg); + } else { + proto_config(PROTO_BROADDELAY, tmp.l_f); +--- 514,525 ---- + l_fp tmp; + +! if (!atolfp(ntp_optarg, &tmp)) { + syslog(LOG_ERR, + "command line broadcast delay value %s undecodable", +! ntp_optarg); + } else if (tmp.l_ui != 0) { + syslog(LOG_ERR, + "command line broadcast delay value %s is unlikely", +! ntp_optarg); + } else { + proto_config(PROTO_BROADDELAY, tmp.l_f); +*************** +*** 529,533 **** + + case 's': +! stats_config(STATS_STATSDIR, optarg); + break; + +--- 529,533 ---- + + case 's': +! stats_config(STATS_STATSDIR, ntp_optarg); + break; + +*************** +*** 536,544 **** + int tkey; + +! tkey = atoi(optarg); + if (tkey <= 0 || tkey > NTP_MAXKEY) { + syslog(LOG_ERR, + "command line trusted key %s is unlikely", +! optarg); + } else { + authtrust(tkey, (LONG)1); +--- 536,544 ---- + int tkey; + +! tkey = atoi(ntp_optarg); + if (tkey <= 0 || tkey > NTP_MAXKEY) { + syslog(LOG_ERR, + "command line trusted key %s is unlikely", +! ntp_optarg); + } else { + authtrust(tkey, (LONG)1); +*************** +*** 554,558 **** + } + +! if (errflg || optind != argc) { + (void) fprintf(stderr, + "usage: %s [ -bd ] [ -c config_file ]\n", progname); +--- 554,558 ---- + } + +! if (errflg || ntp_optind != argc) { + (void) fprintf(stderr, + "usage: %s [ -bd ] [ -c config_file ]\n", progname); +*************** +*** 1130,1134 **** + } + +! bzero((char *)&clock, sizeof clock); + errflg = 0; + for (i = 2; i < ntokens-1; i++) { +--- 1130,1134 ---- + } + +! memset((char *)&clock, 0, sizeof clock); + errflg = 0; + for (i = 2; i < ntokens-1; i++) { +*************** +*** 1582,1586 **** + * make up socket address. Clear it out for neatness. + */ +! bzero((char *)addr, sizeof(struct sockaddr_in)); + addr->sin_family = AF_INET; + addr->sin_port = htons(NTP_PORT); +--- 1582,1586 ---- + * make up socket address. Clear it out for neatness. + */ +! memset((char *)addr, 0, sizeof(struct sockaddr_in)); + addr->sin_family = AF_INET; + addr->sin_port = htons(NTP_PORT); +*** /tmp/RCSA023543 Wed Jan 26 17:56:49 1994 +--- xntpd/ntp_control.c Wed Jan 26 16:33:36 1994 +*************** +*** 873,877 **** + } + +! bcopy(dp, (char *)datapt, dlen); + datapt += dlen; + datalinelen += dlen; +--- 873,877 ---- + } + +! memmove((char *)datapt, dp, dlen); + datapt += dlen; + datalinelen += dlen; +*************** +*** 901,905 **** + if (len > (sizeof(buffer) - (cp - buffer) - 1)) + len = sizeof(buffer) - (cp - buffer) - 1; +! bcopy(data, cp, len); + cp += len; + *cp++ = '"'; +--- 901,905 ---- + if (len > (sizeof(buffer) - (cp - buffer) - 1)) + len = sizeof(buffer) - (cp - buffer) - 1; +! memmove(cp, data, len); + cp += len; + *cp++ = '"'; +*************** +*** 1697,1701 **** + if (res_authokay) + ctl_sys_num_events = 0; +! bzero((char *)wants, CS_MAXCODE+1); + gotvar = 0; + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { +--- 1697,1701 ---- + if (res_authokay) + ctl_sys_num_events = 0; +! memset((char *)wants, 0, CS_MAXCODE+1); + gotvar = 0; + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { +*************** +*** 1733,1737 **** + if (res_authokay) + peer->num_events = 0; +! bzero((char*)wants, CP_MAXCODE+1); + gotvar = 0; + while ((v = ctl_getitem(peer_var, &valuep)) != 0) { +--- 1733,1737 ---- + if (res_authokay) + peer->num_events = 0; +! memset((char*)wants, 0, CP_MAXCODE+1); + gotvar = 0; + while ((v = ctl_getitem(peer_var, &valuep)) != 0) { +*************** +*** 1906,1910 **** + rpkt.status = htons(ctlclkstatus(&clock)); + gotvar = 0; +! bzero((char*)wants, CC_MAXCODE+1); + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +--- 1906,1910 ---- + rpkt.status = htons(ctlclkstatus(&clock)); + gotvar = 0; +! memset((char*)wants, 0, CC_MAXCODE+1); + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +*** /tmp/RCSA023543 Wed Jan 26 17:56:50 1994 +--- xntpd/ntp_intres.c Wed Jan 26 16:33:37 1994 +*************** +*** 295,299 **** + len = strlen(name) + 1; + cp = emalloc((unsigned)len); +! bcopy(name, cp, len); + + ce = (struct conf_entry *)emalloc(sizeof(struct conf_entry)); +--- 295,299 ---- + len = strlen(name) + 1; + cp = emalloc((unsigned)len); +! memmove(cp, name, len); + + ce = (struct conf_entry *)emalloc(sizeof(struct conf_entry)); +*************** +*** 348,354 **** + + if (h_errno == TRY_AGAIN) +! return 1; + #endif +! return 0; + } + +--- 348,354 ---- + + if (h_errno == TRY_AGAIN) +! return (1); + #endif +! return (0); + } + +*************** +*** 358,364 **** + * only return one. + */ +! (void) bcopy(hp->h_addr, (char *)&(entry->ce_peeraddr), +! sizeof(struct in_addr)); +! return 1; + } + +--- 358,365 ---- + * only return one. + */ +! memmove((char *)&(entry->ce_peeraddr), +! (char *)hp->h_addr, +! sizeof(struct in_addr)); +! return (1); + } + +*************** +*** 381,385 **** + } + +! bzero((char *)&saddr, sizeof(saddr)); + saddr.sin_family = AF_INET; + saddr.sin_port = htons(NTP_PORT); /* trash */ +--- 382,386 ---- + } + +! memset((char *)&saddr, 0, sizeof(saddr)); + saddr.sin_family = AF_INET; + saddr.sin_port = htons(NTP_PORT); /* trash */ +*************** +*** 449,453 **** + * Make up a request packet with the configuration info + */ +! bzero((char *)&reqpkt, sizeof(reqpkt)); + + reqpkt.rm_vn_mode = RM_VN_MODE(0, 0); +--- 450,454 ---- + * Make up a request packet with the configuration info + */ +! memset((char *)&reqpkt, 0, sizeof(reqpkt)); + + reqpkt.rm_vn_mode = RM_VN_MODE(0, 0); +*************** +*** 457,461 **** + reqpkt.err_nitems = ERR_NITEMS(0, 1); /* one item */ + reqpkt.mbz_itemsize = MBZ_ITEMSIZE(sizeof(struct conf_peer)); +! bcopy((char *)conf, reqpkt.data, sizeof(struct conf_peer)); + reqpkt.keyid = htonl(req_keyid); + +--- 458,462 ---- + reqpkt.err_nitems = ERR_NITEMS(0, 1); /* one item */ + reqpkt.mbz_itemsize = MBZ_ITEMSIZE(sizeof(struct conf_peer)); +! memmove(reqpkt.data, (char *)conf, sizeof(struct conf_peer)); + reqpkt.keyid = htonl(req_keyid); + +*** /tmp/RCSA023543 Wed Jan 26 17:56:50 1994 +--- xntpd/ntp_monitor.c Wed Jan 26 16:33:37 1994 +*************** +*** 103,107 **** + mon_hash = 0; + mon_hash_count = 0; +! bzero((char *)&mon_mru_list, sizeof mon_mru_list); + } + +--- 103,107 ---- + mon_hash = 0; + mon_hash_count = 0; +! memset((char *)&mon_mru_list, 0, sizeof mon_mru_list); + } + +*************** +*** 122,126 **** + mon_hash = (struct mon_data *) + emalloc(MON_HASH_SIZE * sizeof(struct mon_data)); +! bzero((char *)mon_hash, MON_HASH_SIZE*sizeof(struct mon_data)); + mon_hash_count = (int *)emalloc(MON_HASH_SIZE * sizeof(int)); + mon_free_mem = 0; +--- 122,127 ---- + mon_hash = (struct mon_data *) + emalloc(MON_HASH_SIZE * sizeof(struct mon_data)); +! memset((char *)mon_hash, 0, +! MON_HASH_SIZE*sizeof(struct mon_data)); + mon_hash_count = (int *)emalloc(MON_HASH_SIZE * sizeof(int)); + mon_free_mem = 0; +*** /tmp/RCSA023543 Wed Jan 26 17:56:50 1994 +--- xntpd/ntp_peer.c Wed Jan 26 16:33:37 1994 +*************** +*** 440,444 **** + * Zero the whole thing for now. We might be pickier later. + */ +! bzero((char *)peer, sizeof(struct peer)); + + peer->srcadr = *srcadr; +--- 440,444 ---- + * Zero the whole thing for now. We might be pickier later. + */ +! memset((char *)peer, 0, sizeof(struct peer)); + + peer->srcadr = *srcadr; +*** /tmp/RCSA023543 Wed Jan 26 17:56:51 1994 +--- xntpd/ntp_proto.c Wed Jan 26 16:33:37 1994 +*************** +*** 1079,1083 **** + else { + if (pps_control) +! bcopy(PPSREFID, (char *)&sys_refid, 4); + else + sys_refid = peer->srcadr.sin_addr.s_addr; +--- 1079,1083 ---- + else { + if (pps_control) +! memmove((char *)&sys_refid, PPSREFID, 4); + else + sys_refid = peer->srcadr.sin_addr.s_addr; +*************** +*** 1128,1132 **** + sys_refid = peer->refid; + else +! bcopy(PPSREFID, (char *)&sys_refid, 4); + } + } +--- 1128,1132 ---- + sys_refid = peer->refid; + else +! memmove((char *)&sys_refid, PPSREFID, 4); + } + } +*************** +*** 1251,1255 **** + printf("clear(%s)\n", ntoa(&peer->srcadr)); + #endif +! bzero(CLEAR_TO_ZERO(peer), LEN_CLEAR_TO_ZERO); + peer->hpoll = peer->minpoll; + peer->dispersion = NTP_MAXDISPERSE; +--- 1251,1255 ---- + printf("clear(%s)\n", ntoa(&peer->srcadr)); + #endif +! memset(CLEAR_TO_ZERO(peer), 0, LEN_CLEAR_TO_ZERO); + peer->hpoll = peer->minpoll; + peer->dispersion = NTP_MAXDISPERSE; +*** /tmp/RCSA023543 Wed Jan 26 17:56:51 1994 +--- xntpd/ntp_request.c Wed Jan 26 16:33:38 1994 +*************** +*** 313,317 **** + * Copy data out of exbuf into the packet. + */ +! bcopy(exbuf, &rpkt.data[0], itemsize); + seqno++; + databytes = 0; +--- 313,317 ---- + * Copy data out of exbuf into the packet. + */ +! memmove(&rpkt.data[0], exbuf, itemsize); + seqno++; + databytes = 0; +*************** +*** 683,687 **** + extern struct peer *sys_peer; + +! bzero((char *)&addr, sizeof addr); + addr.sin_family = AF_INET; + items = INFO_NITEMS(inpkt->err_nitems); +--- 683,687 ---- + extern struct peer *sys_peer; + +! memset((char *)&addr, 0, sizeof addr); + addr.sin_family = AF_INET; + items = INFO_NITEMS(inpkt->err_nitems); +*************** +*** 774,778 **** + extern struct peer *sys_peer; + +! bzero((char *)&addr, sizeof addr); + addr.sin_family = AF_INET; + items = INFO_NITEMS(inpkt->err_nitems); +--- 774,778 ---- + extern struct peer *sys_peer; + +! memset((char *)&addr, 0, sizeof addr); + addr.sin_family = AF_INET; + items = INFO_NITEMS(inpkt->err_nitems); +*************** +*** 1142,1146 **** + items = INFO_NITEMS(inpkt->err_nitems); + cp = (struct conf_peer *)inpkt->data; +! bzero((char *)&peeraddr, sizeof(struct sockaddr_in)); + peeraddr.sin_family = AF_INET; + peeraddr.sin_port = htons(NTP_PORT); +--- 1142,1146 ---- + 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); +*************** +*** 1452,1457 **** + items = INFO_NITEMS(inpkt->err_nitems); + cr = (struct conf_restrict *)inpkt->data; +! bzero((char *)&matchaddr, sizeof(struct sockaddr_in)); +! bzero((char *)&matchmask, sizeof(struct sockaddr_in)); + matchaddr.sin_family = AF_INET; + matchmask.sin_family = AF_INET; +--- 1452,1457 ---- + 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; +*************** +*** 1870,1874 **** + * Prepare sockaddr_in structure + */ +! bzero((char *)&laddr, sizeof laddr); + laddr.sin_family = AF_INET; + laddr.sin_port = ntohs(NTP_PORT); +--- 1870,1874 ---- + * Prepare sockaddr_in structure + */ +! memset((char *)&laddr, 0, sizeof laddr); + laddr.sin_family = AF_INET; + laddr.sin_port = ntohs(NTP_PORT); +*************** +*** 2096,2100 **** + struct sockaddr_in addr; + +! bzero((char *)&addr, sizeof addr); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +--- 2096,2100 ---- + struct sockaddr_in addr; + +! memset((char *)&addr, 0, sizeof addr); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +*************** +*** 2150,2155 **** + struct sockaddr_in addr; + +! bzero((char *)&addr, sizeof addr); +! bzero((char *)&clock, sizeof clock); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +--- 2150,2155 ---- + struct sockaddr_in addr; + +! memset((char *)&addr, 0, sizeof addr); +! memset((char *)&clock, 0, sizeof clock); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +*************** +*** 2287,2291 **** + struct sockaddr_in addr; + +! bzero((char *)&addr, sizeof addr); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +--- 2287,2291 ---- + struct sockaddr_in addr; + +! memset((char *)&addr, 0, sizeof addr); + addr.sin_family = AF_INET; + addr.sin_port = htons(NTP_PORT); +*************** +*** 2304,2308 **** + } + +! bzero((char *)&bug, sizeof bug); + refclock_buginfo(&addr, &bug); + if (bug.nvalues == 0 && bug.ntimes == 0) { +--- 2304,2308 ---- + } + +! memset((char *)&bug, 0, sizeof bug); + refclock_buginfo(&addr, &bug); + if (bug.nvalues == 0 && bug.ntimes == 0) { +*** /tmp/RCSA023543 Wed Jan 26 17:56:52 1994 +--- xntpd/ntp_restrict.c Wed Jan 26 16:33:38 1994 +*************** +*** 82,86 **** + */ + resfree = 0; +! bzero((char *)resinit, sizeof resinit); + + for (i = 1; i < INITRESLIST; i++) { +--- 82,86 ---- + */ + resfree = 0; +! memset((char *)resinit, 0, sizeof resinit); + + for (i = 1; i < INITRESLIST; i++) { +*************** +*** 235,239 **** + rl = (struct restrictlist *) emalloc( + INCRESLIST*sizeof(struct restrictlist)); +! bzero((char *)rl, + INCRESLIST*sizeof(struct restrictlist)); + +--- 235,239 ---- + rl = (struct restrictlist *) emalloc( + INCRESLIST*sizeof(struct restrictlist)); +! memset((char *)rl, 0, + INCRESLIST*sizeof(struct restrictlist)); + +*************** +*** 281,285 **** + rlprev->next = rl->next; + restrictcount--; +! bzero((char *)rl, sizeof(struct restrictlist)); + + rl->next = resfree; +--- 281,285 ---- + rlprev->next = rl->next; + restrictcount--; +! memset((char *)rl, 0, sizeof(struct restrictlist)); + + rl->next = resfree; +*** /tmp/RCSA023543 Wed Jan 26 17:56:52 1994 +--- xntpd/ntp_util.c Wed Jan 26 16:33:39 1994 +*************** +*** 224,230 **** + stats_drift_file = emalloc((u_int)(len + 1)); + stats_temp_file = emalloc((u_int)(len + sizeof(".TEMP"))); +! bcopy(value, stats_drift_file, len+1); +! bcopy(value, stats_temp_file, len); +! bcopy(".TEMP", stats_temp_file + len, sizeof(".TEMP")); + L_CLR(&old_drift); + +--- 224,230 ---- + stats_drift_file = emalloc((u_int)(len + 1)); + stats_temp_file = emalloc((u_int)(len + sizeof(".TEMP"))); +! memmove(stats_drift_file, value, len+1); +! memmove(stats_temp_file, value, len); +! memmove(stats_temp_file + len, ".TEMP", sizeof(".TEMP")); + L_CLR(&old_drift); + +*************** +*** 450,454 **** + key_file_name = emalloc((u_int)(len + 1)); + +! bcopy(keyfile, key_file_name, len+1); + + authreadkeys(key_file_name); +--- 450,454 ---- + key_file_name = emalloc((u_int)(len + 1)); + +! memmove(key_file_name, keyfile, len+1); + + authreadkeys(key_file_name); +*** /tmp/RCSA023543 Wed Jan 26 17:56:52 1994 +--- xntpd/refclock_as2201.c Wed Jan 26 16:33:39 1994 +*************** +*** 251,256 **** + * Just zero the data arrays + */ +! bzero((char *)gpsunits, sizeof gpsunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 251,256 ---- + * Just zero the data arrays + */ +! memset((char *)gpsunits, 0, sizeof gpsunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 442,446 **** + } + } +! bzero((char *)gps, sizeof(struct gpsunit)); + gpsunits[unit] = gps; + +--- 442,446 ---- + } + } +! memset((char *)gps, 0, sizeof(struct gpsunit)); + gpsunits[unit] = gps; + +*************** +*** 480,484 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(GPSREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(GPSHSREFID); +--- 480,484 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, GPSREFID, 4); + else + peer->refid = htonl(GPSHSREFID); +*************** +*** 908,913 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(GPSREFID, (char *)&peer->refid, +! 4); + else + peer->refid = htonl(GPSHSREFID); +--- 908,913 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! GPSREFID, 4); + else + peer->refid = htonl(GPSHSREFID); +*** /tmp/RCSA023543 Wed Jan 26 17:56:52 1994 +--- xntpd/refclock_chu.c Wed Jan 26 16:33:39 1994 +*************** +*** 294,299 **** + * Just zero the data arrays + */ +! bzero((char *)chuunits, sizeof chuunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 294,299 ---- + * Just zero the data arrays + */ +! memset((char *)chuunits, 0, sizeof chuunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 462,466 **** + } + } +! bzero((char *)chu, sizeof(struct chuunit)); + chuunits[unit] = chu; + +--- 462,466 ---- + } + } +! memset((char *)chu, 0, sizeof(struct chuunit)); + chuunits[unit] = chu; + +*************** +*** 499,507 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(CHUREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(CHUHSREFID); + unitinuse[unit] = 1; +! return 1; + + /* +--- 499,507 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, CHUREFID, 4); + else + peer->refid = htonl(CHUHSREFID); + unitinuse[unit] = 1; +! return (1); + + /* +*************** +*** 1091,1095 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(CHUREFID, (char *)&peer->refid,4); + else + peer->refid = htonl(CHUHSREFID); +--- 1091,1096 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! CHUREFID, 4); + else + peer->refid = htonl(CHUHSREFID); +*** /tmp/RCSA023543 Wed Jan 26 17:56:53 1994 +--- xntpd/refclock_goes.c Wed Jan 26 16:33:39 1994 +*************** +*** 211,216 **** + * Just zero the data arrays + */ +! bzero((char *)goesunits, sizeof goesunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 211,216 ---- + * Just zero the data arrays + */ +! memset((char *)goesunits, 0, sizeof goesunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 401,405 **** + } + } +! bzero((char *)goes, sizeof(struct goesunit)); + goesunits[unit] = goes; + +--- 401,405 ---- + } + } +! memset((char *)goes, 0, sizeof(struct goesunit)); + goesunits[unit] = goes; + +*************** +*** 429,433 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(GOESREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(GOESHSREFID); +--- 429,433 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, GOESREFID, 4); + else + peer->refid = htonl(GOESHSREFID); +*************** +*** 924,929 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(GOESREFID, (char *)&peer->refid, +! 4); + else + peer->refid = htonl(GOESHSREFID); +--- 924,929 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! GOESREFID, 4); + else + peer->refid = htonl(GOESHSREFID); +*** /tmp/RCSA023543 Wed Jan 26 17:56:53 1994 +--- xntpd/refclock_gpstm.c Wed Jan 26 16:52:22 1994 +*************** +*** 18,22 **** + #ifdef SYS_BSDI + #undef HAVE_BSD_TTYS +- #define HAVE_POSIX_TTYS + #include + #endif +--- 18,21 ---- +*************** +*** 30,34 **** + #endif /* HAVE_SYSV_TTYS */ + +! #if defined(HAVE_POSIX_TTYS) + #include + #endif +--- 29,33 ---- + #endif /* HAVE_SYSV_TTYS */ + +! #if defined(HAVE_TERMIOS) + #include + #endif +*************** +*** 203,208 **** + * Just zero the data arrays + */ +! bzero((char *)gpstm_units, sizeof gpstm_units); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 202,207 ---- + * Just zero the data arrays + */ +! memset((char *)gpstm_units, 0, sizeof gpstm_units); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 278,282 **** + } + #endif /* HAVE_SYSV_TTYS */ +! #if defined(HAVE_POSIX_TTYS) + /* + * POSIX serial line parameters (termios interface) +--- 277,281 ---- + } + #endif /* HAVE_SYSV_TTYS */ +! #if defined(HAVE_TERMIOS) + /* + * POSIX serial line parameters (termios interface) +*************** +*** 331,335 **** + #endif /* STREAM */ + } +! #endif /* HAVE_POSIX_TTYS */ + #if defined(HAVE_BSD_TTYS) + /* +--- 330,334 ---- + #endif /* STREAM */ + } +! #endif /* HAVE_TERMIOS */ + #if defined(HAVE_BSD_TTYS) + /* +*************** +*** 393,397 **** + } + } +! bzero((char *)gpstm, sizeof(struct gpstm_unit)); + gpstm_units[unit] = gpstm; + +--- 392,396 ---- + } + } +! memset((char *)gpstm, 0, sizeof(struct gpstm_unit)); + gpstm_units[unit] = gpstm; + +*************** +*** 420,424 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(REFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(HSREFID); +--- 419,423 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, REFID, 4); + else + peer->refid = htonl(HSREFID); +*************** +*** 928,932 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(REFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(HSREFID); +--- 927,932 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! REFID, 4); + else + peer->refid = htonl(HSREFID); +*** /tmp/RCSA023543 Wed Jan 26 17:56:53 1994 +--- xntpd/refclock_irig.c Wed Jan 26 16:33:40 1994 +*************** +*** 170,175 **** + * Just zero the data arrays + */ +! bzero((char *) irigunits, sizeof irigunits); +! bzero((char *) unitinuse, sizeof unitinuse); + + /* +--- 170,175 ---- + * Just zero the data arrays + */ +! memset((char *) irigunits, 0, sizeof irigunits); +! memset((char *) unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 251,255 **** + } + } +! bzero((char *) irig, sizeof(struct irigunit)); + + irigunits[unit] = irig; +--- 251,255 ---- + } + } +! memset((char *) irig, 0, sizeof(struct irigunit)); + + irigunits[unit] = irig; +*************** +*** 277,281 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(IRIGREFID, (char *) &peer->refid, 4); + else + peer->refid = htonl(IRIGHSREFID); +--- 277,281 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *) &peer->refid, IRIGREFID, 4); + else + peer->refid = htonl(IRIGHSREFID); +*************** +*** 486,491 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(IRIGREFID, (char *) &peer->refid, +! 4); + else + peer->refid = htonl(IRIGHSREFID); +--- 486,491 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *) &peer->refid, +! IRIGREFID, 4); + else + peer->refid = htonl(IRIGHSREFID); +*** /tmp/RCSA023543 Wed Jan 26 17:56:53 1994 +--- xntpd/refclock_leitch.c Wed Jan 26 16:33:40 1994 +*************** +*** 145,150 **** + leitch_init() + { +! bzero((char*)leitchunits,sizeof(leitchunits)); +! bzero((char*)unitinuse,sizeof(unitinuse)); + } + +--- 145,150 ---- + leitch_init() + { +! memset((char*)leitchunits, 0, sizeof(leitchunits)); +! memset((char*)unitinuse, 0, sizeof(unitinuse)); + } + +*************** +*** 271,275 **** + + leitch = &leitchunits[unit]; +! bzero((char*)leitch,sizeof(*leitch)); + + #if defined(HAVE_SYSV_TTYS) +--- 271,275 ---- + + leitch = &leitchunits[unit]; +! memset((char*)leitch, 0, sizeof(*leitch)); + + #if defined(HAVE_SYSV_TTYS) +*** /tmp/RCSA023543 Wed Jan 26 17:56:54 1994 +--- xntpd/refclock_local.c Wed Jan 26 16:33:40 1994 +*************** +*** 101,106 **** + * Just zero the data arrays + */ +! bzero((char *)lclunits, sizeof lclunits); +! bzero((char *)unitinuse, sizeof unitinuse); + } + +--- 101,106 ---- + * Just zero the data arrays + */ +! memset((char *)lclunits, 0, sizeof lclunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + } + +*************** +*** 149,153 **** + } + } +! bzero((char *)lcl, sizeof(struct lclunit)); + lclunits[unit] = lcl; + +--- 149,153 ---- + } + } +! memset((char *)lcl, 0, sizeof(struct lclunit)); + lclunits[unit] = lcl; + +*************** +*** 167,171 **** + peer->stratum = (u_char)unit; + if (unit <= 1) +! bcopy(LCLREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(LCLHSREFID); +--- 167,171 ---- + peer->stratum = (u_char)unit; + if (unit <= 1) +! memmove((char *)&peer->refid, LCLREFID, 4); + else + peer->refid = htonl(LCLHSREFID); +*** /tmp/RCSA023576 Wed Jan 26 17:56:54 1994 +--- xntpd/refclock_msfees.c Wed Jan 26 16:33:41 1994 +*************** +*** 380,385 **** + register int i; + /* Just zero the data arrays */ +! bzero((char *)eesunits, sizeof eesunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + acceptable_slop.l_ui = 0; +--- 380,385 ---- + register int i; + /* Just zero the data arrays */ +! memset((char *)eesunits, 0, sizeof eesunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + acceptable_slop.l_ui = 0; +*************** +*** 507,511 **** + else ees = (struct eesunit *) emalloc(sizeof(struct eesunit)); + } +! bzero((char *)ees, sizeof(struct eesunit)); + eesunits[unit] = ees; + +--- 507,511 ---- + else ees = (struct eesunit *) emalloc(sizeof(struct eesunit)); + } +! memset((char *)ees, 0, sizeof(struct eesunit)); + eesunits[unit] = ees; + +*************** +*** 548,553 **** + if (!io_addclock(&ees->io)) { + /* Oh shit. Just close and return. */ +! syslog(LOG_ERR, "ees clock: io_addclock(%s): %m", +! eesdev); + goto screwed; + } +--- 548,552 ---- + if (!io_addclock(&ees->io)) { + /* Oh shit. Just close and return. */ +! syslog(LOG_ERR, "ees clock: io_addclock(%s): %m", eesdev); + goto screwed; + } +*************** +*** 560,575 **** + peer->rootdelay = 0; /* ++++ */ + peer->rootdispersion = 0; /* ++++ */ +! if (stratumtouse[unit] <= 1) +! { bcopy(EESREFID, (char *)&peer->refid, 4); +! if (unit>0 && unit<10) ((char *)&peer->refid)[3] = '0' + unit; + } +- else peer->refid = htonl(EESHSREFID); + unitinuse[unit] = 1; + syslog(LOG_ERR, "ees clock: %s OK on %d", eesdev, unit); +! return 1; + + screwed: +! if (fd232 != -1) (void) close(fd232); +! return 0; + } + +--- 559,577 ---- + peer->rootdelay = 0; /* ++++ */ + peer->rootdispersion = 0; /* ++++ */ +! if (stratumtouse[unit] <= 1) { +! memmove((char *)&peer->refid, EESREFID, 4); +! if (unit > 0 && unit < 10) +! ((char *)&peer->refid)[3] = '0' + unit; +! } else { +! peer->refid = htonl(EESHSREFID); + } + unitinuse[unit] = 1; + syslog(LOG_ERR, "ees clock: %s OK on %d", eesdev, unit); +! return (1); + + screwed: +! if (fd232 != -1) +! (void) close(fd232); +! return (0); + } + +*************** +*** 860,864 **** + sincelast = this_uisec - ees->last_step; + +! bzero(&ppsclockev, sizeof ppsclockev); + + rc = ioctl(ees->io.fd, CIOGETEV, (char *) &ppsclockev); +--- 862,866 ---- + sincelast = this_uisec - ees->last_step; + +! memset(&ppsclockev, 0, sizeof ppsclockev); + + rc = ioctl(ees->io.fd, CIOGETEV, (char *) &ppsclockev); +*************** +*** 1444,1449 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) { +! bcopy(EESREFID, (char *)&peer->refid, +! 4); + if (unit>0 && unit<10) + ((char *)&peer->refid)[3] = +--- 1446,1451 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) { +! memmove((char *)&peer->refid, +! EESREFID, 4); + if (unit>0 && unit<10) + ((char *)&peer->refid)[3] = +*** /tmp/RCSA023576 Wed Jan 26 17:56:55 1994 +--- xntpd/refclock_mx4200.c Wed Jan 26 16:33:41 1994 +*************** +*** 263,268 **** + * Just zero the data arrays + */ +! bzero((char *)mx4200units, sizeof mx4200units); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 263,268 ---- + * Just zero the data arrays + */ +! memset((char *)mx4200units, 0, sizeof mx4200units); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 487,491 **** + } + +! bzero((char *)mx4200, sizeof(struct mx4200unit)); + mx4200units[unit] = mx4200; + +--- 487,491 ---- + } + +! memset((char *)mx4200, 0, sizeof(struct mx4200unit)); + mx4200units[unit] = mx4200; + +*************** +*** 513,517 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(MX4200REFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(MX4200HSREFID); +--- 513,517 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, MX4200REFID, 4); + else + peer->refid = htonl(MX4200HSREFID); +*************** +*** 702,706 **** + return; + mx4200->lencode = n; +! bcopy(dpt, mx4200->lastcode, n); + + /* +--- 702,706 ---- + return; + mx4200->lencode = n; +! memmove(mx4200->lastcode, dpt, n); + + /* +*************** +*** 1052,1057 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(MX4200REFID, (char *)&peer->refid, +! 4); + else + peer->refid = htonl(MX4200HSREFID); +--- 1052,1057 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! MX4200REFID, 4); + else + peer->refid = htonl(MX4200HSREFID); +*************** +*** 1116,1120 **** + mx4200 = mx4200units[unit]; + +! bzero((char *)bug, sizeof(*bug)); + bug->nvalues = 10; + bug->ntimes = 2; +--- 1116,1120 ---- + mx4200 = mx4200units[unit]; + +! memset((char *)bug, 0, sizeof(*bug)); + bug->nvalues = 10; + bug->ntimes = 2; +*************** +*** 1212,1216 **** + + cp = buf; +! bzero((char *)jt, sizeof(*jt)); + + if ((cp = strchr(cp, ',')) == NULL) +--- 1212,1216 ---- + + cp = buf; +! memset((char *)jt, 0, sizeof(*jt)); + + if ((cp = strchr(cp, ',')) == NULL) +*** /tmp/RCSA023576 Wed Jan 26 17:56:55 1994 +--- xntpd/refclock_omega.c Wed Jan 26 16:33:42 1994 +*************** +*** 227,232 **** + * Just zero the data arrays + */ +! bzero((char *)omegaunits, sizeof omegaunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 227,232 ---- + * Just zero the data arrays + */ +! memset((char *)omegaunits, 0, sizeof omegaunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 417,421 **** + } + } +! bzero((char *)omega, sizeof(struct omegaunit)); + omegaunits[unit] = omega; + +--- 417,421 ---- + } + } +! memset((char *)omega, 0, sizeof(struct omegaunit)); + omegaunits[unit] = omega; + +*************** +*** 445,449 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(OMEGAREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(OMEGAHSREFID); +--- 445,449 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, OMEGAREFID, 4); + else + peer->refid = htonl(OMEGAHSREFID); +*************** +*** 928,933 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(OMEGAREFID, (char *)&peer->refid, +! 4); + else + peer->refid = htonl(OMEGAHSREFID); +--- 928,933 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! OMEGAREFID, 4); + else + peer->refid = htonl(OMEGAHSREFID); +*** /tmp/RCSA023576 Wed Jan 26 17:56:56 1994 +--- xntpd/refclock_parse.c Wed Jan 26 16:33:42 1994 +*************** +*** 1068,1072 **** + return; + } +! bcopy((caddr_t)&rbufp->recv_space, (caddr_t)&parsetime, sizeof(parsetime_t)); + + /* +--- 1068,1074 ---- + return; + } +! memmove((caddr_t)&parsetime, +! (caddr_t)&rbufp->recv_space, +! sizeof(parsetime_t)); + + /* +*************** +*** 2009,2013 **** + parse_init() + { +! bzero((caddr_t)parseunits, sizeof parseunits); + } + +--- 2011,2015 ---- + parse_init() + { +! memset((caddr_t)parseunits, 0, sizeof parseunits); + } + +*************** +*** 2169,2173 **** + } + +! bzero((char *)parse, sizeof(struct parseunit)); + parseunits[unit] = parse; + +--- 2171,2175 ---- + } + +! memset((char *)parse, 0, sizeof(struct parseunit)); + parseunits[unit] = parse; + +*************** +*** 2204,2208 **** + peer->stratum = STRATUM_REFCLOCK; + if (peer->stratum <= 1) +! bcopy(parse->parse_type->cl_id, (char *)&peer->refid, 4); + else + peer->refid = htonl(PARSEHSREFID); +--- 2206,2210 ---- + peer->stratum = STRATUM_REFCLOCK; + if (peer->stratum <= 1) +! memmove((char *)&peer->refid, parse->parse_type->cl_id, 4); + else + peer->refid = htonl(PARSEHSREFID); +*************** +*** 2233,2237 **** + { + #ifndef _PC_VDISABLE +! bzero((char *)tm.c_cc, sizeof(tm.c_cc)); + #else + int disablec; +--- 2235,2239 ---- + { + #ifndef _PC_VDISABLE +! memset((char *)tm.c_cc, 0, sizeof(tm.c_cc)); + #else + int disablec; +*************** +*** 2587,2591 **** + parse->peer->stratum = (u_char)(in->fudgeval1 & 0xf); + if (parse->peer->stratum <= 1) +! bcopy(parse->parse_type->cl_id, (char *)&parse->peer->refid, 4); + else + parse->peer->refid = htonl(PARSEHSREFID); +--- 2589,2595 ---- + parse->peer->stratum = (u_char)(in->fudgeval1 & 0xf); + if (parse->peer->stratum <= 1) +! memmove((char *)&parse->peer->refid, +! parse->parse_type->cl_id, +! 4); + else + parse->peer->refid = htonl(PARSEHSREFID); +*************** +*** 3280,3284 **** + { + parse->localdata = (void *)malloc(sizeof(poll_timer_t)); +! bzero((char *)parse->localdata, sizeof(poll_timer_t)); + + pt = (poll_timer_t *)parse->localdata; +--- 3284,3288 ---- + { + parse->localdata = (void *)malloc(sizeof(poll_timer_t)); +! memset((char *)parse->localdata, 0, sizeof(poll_timer_t)); + + pt = (poll_timer_t *)parse->localdata; +*** /tmp/RCSA023576 Wed Jan 26 17:56:56 1994 +--- xntpd/refclock_pst.c Wed Jan 26 16:33:42 1994 +*************** +*** 438,443 **** + * Just zero the data arrays + */ +! bzero((char *)pstunits, sizeof pstunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 438,443 ---- + * Just zero the data arrays + */ +! memset((char *)pstunits, 0, sizeof pstunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 630,634 **** + } + } +! bzero((char *)pst, sizeof(struct pstunit)); + pstunits[unit] = pst; + +--- 630,634 ---- + } + } +! memset((char *)pst, 0, sizeof(struct pstunit)); + pstunits[unit] = pst; + +*************** +*** 663,667 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(WWVREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(PSTHSREFID); +--- 663,667 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, WWVREFID, 4); + else + peer->refid = htonl(PSTHSREFID); +*************** +*** 1461,1467 **** + if (stratumtouse[pst->unit] <= 1) { + if (pst->station >= 0) +! bcopy(WWVREFID, (char *)&pst->peer->refid, 4); + else +! bcopy(WWVHREFID, (char *)&pst->peer->refid, 4); + } + +--- 1461,1467 ---- + if (stratumtouse[pst->unit] <= 1) { + if (pst->station >= 0) +! memmove((char *)&pst->peer->refid, WWVREFID, 4); + else +! memmove((char *)&pst->peer->refid, WWVHREFID, 4); + } + +*** /tmp/RCSA023576 Wed Jan 26 17:56:57 1994 +--- xntpd/refclock_tpro.c Wed Jan 26 16:33:43 1994 +*************** +*** 131,136 **** + * Just zero the data arrays + */ +! bzero((char *)tprounits, sizeof tprounits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 131,136 ---- + * Just zero the data arrays + */ +! memset((char *)tprounits, 0, sizeof tprounits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 201,205 **** + } + } +! bzero((char *)tpro, sizeof(struct tprounit)); + tprounits[unit] = tpro; + +--- 201,205 ---- + } + } +! memset((char *)tpro, 0, sizeof(struct tprounit)); + tprounits[unit] = tpro; + +*************** +*** 226,230 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(TPROREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(TPROHSREFID); +--- 226,230 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, TPROREFID, 4); + else + peer->refid = htonl(TPROHSREFID); +*************** +*** 416,421 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(TPROREFID, (char *)&peer->refid, +! 4); + else + peer->refid = htonl(TPROHSREFID); +--- 416,421 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! TPROREFID, 4); + else + peer->refid = htonl(TPROHSREFID); +*** /tmp/RCSA023576 Wed Jan 26 17:56:57 1994 +--- xntpd/refclock_wwvb.c Wed Jan 26 16:33:43 1994 +*************** +*** 220,225 **** + * Just zero the data arrays + */ +! bzero((char *)wwvbunits, sizeof wwvbunits); +! bzero((char *)unitinuse, sizeof unitinuse); + + /* +--- 220,225 ---- + * Just zero the data arrays + */ +! memset((char *)wwvbunits, 0, sizeof wwvbunits); +! memset((char *)unitinuse, 0, sizeof unitinuse); + + /* +*************** +*** 408,412 **** + } + } +! bzero((char *)wwvb, sizeof(struct wwvbunit)); + wwvbunits[unit] = wwvb; + +--- 408,412 ---- + } + } +! memset((char *)wwvb, 0, sizeof(struct wwvbunit)); + wwvbunits[unit] = wwvb; + +*************** +*** 436,440 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(WWVBREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(WWVBHSREFID); +--- 436,440 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, WWVBREFID, 4); + else + peer->refid = htonl(WWVBHSREFID); +*************** +*** 957,962 **** + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! bcopy(WWVBREFID, (char *)&peer->refid, +! 4); + else + peer->refid = htonl(WWVBHSREFID); +--- 957,962 ---- + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) +! memmove((char *)&peer->refid, +! WWVBREFID, 4); + else + peer->refid = htonl(WWVBHSREFID); +*** /tmp/RCSA023592 Wed Jan 26 17:56:58 1994 +--- xntpdc/ntpdc.c Wed Jan 26 16:33:43 1994 +*************** +*** 222,227 **** + int c; + int errflg = 0; +! extern int optind; +! extern char *optarg; + + delay_time.l_ui = 0; +--- 222,227 ---- + int c; + int errflg = 0; +! extern int ntp_optind; +! extern char *ntp_optarg; + + delay_time.l_ui = 0; +*************** +*** 229,236 **** + + progname = argv[0]; +! while ((c = getopt_l(argc, argv, "c:dilnps")) != EOF) + switch (c) { + case 'c': +! ADDCMD(optarg); + break; + case 'd': +--- 229,236 ---- + + progname = argv[0]; +! while ((c = ntp_getopt(argc, argv, "c:dilnps")) != EOF) + switch (c) { + case 'c': +! ADDCMD(ntp_optarg); + break; + case 'd': +*************** +*** 262,270 **** + exit(2); + } +! if (optind == argc) { + ADDHOST(DEFHOST); + } else { +! for (; optind < argc; optind++) +! ADDHOST(argv[optind]); + } + +--- 262,270 ---- + exit(2); + } +! if (ntp_optind == argc) { + ADDHOST(DEFHOST); + } else { +! for (; ntp_optind < argc; ntp_optind++) +! ADDHOST(argv[ntp_optind]); + } + +*************** +*** 440,444 **** + *rdata = datap = pktdata; + lastseq = 999; /* too big to be a sequence number */ +! bzero(haveseq, sizeof(haveseq)); + FD_ZERO(&fds); + +--- 440,444 ---- + *rdata = datap = pktdata; + lastseq = 999; /* too big to be a sequence number */ +! memset(haveseq, 0, sizeof(haveseq)); + FD_ZERO(&fds); + +*************** +*** 601,605 **** + if ((datap + datasize) > (pktdata + pktdatasize)) + growpktdata(); +! bcopy((char *)rpkt.data, datap, datasize); + datap += datasize; + if (firstpkt) { +--- 601,605 ---- + if ((datap + datasize) > (pktdata + pktdatasize)) + growpktdata(); +! memmove(datap, (char *)rpkt.data, datasize); + datap += datasize; + if (firstpkt) { +*************** +*** 635,639 **** + int datasize; + +! bzero((char *)&qpkt, sizeof qpkt); + + qpkt.rm_vn_mode = RM_VN_MODE(0, 0); +--- 635,639 ---- + int datasize; + +! memset((char *)&qpkt, 0, sizeof qpkt); + + qpkt.rm_vn_mode = RM_VN_MODE(0, 0); +*************** +*** 643,647 **** + datasize = qitems * qsize; + if (datasize != 0 && qdata != NULL) { +! bcopy(qdata, (char *)qpkt.data, datasize); + qpkt.err_nitems = ERR_NITEMS(0, qitems); + qpkt.mbz_itemsize = MBZ_ITEMSIZE(qsize); +--- 643,647 ---- + datasize = qitems * qsize; + if (datasize != 0 && qdata != NULL) { +! memmove((char *)qpkt.data, qdata, datasize); + qpkt.err_nitems = ERR_NITEMS(0, qitems); + qpkt.mbz_itemsize = MBZ_ITEMSIZE(qsize); +*************** +*** 1092,1096 **** + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! bcopy(hp->h_addr, (char *)num, sizeof(U_LONG)); + if (fullhost != 0) + (void) strcpy(fullhost, hp->h_name); +--- 1092,1096 ---- + return 1; + } else if ((hp = gethostbyname(host)) != 0) { +! memmove((char *)num, hp->h_addr, sizeof(U_LONG)); + if (fullhost != 0) + (void) strcpy(fullhost, hp->h_name); +*** /tmp/RCSA023592 Wed Jan 26 17:56:58 1994 +--- xntpdc/ntpdc_ops.c Wed Jan 26 16:33:44 1994 +*************** +*** 443,447 **** + if (pp->stratum <= 1) { + junk[4] = 0; +! bcopy((char *)&pp->refid, junk, 4); + str = junk; + } else { +--- 443,447 ---- + if (pp->stratum <= 1) { + junk[4] = 0; +! memmove(junk, (char *)&pp->refid, 4); + str = junk; + } else { +*************** +*** 789,793 **** + if (is->stratum <= 1) { + junk[4] = 0; +! bcopy((char *)&is->refid, junk, 4); + str = junk; + } else { +--- 789,793 ---- + if (is->stratum <= 1) { + junk[4] = 0; +! memmove(junk, (char *)&is->refid, 4); + str = junk; + } else { +*************** +*** 2193,2197 **** + + err = 0; +! bzero((char *)&fudgedata, sizeof fudgedata); + fudgedata.clockadr = pcmd->argval[0].netnum; + +--- 2193,2197 ---- + + err = 0; +! memset((char *)&fudgedata, 0, sizeof fudgedata); + fudgedata.clockadr = pcmd->argval[0].netnum; + +*** /tmp/RCSA023598 Wed Jan 26 17:56:59 1994 +--- xntpres/xntpres.c Wed Jan 26 16:33:44 1994 +*************** +*** 149,153 **** + char *cp; + FILE *in; +! extern int optind; + + progname = argv[0]; +--- 149,153 ---- + char *cp; + FILE *in; +! extern int ntp_optind; + + progname = argv[0]; +*************** +*** 181,185 **** + syslog(LOG_NOTICE, Version); + +! while ((c = getopt_l(argc, argv, "dr")) != EOF) + switch (c) { + case 'd': +--- 181,185 ---- + syslog(LOG_NOTICE, Version); + +! while ((c = ntp_getopt(argc, argv, "dr")) != EOF) + switch (c) { + case 'd': +*************** +*** 193,197 **** + break; + } +! if (errflg || (optind + 3) != argc) { + (void) fprintf(stderr, + "usage: %s [-d] [-r] keyid keyfile conffile\n", progname); +--- 193,197 ---- + break; + } +! if (errflg || (ntp_optind + 3) != argc) { + (void) fprintf(stderr, + "usage: %s [-d] [-r] keyid keyfile conffile\n", progname); +*************** +*** 200,210 **** + } + +! if (!atouint(argv[optind], &req_keyid)) { +! syslog(LOG_ERR, "undecodeable keyid %s", argv[optind]); + exit(1); + } + +! keyfile = argv[optind+1]; +! conffile = argv[optind+2]; + + /* +--- 200,210 ---- + } + +! if (!atouint(argv[ntp_optind], &req_keyid)) { +! syslog(LOG_ERR, "undecodeable keyid %s", argv[ntp_optind]); + exit(1); + } + +! keyfile = argv[ntp_optind+1]; +! conffile = argv[ntp_optind+2]; + + /* +*************** +*** 354,358 **** + len = strlen(name) + 1; + cp = emalloc((unsigned)len); +! bcopy(name, cp, len); + + ce = (struct conf_entry *)emalloc(sizeof(struct conf_entry)); +--- 354,358 ---- + len = strlen(name) + 1; + cp = emalloc((unsigned)len); +! memmove(cp, name, len); + + ce = (struct conf_entry *)emalloc(sizeof(struct conf_entry)); +*************** +*** 409,413 **** + return 1; + #endif +! return 0; + } + +--- 409,413 ---- + return 1; + #endif +! return (0); + } + +*************** +*** 417,423 **** + * only return one. + */ +! (void) bcopy(hp->h_addr, (char *)&(entry->ce_peeraddr), +! sizeof(struct in_addr)); +! return 1; + } + +--- 417,424 ---- + * only return one. + */ +! memmove((char *)&(entry->ce_peeraddr), +! hp->h_addr, +! sizeof(struct in_addr)); +! return (1); + } + +*************** +*** 440,444 **** + } + +! bzero((char *)&saddr, sizeof(saddr)); + saddr.sin_family = AF_INET; + saddr.sin_port = htons(NTP_PORT); /* trash */ +--- 441,445 ---- + } + +! memset((char *)&saddr, 0, sizeof(saddr)); + saddr.sin_family = AF_INET; + saddr.sin_port = htons(NTP_PORT); /* trash */ +*************** +*** 500,504 **** + * Make up a request packet with the configuration info + */ +! bzero((char *)&reqpkt, sizeof(reqpkt)); + + reqpkt.rm_vn_mode = RM_VN_MODE(0, 0); +--- 501,505 ---- + * Make up a request packet with the configuration info + */ +! memset((char *)&reqpkt, 0, sizeof(reqpkt)); + + reqpkt.rm_vn_mode = RM_VN_MODE(0, 0); +*************** +*** 508,512 **** + reqpkt.err_nitems = ERR_NITEMS(0, 1); /* one item */ + reqpkt.mbz_itemsize = MBZ_ITEMSIZE(sizeof(struct conf_peer)); +! bcopy((char *)conf, reqpkt.data, sizeof(struct conf_peer)); + reqpkt.keyid = htonl(req_keyid); + +--- 509,513 ---- + reqpkt.err_nitems = ERR_NITEMS(0, 1); /* one item */ + reqpkt.mbz_itemsize = MBZ_ITEMSIZE(sizeof(struct conf_peer)); +! memmove(reqpkt.data, (char *)conf, sizeof(struct conf_peer)); + reqpkt.keyid = htonl(req_keyid); + + diff --git a/usr.sbin/xntpd/patches/patch.40 b/usr.sbin/xntpd/patches/patch.40 new file mode 100644 index 000000000000..7f1941d3a760 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.40 @@ -0,0 +1,92 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa23994; 13 Apr 94 15:58 EDT +Received: from adrastea.lcs.mit.edu by louie.udel.edu id aa07113; + 13 Apr 94 15:44 EDT +Received: by adrastea.lcs.mit.edu; id AA04845; Wed, 13 Apr 1994 15:44:23 -0400 +Date: Wed, 13 Apr 1994 15:44:23 -0400 +From: Garrett Wollman +Message-Id: <9404131944.AA04845@adrastea.lcs.mit.edu> +To: Mills@udel.edu +Cc: Garrett Wollman , + Frank Kardel +Subject: Re: You xntp modifications... +In-Reply-To: <9404122159.aa18355@huey.udel.edu> +References: <9404122159.aa18355@huey.udel.edu> + +< Note that we are two versions further along, what with the average of +> a patch per day, so it would be survivable if this issue could be +> cleared up ASAP. + +This patch, applied relative to my previous patch, provides for both +behaviors. + + +*** xntpd/xntpd/ntp_control.c Wed Apr 13 12:37:51 1994 +--- ntp_control.c Wed Apr 13 12:38:42 1994 +*************** +*** 264,271 **** +--- 264,283 ---- + /* + * System and processor definitions. These will change for the gizmo board. + */ ++ #ifndef HAVE_UNAME ++ #ifndef STR_SYSTEM ++ #define STR_SYSTEM "UNIX" ++ #endif ++ #ifndef STR_PROCESSOR ++ #define STR_PROCESSOR "unknown" ++ #endif ++ ++ static char str_system[] = STR_SYSTEM; ++ static char str_processor[] = STR_PROCESSOR; ++ #else + #include + static struct utsname utsname; ++ #endif /* HAVE_UNAME */ + + /* + * Trap structures. We only allow a few of these, and send +*************** +*** 426,433 **** +--- 438,447 ---- + { + int i; + ++ #ifdef HAVE_UNAME + uname(&utsname); + ++ #endif /* HAVE_UNAME */ + ctl_clr_stats(); + + ctl_auth_keyid = 0; +*************** +*** 1262,1273 **** +--- 1276,1297 ---- + ctl_putuint(sys_var[CS_LEAPWARNING].text, (U_LONG)leap_warning); + break; + case CS_PROCESSOR: ++ #ifndef HAVE_UNAME ++ ctl_putstr(sys_var[CS_PROCESSOR].text, str_processor, ++ sizeof(str_processor) - 1); ++ #else + ctl_putstr(sys_var[CS_PROCESSOR].text, utsname.machine, + strlen(utsname.machine)); ++ #endif /* HAVE_UNAME */ + break; + case CS_SYSTEM: ++ #ifndef HAVE_UNAME ++ ctl_putstr(sys_var[CS_SYSTEM].text, str_system, ++ sizeof(str_system) - 1); ++ #else + ctl_putstr(sys_var[CS_SYSTEM].text, utsname.sysname, + strlen(utsname.sysname)); ++ #endif /* HAVE_UNAME */ + break; + case CS_KEYID: + ctl_putuint(sys_var[CS_KEYID].text, (U_LONG)0); + + +[no save] + diff --git a/usr.sbin/xntpd/patches/patch.41 b/usr.sbin/xntpd/patches/patch.41 new file mode 100644 index 000000000000..5d1f91c821f1 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.41 @@ -0,0 +1,50 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa13197; 16 Apr 94 22:05 EDT +Received: from motgate.mot.com by louie.udel.edu id aa18176; 16 Apr 94 21:57 EDT +Received: from pobox.mot.com ([129.188.137.100]) by motgate.mot.com with SMTP (5.67b/IDA-1.4.4/MOT-3.1 for ) + id AA01015; Sat, 16 Apr 1994 20:57:21 -0500 +Received: from merlin.dev.cdx.mot.com by pobox.mot.com with SMTP (5.67b/IDA-1.4.4/MOT-3.1 for ) + id AA29067; Sat, 16 Apr 1994 20:57:19 -0500 +Received: from ronald.dev.cdx.mot.com (ronald.dev.cdx.mot.com [134.33.39.18]) by merlin.dev.cdx.mot.com (8.6.5/8.6.5) with ESMTP id VAA06544; Sat, 16 Apr 1994 21:57:12 -0400 +From: "Gregory M. Paris" +Received: from localhost (paris@localhost) by ronald.dev.cdx.mot.com (8.6.5/8.6.5) id VAA22231; Sat, 16 Apr 1994 21:57:11 -0400 +Date: Sat, 16 Apr 1994 21:57:11 -0400 +Message-Id: <199404170157.VAA22231@ronald.dev.cdx.mot.com> +To: mills@udel.edu +Subject: 3.3y patch + +Dave, + +I had the same problem compiling 3.3p as I got with 3.3y. The fix +was to move a #endif that seems to be out of place in xntpd/ntp_unixclock.c. +It now compiles fine on my HP-UX 9.03. Here's the patch. + +Greg + +-- +Greg Paris +Motorola Inc, Information Systems Group, 20 Cabot Blvd, Mansfield, MA 02048-1193 +"Your Plastic Pal who's fun to be with." TM Sirius Cybernetics +These posts are self-disclamatory. + +################################################## +*** xntpd/ntp_unixclock.c.orig Mon Apr 11 22:19:21 1994 +--- xntpd/ntp_unixclock.c Sat Apr 16 21:49:15 1994 +*************** +*** 386,391 **** +--- 386,392 ---- + #undef K_TICK_NAME + #undef N_NAME + } ++ #endif /* SYS_UNIXWARE1 */ + #endif /* HAVE_READKMEM */ + + #if defined(SOLARIS)&&defined(ADJTIME_IS_ACCURATE) +*************** +*** 583,586 **** + *tick = (U_LONG)txc.tick; + } + #endif /* SYS_LINUX */ +- #endif /* SYS_UNIXWARE1 */ +--- 584,586 ---- + diff --git a/usr.sbin/xntpd/patches/patch.42 b/usr.sbin/xntpd/patches/patch.42 new file mode 100644 index 000000000000..78c9bdfdda26 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.42 @@ -0,0 +1,38 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa00358; 19 Apr 94 17:48 EDT +Received: from swan.cl.cam.ac.uk by louie.udel.edu id aa12986; + 19 Apr 94 17:40 EDT +Received: from labes.cl.cam.ac.uk (user pb (rfc931)) by swan.cl.cam.ac.uk + with SMTP (PP-6.5) to cl; Tue, 19 Apr 1994 22:39:48 +0100 +To: Mills@udel.edu +cc: Piete Brooks +Subject: Re: Multicast NTP - take 1 +In-reply-to: Your message of Tue, 19 Apr 1994 12:29:25 -0400. <9404191229.aa28742@huey.udel.edu> +Date: Tue, 19 Apr 1994 22:39:44 +0100 +From: Piete Brooks +Message-ID: <"swan.cl.cam.:138990:940419214000"@cl.cam.ac.uk> + +Shucks ! + +I omitted the "-c" to diff ... + +*** xntpd/refclock_msfees.c.dist Thu Jan 27 14:03:59 1994 +--- xntpd/refclock_msfees.c Tue Apr 19 10:58:57 1994 +*************** +*** 139,145 **** + #define INH_DELAY_PPS BITS_TO_L_FP( 0, 9600) + + #ifndef STREAM_PP1 +! #define STREAM_PP1 "ppsclockd\0<-- patch space for module name1 -->" + #endif + #ifndef STREAM_PP2 + #define STREAM_PP2 "ppsclock\0<-- patch space for module name2 -->" +--- 139,145 ---- + #define INH_DELAY_PPS BITS_TO_L_FP( 0, 9600) + + #ifndef STREAM_PP1 +! #define STREAM_PP1 "ppsclocd\0<-- patch space for module name1 -->" + #endif + #ifndef STREAM_PP2 + #define STREAM_PP2 "ppsclock\0<-- patch space for module name2 -->" + diff --git a/usr.sbin/xntpd/patches/patch.43 b/usr.sbin/xntpd/patches/patch.43 new file mode 100644 index 000000000000..92f9200c735e --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.43 @@ -0,0 +1,48 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa00412; 19 Apr 94 18:04 EDT +Received: from swan.cl.cam.ac.uk by louie.udel.edu id aa13181; + 19 Apr 94 17:44 EDT +Received: from labes.cl.cam.ac.uk (user pb (rfc931)) by swan.cl.cam.ac.uk + with SMTP (PP-6.5) to cl; Tue, 19 Apr 1994 22:44:05 +0100 +To: Mills@udel.edu +cc: Piete Brooks +Subject: Re: Cisco/Multicast/ntp3.3m +In-reply-to: Your message of Tue, 19 Apr 1994 12:24:31 -0400. <9404191224.aa28707@huey.udel.edu> +Date: Tue, 19 Apr 1994 22:43:58 +0100 +From: Piete Brooks +Message-ID: <"swan.cl.cam.:140740:940419214417"@cl.cam.ac.uk> + +> Yes, I think you have caught all the gotchas. + +I fear not :-(( + +> I take it you have the latest kernel mods. + +Look for a call sign I assume .... +Do I take it that they are **REQUIRED** ? :-((( + + +Other problems ..... + +It appears that you have your own in.h in include/ntp_in.h + +I suspect that that is why things are failing ... +Why not use the syatem's own in.h ?? + +To make it compile I added: + +*** include/ntp_in.h.dist Thu Apr 14 16:20:29 1994 +--- include/ntp_in.h Tue Apr 19 21:40:12 1994 +*************** +*** 19,24 **** +--- 19,27 ---- + + #ifndef _netinet_in_h + #define _netinet_in_h ++ #define _NETINET_IN_H_ ++ #define _SYS_IN_INCLUDED ++ #define __IN_HEADER + + /* + * Protocols + diff --git a/usr.sbin/xntpd/patches/patch.5 b/usr.sbin/xntpd/patches/patch.5 new file mode 100644 index 000000000000..2225804037c7 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.5 @@ -0,0 +1,49 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa14816; 27 Jan 94 5:15 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa11733; + 27 Jan 94 5:09 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA25056 (5.65c-6/7.3v-FAU); Thu, 27 Jan 1994 11:09:06 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA09091 (5.65c-6/7.3m-FAU); Thu, 27 Jan 1994 11:09:03 +0100 +From: Frank Kardel +Message-Id: <199401271009.AA09091@faui43.informatik.uni-erlangen.de> +Subject: Re: Solaribum +To: Mills@udel.edu +Date: Thu, 27 Jan 94 11:08:55 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, Piete.Brooks@cl.cam.ac.uk, + Paul_Vixie@corpmis.sjc.hw.sony.com +In-Reply-To: <9401261207.aa10860@huey.udel.edu>; from "Mills@udel.edu" at Jan 26, 94 12:07 pm +X-Mailer: ELM [version 2.3 PL11] + + +And another corer generator to be removed: + +=================================================================== +RCS file: /src/NTP/REPOSITORY/v3/xntpd/ntp_control.c,v +retrieving revision 3.22 +diff -c -r3.22 xntpd/ntp_control.c +*** xntpd/ntp_control.c:3.22 1994/01/26 21:56:23 +--- xntpd/ntp_control.c 1994/01/27 10:03:01 +*************** +*** 2132,2138 **** + for (i = 1; i <= CC_MAXCODE; i++) + if (wants[i]) + ctl_putclock(i, &clock, 1); +! for (i = 0; !(clock.kv_list[i].flags & EOV); i++) + if (wants[i+CC_MAXCODE+1]) + ctl_putdata(clock.kv_list[i].text, + strlen(clock.kv_list[i].text), 0); +--- 2132,2138 ---- + for (i = 1; i <= CC_MAXCODE; i++) + if (wants[i]) + ctl_putclock(i, &clock, 1); +! for (i = 0; clock.kv_list && !(clock.kv_list[i].flags & EOV); i++) + if (wants[i+CC_MAXCODE+1]) + ctl_putdata(clock.kv_list[i].text, + strlen(clock.kv_list[i].text), 0); +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.6 b/usr.sbin/xntpd/patches/patch.6 new file mode 100644 index 000000000000..220acad2ed19 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.6 @@ -0,0 +1,550 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa17107; 27 Jan 94 14:37 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa16998; + 27 Jan 94 14:34 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA29914 (5.65c-6/7.3v-FAU); Thu, 27 Jan 1994 20:34:08 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA23509 (5.65c-6/7.3m-FAU); Thu, 27 Jan 1994 20:34:05 +0100 +From: Frank Kardel +Message-Id: <199401271934.AA23509@faui43.informatik.uni-erlangen.de> +Subject: Re: Solaribum +To: Mills@udel.edu +Date: Thu, 27 Jan 94 20:33:59 MET +Cc: Frank.Kardel@informatik.uni-erlangen.de, Piete.Brooks@cl.cam.ac.uk, + Paul_Vixie@corpmis.sjc.hw.sony.com +In-Reply-To: <9401271111.aa16183@huey.udel.edu>; from "Mills@udel.edu" at Jan 27, 94 11:11 am +X-Mailer: ELM [version 2.3 PL11] + + +> Guys, + +> Two masive patches collided in midair here, leaving broken parts scattered +> over three counties. The National Time Safety Board has investigated, +> but been unable, ... + +Additional efforts of the european branch of the NTPSB have uncovered +that the collision was due to low visibility across the atlantic. + +And I wanted to go on: + All measures have been taken to limit the effects of the crash to a + minimum and to resume normal aircraft operation as soon as possible. + + All crew members and passengers are required to apply following patch + to xntp3.3y.tar.Z for increased comfort and safety. This patch should + enable us to resume normal operation again. + + After applying the patches you may remove following debris: + + include/ntp_machine.h.rej + xntpd/ntp_config.c.rej + xntpd/ntp_control.c.rej + +Unfortunately I did a test compile and the results of that will +extend the ground stay of the 3.3y aircraft considerably. +(You may start thinking about bringing up 3.3xx - see below) + +SunOS 4.x.x does NOT have the new highly portable "memmove()" +routine. The lack of this will mean that we will have to +#define memmove(a, b, c) memcpy(a, b, c) +or find something else. I'd like to leave this to Paul. +Also on Sunos 4.x there are implicit declarations of bzero due +the the FDSET macro from the system header files. So I am not +so sure whether strictly using mem* is the best or whether we should +add b* prototypes to l_stdlib.h. I think Paul has now something +to work on. Anyhow, the patches below will rectify some problems +but the resulting code still needs much polishing (providing memmove +where it is missing e.g. SunOS4.x). + +In order to get a flying version fast (3.3xx) Dave could apply my +patch he is holding to 3.3x - that should then make a workable +version. 3.3y can then be cleaned up slowly (starting with the +patches below and then port it again to the rest of the systems). + +Sorry about the bad news. + +> I have one more patch from Frank which I will hold on to until the aircraft +> is recertified. + +That one is still to be applied because without it, it is possible +to shoot down any plane around the NTP universe that is bearing +the 3.3x banner (but can be applied to 3.3x). + + +For the 3.3y construction crew: + +diff -c -r ../yy/include/ntp_machine.h ./include/ntp_machine.h +*** ../yy/include/ntp_machine.h Thu Jan 27 15:03:23 1994 +--- ./include/ntp_machine.h Thu Jan 27 19:13:35 1994 +*************** +*** 121,139 **** + to the correct broadcast address - are these + implementations broken or did the spec change ? + +- HAVE_UNISTD_H - Maybe should be part of NTP_POSIX_SOURCE ? +- + DEFINITIONS FOR SYSTEM && PROCESSOR + STR_SYSTEM - value of system variable + STR_PROCESSOR - value of processor variable + + You could just put the defines on the DEFS line in machines/ file. +! I don't since there are lost of different types compiler that a systemm might +! have, some that can do proto typing and others that cannot on the saem system. +! I get a chanse to twiddle some of the configuration paramasters at compile +! time based on compler/machine combinatsions by using this include file. +! See convex, aix and sun configurations see how complex it gets. +! + */ + + +--- 121,141 ---- + to the correct broadcast address - are these + implementations broken or did the spec change ? + + DEFINITIONS FOR SYSTEM && PROCESSOR + STR_SYSTEM - value of system variable + STR_PROCESSOR - value of processor variable + + You could just put the defines on the DEFS line in machines/ file. +! I don't since there are lots of different types of compilers that a system might +! have, some that can do proto typing and others that cannot on the same system. +! I get a chance to twiddle some of the configuration parameters at compile +! time based on compiler/machine combinations by using this include file. +! See convex, aix and sun configurations see how complex it get. +! +! Note that it _is_ considered reasonable to add some system-specific defines +! to the machine/ file if it would be too inconvenient to puzzle them out +! in this file. +! + */ + + +diff -c -r ../yy/parse/parse.c ./parse/parse.c +*** ../yy/parse/parse.c Thu Jan 27 00:25:18 1994 +--- ./parse/parse.c Thu Jan 27 20:18:58 1994 +*************** +*** 29,40 **** + #include "sys/time.h" + #include "sys/errno.h" + +- #include "ntp_fp.h" +- #include "ntp_unixtime.h" +- #include "ntp_calendar.h" +- +- #include "parse.h" +- + #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM) + /* + * Sorry, but in SunOS 4.x kernels there are no +--- 29,34 ---- +*************** +*** 44,51 **** +--- 38,54 ---- + #define _ntp_string_h + extern void bcopy(); + extern void bzero(); ++ #else ++ #define bzero(_X_, _Y_) memset(_X_, 0, _Y_) ++ #define bcopy(_X_, _Y_, _Z_) memmove(_Y_, _X_, _Z_) + #endif + ++ #include "ntp_fp.h" ++ #include "ntp_unixtime.h" ++ #include "ntp_calendar.h" ++ ++ #include "parse.h" ++ + #include "ntp_stdlib.h" + + #ifdef PARSESTREAM +diff -c -r ../yy/xntpd/ntp_config.c ./xntpd/ntp_config.c +*** ../yy/xntpd/ntp_config.c Thu Jan 27 15:03:47 1994 +--- ./xntpd/ntp_config.c Thu Jan 27 19:18:40 1994 +*************** +*** 1,4 **** +! /* ntp_config.c,v 3.1 1993/07/06 01:11:12 jbj Exp + * ntp_config.c - read and apply configuration information + */ + #define RESOLVE_INTERNAL /* gdt */ +--- 1,4 ---- +! /* + * ntp_config.c - read and apply configuration information + */ + #define RESOLVE_INTERNAL /* gdt */ +*************** +*** 375,388 **** + break; + } + +! if (errflg || optind != argc) { + (void) fprintf(stderr, "usage: %s [ -abd ] [ -c config_file ] [ -e encryption delay ]\n", progname); + (void) fprintf(stderr, "\t\t[ -f frequency file ] [ -k key file ] [ -l log file ]\n"); + (void) fprintf(stderr, "\t\t[ -p pid file ] [ -r broadcast delay ] [ -s status directory ]\n"); + (void) fprintf(stderr, "\t\t[ -t trusted key ] [ -v sys variable ] [ -V default sys variable ]\n"); + exit(2); + } +! optind = 0; /* reset optind to restart getopt_l */ + + if (debug) { + #ifdef NTP_POSIX_SOURCE +--- 375,388 ---- + break; + } + +! if (errflg || ntp_optind != argc) { + (void) fprintf(stderr, "usage: %s [ -abd ] [ -c config_file ] [ -e encryption delay ]\n", progname); + (void) fprintf(stderr, "\t\t[ -f frequency file ] [ -k key file ] [ -l log file ]\n"); + (void) fprintf(stderr, "\t\t[ -p pid file ] [ -r broadcast delay ] [ -s status directory ]\n"); + (void) fprintf(stderr, "\t\t[ -t trusted key ] [ -v sys variable ] [ -V default sys variable ]\n"); + exit(2); + } +! ntp_optind = 0; /* reset ntp_optind to restart ntp_getopt */ + + if (debug) { + #ifdef NTP_POSIX_SOURCE +*************** +*** 430,437 **** + char resolver_name[MAXFILENAME]; + int have_keyfile; + char keyfile[MAXFILENAME]; +! extern int optind; +! extern char *optarg; + extern char *Version; + extern U_LONG info_auth_keyid; + FILEGEN *filegen; +--- 430,437 ---- + char resolver_name[MAXFILENAME]; + int have_keyfile; + char keyfile[MAXFILENAME]; +! extern int ntp_optind; +! extern char *ntp_optarg; + extern char *Version; + extern U_LONG info_auth_keyid; + FILEGEN *filegen; +*************** +*** 461,467 **** + /* + * Decode argument list + */ +! while ((c = getopt_l(argc, argv, xntp_options)) != EOF) { + switch (c) { + case 'a': + proto_config(PROTO_AUTHENTICATE, (LONG)1); +--- 461,467 ---- + /* + * Decode argument list + */ +! while ((c = ntp_getopt(argc, argv, xntp_options)) != EOF) { + switch (c) { + case 'a': + proto_config(PROTO_AUTHENTICATE, (LONG)1); +*************** +*** 470,476 **** + proto_config(PROTO_BROADCLIENT, (LONG)1); + break; + case 'c': +! config_file = optarg; + break; + case 'd': + #ifdef DEBUG +--- 470,476 ---- + proto_config(PROTO_BROADCLIENT, (LONG)1); + break; + case 'c': +! config_file = ntp_optarg; + break; + case 'd': + #ifdef DEBUG +*************** +*** 484,498 **** + do { + l_fp tmp; + +! if (!atolfp(optarg, &tmp)) { + syslog(LOG_ERR, + "command line encryption delay value %s undecodable", +! optarg); + errflg++; + } else if (tmp.l_ui != 0) { + syslog(LOG_ERR, + "command line encryption delay value %s is unlikely", +! optarg); + errflg++; + } else { + proto_config(PROTO_AUTHDELAY, tmp.l_f); +--- 484,498 ---- + do { + l_fp tmp; + +! if (!atolfp(ntp_optarg, &tmp)) { + syslog(LOG_ERR, + "command line encryption delay value %s undecodable", +! ntp_optarg); + errflg++; + } else if (tmp.l_ui != 0) { + syslog(LOG_ERR, + "command line encryption delay value %s is unlikely", +! ntp_optarg); + errflg++; + } else { + proto_config(PROTO_AUTHDELAY, tmp.l_f); +*************** +*** 501,537 **** + break; + + case 'f': +! stats_config(STATS_FREQ_FILE, optarg); + break; + + case 'k': +! getauthkeys(optarg); +! if ((int)strlen(optarg) >= MAXFILENAME) { + syslog(LOG_ERR, + "key file name too LONG (>%d, sigh), no name resolution possible", + MAXFILENAME); + } else { + have_keyfile = 1; +! (void)strcpy(keyfile, optarg); + } + break; + + case 'p': +! stats_config(STATS_PID_FILE, optarg); + break; + + case 'r': + do { + l_fp tmp; + +! if (!atolfp(optarg, &tmp)) { + syslog(LOG_ERR, + "command line broadcast delay value %s undecodable", +! optarg); + } else if (tmp.l_ui != 0) { + syslog(LOG_ERR, + "command line broadcast delay value %s is unlikely", +! optarg); + } else { + proto_config(PROTO_BROADDELAY, tmp.l_f); + } +--- 501,537 ---- + break; + + case 'f': +! stats_config(STATS_FREQ_FILE, ntp_optarg); + break; + + case 'k': +! getauthkeys(ntp_optarg); +! if ((int)strlen(ntp_optarg) >= MAXFILENAME) { + syslog(LOG_ERR, + "key file name too LONG (>%d, sigh), no name resolution possible", + MAXFILENAME); + } else { + have_keyfile = 1; +! (void)strcpy(keyfile, ntp_optarg); + } + break; + + case 'p': +! stats_config(STATS_PID_FILE, ntp_optarg); + break; + + case 'r': + do { + l_fp tmp; + +! if (!atolfp(ntp_optarg, &tmp)) { + syslog(LOG_ERR, + "command line broadcast delay value %s undecodable", +! ntp_optarg); + } else if (tmp.l_ui != 0) { + syslog(LOG_ERR, + "command line broadcast delay value %s is unlikely", +! ntp_optarg); + } else { + proto_config(PROTO_BROADDELAY, tmp.l_f); + } +*************** +*** 539,556 **** + break; + + case 's': +! stats_config(STATS_STATSDIR, optarg); + break; + + case 't': + do { + int tkey; + +! tkey = atoi(optarg); + if (tkey <= 0 || tkey > NTP_MAXKEY) { + syslog(LOG_ERR, + "command line trusted key %s is unlikely", +! optarg); + } else { + authtrust(tkey, (LONG)1); + } +--- 539,556 ---- + break; + + case 's': +! stats_config(STATS_STATSDIR, ntp_optarg); + break; + + case 't': + do { + int tkey; + +! tkey = atoi(ntp_optarg); + if (tkey <= 0 || tkey > NTP_MAXKEY) { + syslog(LOG_ERR, + "command line trusted key %s is unlikely", +! ntp_optarg); + } else { + authtrust(tkey, (LONG)1); + } +*************** +*** 559,565 **** + + case 'v': + case 'V': +! set_sys_var(optarg, strlen(optarg)+1, RW | ((c == 'V') ? DEF : 0)); + break; + + default: +--- 559,565 ---- + + case 'v': + case 'V': +! set_sys_var(ntp_optarg, strlen(ntp_optarg)+1, RW | ((c == 'V') ? DEF : 0)); + break; + + default: +diff -c -r ../yy/xntpd/ntp_control.c ./xntpd/ntp_control.c +*** ../yy/xntpd/ntp_control.c Thu Jan 27 15:03:48 1994 +--- ./xntpd/ntp_control.c Thu Jan 27 19:29:06 1994 +*************** +*** 1848,1854 **** + ctl_sys_num_events = 0; + gotvar += count_var(ext_sys_var); + wants = (u_char *)emalloc(gotvar); +! bzero((char *)wants, gotvar); + gotvar = 0; + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +--- 1848,1854 ---- + ctl_sys_num_events = 0; + gotvar += count_var(ext_sys_var); + wants = (u_char *)emalloc(gotvar); +! memset((char *)wants, 0, gotvar); + gotvar = 0; + while ((v = ctl_getitem(sys_var, &valuep)) != 0) { + if (v->flags & EOV) { +*************** +*** 1904,1910 **** + if (res_authokay) + peer->num_events = 0; + wants = (u_char *)emalloc(gotvar); +! bzero((char*)wants, gotvar); + gotvar = 0; + while ((v = ctl_getitem(peer_var, &valuep)) != 0) { + if (v->flags & EOV) { +--- 1904,1910 ---- + if (res_authokay) + peer->num_events = 0; + wants = (u_char *)emalloc(gotvar); +! memset((char*)wants, 0, gotvar); + gotvar = 0; + while ((v = ctl_getitem(peer_var, &valuep)) != 0) { + if (v->flags & EOV) { +*************** +*** 2106,2112 **** + rpkt.status = htons(ctlclkstatus(&clock)); + gotvar = CC_MAXCODE+1+count_var(clock.kv_list); + wants = (u_char *)emalloc(gotvar); +! bzero((char*)wants, gotvar); + gotvar = 0; + while ((v = ctl_getitem(clock_var, &valuep)) != 0) { + if (v->flags & EOV) { +--- 2106,2112 ---- + rpkt.status = htons(ctlclkstatus(&clock)); + gotvar = CC_MAXCODE+1+count_var(clock.kv_list); + wants = (u_char *)emalloc(gotvar); +! memset((char*)wants, 0, gotvar); + gotvar = 0; + while ((v = ctl_getitem(clock_var, &valuep)) != 0) { + if (v->flags & EOV) { +*************** +*** 2578,2584 **** + *kv = (struct ctl_var *)emalloc((c+2)*sizeof(struct ctl_var)); + if (k) + { +! bcopy((char *)k, (char *)*kv, sizeof(struct ctl_var)*c); + free((char *)k); + } + +--- 2578,2584 ---- + *kv = (struct ctl_var *)emalloc((c+2)*sizeof(struct ctl_var)); + if (k) + { +! memmove((char *)*kv, (char *)k, sizeof(struct ctl_var)*c); + free((char *)k); + } + +*************** +*** 2621,2627 **** + { + free(k->text); + k->text = (char *)emalloc(size); +! bcopy(data, k->text, size); + k->flags = def; + return; + } +--- 2621,2627 ---- + { + free(k->text); + k->text = (char *)emalloc(size); +! memmove(k->text, data, size); + k->flags = def; + return; + } +*************** +*** 2629,2635 **** + else + { + k->text = (char *)emalloc(size); +! bcopy(data, k->text, size); + k->flags = def; + return; + } +--- 2629,2635 ---- + else + { + k->text = (char *)emalloc(size); +! memmove(k->text, data, size); + k->flags = def; + return; + } +*************** +*** 2637,2643 **** + } + } + t = add_var(kv, size, def); +! bcopy(data, t, size); + } + + void +--- 2637,2643 ---- + } + } + t = add_var(kv, size, def); +! memmove(t, data, size); + } + + void +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.7 b/usr.sbin/xntpd/patches/patch.7 new file mode 100644 index 000000000000..682065fc558a --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.7 @@ -0,0 +1,274 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa21105; 28 Jan 94 9:25 EST +Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa08838; + 28 Jan 94 9:20 EST +Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; + id AA29169 (5.65c-6/7.3v-FAU); Fri, 28 Jan 1994 15:19:56 +0100 +Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; + id AA11999 (5.65c-6/7.3m-FAU); Fri, 28 Jan 1994 15:19:51 +0100 +From: Frank Kardel +Message-Id: <199401281419.AA11999@faui43.informatik.uni-erlangen.de> +Subject: Re: Solaribum +To: Paul A Vixie +Date: Fri, 28 Jan 94 14:02:02 MET +Cc: Mills@udel.edu, Frank.Kardel@informatik.uni-erlangen.de, + Piete.Brooks@cl.cam.ac.uk, Paul_Vixie@corpmis.sjc.hw.sony.com +In-Reply-To: <9401272236.AA27835@morality.sjc.hw.sony.com>; from "Paul A Vixie" at Jan 27, 94 2:36 pm +X-Mailer: ELM [version 2.3 PL11] + + +> >memmove() and crumps in loading with an unknown external. If the missing +> >routine is not there in SunOS 4, why not conditionally compile one +> >and be done with it? + +> as i said in earlier mail, there is already a macro for memmove, to define +> it in terms of bcopy, but it is only enabled on systems that don't have a +> native memmove. include/*.h tells the story. + +Ok, in order to cope with the problems (non existent memmove() and +sys header files that use bops) I fixed SUNOS4 and ULTRIX to use the +b-ops (via the NTP_NEED_BOPS define). All other should to my knowledge +use the mem* stuff (I'd rather use either mem* or b* instead of mixtures +of both). + +Now, the following patch should get 3.3y (and 3.3yy) to fly +(=compile) on suns. Functional test have not been done. ULTRIX +has not been tested. + +> there are too many x's and y's now. i'm confused. i promise not to send +> any more patches until the dust clears.. + +With this patch we should get to 3.3yyy which should be the +base for all next efforts (-> and 3.3{x,xx,y,yy} can be deleted). + +May the source be with us: + +diff -c -r ../yy/include/l_stdlib.h ./include/l_stdlib.h +*** ../yy/include/l_stdlib.h Thu Jan 27 15:03:21 1994 +--- ./include/l_stdlib.h Fri Jan 28 12:46:31 1994 +*************** +*** 47,54 **** +--- 47,60 ---- + extern int rand P((void)); + extern int setpgrp P((int, int)); + extern void srand P((unsigned int)); ++ extern void bcopy P((char *, char *, int)); + #endif + ++ #ifndef bzero /* XXX macro prototyping clash */ ++ extern void bzero P((char *, int)); ++ extern int bcmp P((char *, char *, int)); ++ extern void bcopy P((char *, char *, int)); ++ #endif + extern char *mktemp P((char *)); + + extern int tolower P((int)); +*************** +*** 92,102 **** +--- 98,110 ---- + + #ifdef _ntp_string_h + #ifdef NTP_POSIX_SOURCE /* these are builtins */ ++ #ifndef NTP_NEED_BOPS /* but may be emulated by bops */ + extern char *memcpy(); + extern char *memset(); + extern int memcmp(); + #endif + #endif ++ #endif + + #ifdef _sys_socket_h + extern int bind P((int, struct sockaddr *, int)); +*************** +*** 187,192 **** +--- 195,203 ---- + + #ifndef NTP_POSIX_SOURCE + extern int atoi P((char *)); ++ extern void bzero P((char *, int)); ++ extern int bcmp P((char *, char *, int)); ++ extern void bcopy P((char *, char *, int)); + extern int execve P((char *, char **,char **)); + extern int fork P((void)); + extern int getdtablesize P((void)); +diff -c -r ../yy/include/ntp_machine.h ./include/ntp_machine.h +*** ../yy/include/ntp_machine.h Fri Jan 28 13:32:33 1994 +--- ./include/ntp_machine.h Fri Jan 28 12:25:29 1994 +*************** +*** 168,173 **** +--- 168,174 ---- + * Note: posix version has NTP_POSIX_SOURCE and HAVE_SIGNALED_IO + */ + #if defined(SYS_SUNOS4) ++ #define NTP_NEED_BOPS + #define NO_SIGNED_CHAR_DECL + #define HAVE_LIBKVM + #define HAVE_MALLOC_H +*************** +*** 266,271 **** +--- 267,273 ---- + * Note: posix version has NTP_POSIX_SOURCE and HAVE_SIGNALED_IO + */ + #if defined(SYS_ULTRIX) ++ #define NTP_NEED_BOPS + #define S_CHAR_DEFINED + #define HAVE_READKMEM + #define HAVE_BSD_NICE +diff -c -r ../yy/include/ntp_string.h ./include/ntp_string.h +*** ../yy/include/ntp_string.h Thu Jan 27 15:03:24 1994 +--- ./include/ntp_string.h Fri Jan 28 12:36:44 1994 +*************** +*** 5,11 **** + #ifndef _ntp_string_h + #define _ntp_string_h + +! #ifdef NTP_POSIX_SOURCE + + # if defined(HAVE_MEMORY_H) + # include +--- 5,11 ---- + #ifndef _ntp_string_h + #define _ntp_string_h + +! #if defined(NTP_POSIX_SOURCE) + + # if defined(HAVE_MEMORY_H) + # include +*************** +*** 13,29 **** + + # include + +! #else /* NTP_POSIX_SOURCE */ + + # include +- + # define strchr(s,c) index(s,c) + # define strrchr(s,c) rindex(s,c) + # define memcmp(a,b,c) bcmp(a,b,c) + # define memmove(t,f,c) bcopy(f,t,c) +! # define memset(a,x,c) if (x == 0x00) bzero(a,c) else ntp_memset((char*)a,x,c) + void ntp_memset P((char *, int, int)); + +! #endif /* NTP_POSIX_SOURCE */ + + #endif /* _ntp_string_h */ +--- 13,35 ---- + + # include + +! #else + + # include + # define strchr(s,c) index(s,c) + # define strrchr(s,c) rindex(s,c) ++ # ifndef NTP_NEED_BOPS ++ # define NTP_NEED_BOPS ++ # endif ++ #endif /* NTP_POSIX_SOURCE */ ++ ++ #ifdef NTP_NEED_BOPS ++ + # define memcmp(a,b,c) bcmp(a,b,c) + # define memmove(t,f,c) bcopy(f,t,c) +! # define memset(a,x,c) if (x == 0x00) bzero(a,c); else ntp_memset((char*)a,x,c) + void ntp_memset P((char *, int, int)); + +! #endif /* NTP_NEED_BOPS */ + + #endif /* _ntp_string_h */ +diff -c -r ../yy/lib/machines.c ./lib/machines.c +*** ../yy/lib/machines.c Thu Jan 27 15:03:35 1994 +--- ./lib/machines.c Fri Jan 28 13:55:26 1994 +*************** +*** 31,37 **** + } + #endif + +! #if !defined(NTP_POSIX_SOURCE) + void + ntp_memset(a, x, c) + char *a; +--- 31,37 ---- + } + #endif + +! #if !defined(NTP_POSIX_SOURCE) || defined(NTP_NEED_BOPS) + void + ntp_memset(a, x, c) + char *a; +diff -c -r ../yy/parse/Makefile.tmpl ./parse/Makefile.tmpl +*** ../yy/parse/Makefile.tmpl Fri Nov 26 05:28:30 1993 +--- ./parse/Makefile.tmpl Fri Jan 28 13:47:30 1994 +*************** +*** 92,98 **** + + clean: + -@rm -f $(LIBNAME).a $(KLIBNAME).a *.o *.out *.ln make.log Makefile.bak \ +! lintlib.errs lint.errs genassym assym.s parsestreams parse + -@cd util && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" -f Makefile.tmpl clean + + distclean: clean +--- 92,98 ---- + + clean: + -@rm -f $(LIBNAME).a $(KLIBNAME).a *.o *.out *.ln make.log Makefile.bak \ +! lintlib.errs lint.errs genassym assym.s parsestreams parse parsestreams.o.* + -@cd util && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" -f Makefile.tmpl clean + + distclean: clean +diff -c -r ../yy/parse/parse.c ./parse/parse.c +*** ../yy/parse/parse.c Fri Jan 28 13:32:34 1994 +--- ./parse/parse.c Fri Jan 28 13:08:01 1994 +*************** +*** 29,47 **** + #include "sys/time.h" + #include "sys/errno.h" + + #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM) + /* +! * Sorry, but in SunOS 4.x kernels there are no + * mem* operations. I don't want them - bcopy, bzero + * are fine in the kernel + */ +! #define _ntp_string_h +! extern void bcopy(); +! extern void bzero(); + #else + #define bzero(_X_, _Y_) memset(_X_, 0, _Y_) + #define bcopy(_X_, _Y_, _Z_) memmove(_Y_, _X_, _Z_) + #endif + + #include "ntp_fp.h" + #include "ntp_unixtime.h" +--- 29,53 ---- + #include "sys/time.h" + #include "sys/errno.h" + ++ #include "ntp_machine.h" ++ + #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM) + /* +! * Sorry, but in SunOS 4.x AND Solaris 2.x kernels there are no + * mem* operations. I don't want them - bcopy, bzero + * are fine in the kernel + */ +! #ifndef NTP_NEED_BOPS +! #define NTP_NEED_BOPS +! #endif + #else ++ #ifndef NTP_NEED_BOPS ++ #ifndef bzero + #define bzero(_X_, _Y_) memset(_X_, 0, _Y_) + #define bcopy(_X_, _Y_, _Z_) memmove(_Y_, _X_, _Z_) + #endif ++ #endif ++ #endif + + #include "ntp_fp.h" + #include "ntp_unixtime.h" +-- + Frank Kardel (kardel@informatik.uni-erlangen.de) + All SCSI disks will from now on be required to send an email + notice 24 hours prior to complete hardware failure! + diff --git a/usr.sbin/xntpd/patches/patch.8 b/usr.sbin/xntpd/patches/patch.8 new file mode 100644 index 000000000000..52e928cf6f66 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.8 @@ -0,0 +1,44 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa21136; 28 Jan 94 9:30 EST +Received: from relay1.uu.net by louie.udel.edu id aa09355; 28 Jan 94 9:29 EST +Received: from outpost.wg.waii.com by relay1.UU.NET with SMTP + (5.61/UUNET-internet-primary) id AAwaur00219; Fri, 28 Jan 94 09:29:28 -0500 +Received: from airgun.wg.waii.com by outpost.wg.waii.com with SMTP id AA18918 + (5.65c/IDA-1.4.4 for ); Fri, 28 Jan 1994 08:29:23 -0600 +Received: from merlin.london.waii.com by airgun.wg.waii.com with SMTP id AA18376 + (5.65c/IDA-1.4.4 for ); Fri, 28 Jan 1994 08:29:16 -0600 +Received: from phoenix.london.waii.com by merlin.london.waii.com with SMTP id AA21698 + (5.65c/IDA-1.4.4 for ); Fri, 28 Jan 1994 14:24:29 GMT +Received: by phoenix.london.waii.com (4.1/SMI-4.1) + id AA21825; Fri, 28 Jan 94 14:29:12 GMT +Date: Fri, 28 Jan 94 14:29:12 GMT +From: Marc Brett +Message-Id: <9401281429.AA21825@phoenix.london.waii.com> +To: mills@udel.edu +Subject: Bug in export version of xntp.3.3c + +Dave, + +The crippled DES routine fails to compile on my machine (SunOS 1.4.3, cc). +It complains about U_LONG being unrecognized. Luckily, the fix is a +one-liner. + +*** authdes.c.export Tue Aug 24 22:26:45 1993 +--- authdes.c Fri Jan 28 12:18:40 1994 +*************** +*** 15,20 **** +--- 15,21 ---- + * to its exportable state, copy this file to authdes.c . + */ + #include ++ #include "ntp_stdlib.h" + + /* + * This routine is normally called to compute the key schedule. + + +Regards, + +Marc Brett marc.brett@london.waii.com +Western Geophysical Tel: +44 81 560 3160 + diff --git a/usr.sbin/xntpd/patches/patch.9 b/usr.sbin/xntpd/patches/patch.9 new file mode 100644 index 000000000000..76b330985770 --- /dev/null +++ b/usr.sbin/xntpd/patches/patch.9 @@ -0,0 +1,83 @@ + +Received: from louie.udel.edu by huey.udel.edu id aa04410; 31 Jan 94 4:58 EST +Received: from gw.home.vix.com by louie.udel.edu id aa00370; 31 Jan 94 4:52 EST +Received: by gw.home.vix.com id AA12643; Mon, 31 Jan 94 01:52:12 -0800 +Message-Id: <9401310952.AA12643@gw.home.vix.com> +X-Btw: vix.com is also gw.home.vix.com and vixie.sf.ca.us +To: Mills@udel.edu +Cc: Frank.Kardel@informatik.uni-erlangen.de, Piete.Brooks@cl.cam.ac.uk +Subject: diffs to yyy to make ultrix/GOES happy +Date: Mon, 31 Jan 94 01:52:11 PST +From: Paul A Vixie + +diff -r -c2 yyy.ref/adjtime/adjtimed.c xntp3.3yyy/adjtime/adjtimed.c +*** yyy.ref/adjtime/adjtimed.c Thu Jan 27 06:03:11 1994 +--- xntp3.3yyy/adjtime/adjtimed.c Mon Jan 31 01:24:49 1994 +*************** +*** 82,86 **** +--- 82,90 ---- + progname = argv[0]; + ++ #ifdef LOG_LOCAL6 + openlog("adjtimed", LOG_PID, LOG_LOCAL6); ++ #else ++ openlog("adjtimed", LOG_PID); ++ #endif + + while ((ch = ntp_getopt(argc, argv, "hkrvdfp:")) != EOF) { +diff -r -c2 yyy.ref/include/ntp_machine.h xntp3.3yyy/include/ntp_machine.h +*** yyy.ref/include/ntp_machine.h Fri Jan 28 07:26:11 1994 +--- xntp3.3yyy/include/ntp_machine.h Mon Jan 31 01:01:11 1994 +*************** +*** 42,47 **** + + +! WHICH TERMINAL MODEL TO USE - I would assume HAVE_POSIX_TTYS if +! NTP_POSIX_SOURCE was set but cann't. The + posix tty driver is too restrictive on most systems. + It defined if you define STREAMS. +--- 42,47 ---- + + +! WHICH TERMINAL MODEL TO USE - I would assume HAVE_TERMIOS if +! NTP_POSIX_SOURCE was set but can't. The + posix tty driver is too restrictive on most systems. + It defined if you define STREAMS. +*************** +*** 50,54 **** + HAVE_BSD_TTYS - Use BSD stty.h + HAVE_TERMIOS - Use POSIX termios.h +- HAVE_POSIX_TTYS - "struct termios" has c_line defined + + THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about +--- 50,53 ---- +*************** +*** 268,272 **** + */ + #if defined(SYS_ULTRIX) +- #define NTP_NEED_BOPS + #define S_CHAR_DEFINED + #define HAVE_READKMEM +--- 267,270 ---- +*************** +*** 277,280 **** +--- 275,279 ---- + #define STR_SYSTEM "UNIX/Ultrix" + #endif ++ #define HAVE_TERMIOS + #endif + +*************** +*** 565,568 **** +--- 564,573 ---- + && !defined(HAVE_NO_NICE) + ERROR You_must_define_one_of_the_HAVE_xx_NICE_defines ++ #endif ++ ++ #if !defined(HAVE_SYSV_TTYS) \ ++ && !defined(HAVE_BSD_TTYS) \ ++ && !defined(HAVE_TERMIOS) ++ ERROR no_tty_type_defined + #endif + + diff --git a/usr.sbin/xntpd/scripts/Guess.sh b/usr.sbin/xntpd/scripts/Guess.sh index ba01e566ddf5..88dcb1a5ef86 100755 --- a/usr.sbin/xntpd/scripts/Guess.sh +++ b/usr.sbin/xntpd/scripts/Guess.sh @@ -78,7 +78,7 @@ if [ -f /bin/uname -o -f /usr/bin/uname ]; then 3.2.*) case "$4" in v*) - (i386) >/dev/null 2>&1 && guess=ptx;; + (i386) >/dev/null 2>&1 && [ -f /usr/lib/libseq.a ] && guess=ptx;; esac esac fi diff --git a/usr.sbin/xntpd/scripts/stats/README b/usr.sbin/xntpd/scripts/stats/README index 5aa64d4c1db9..680896342acb 100644 --- a/usr.sbin/xntpd/scripts/stats/README +++ b/usr.sbin/xntpd/scripts/stats/README @@ -3,20 +3,27 @@ Statistics processing scripts (README) This directory contains a number of scripts for use with the filegen facility. Those files ending in .awk are for the Unix awk utility, while those ending in .sh are for the csh utility. Normally, the summary.sh -script is called from a cron job once per day. This script calls the -peer.sh script to process the peerstats file and append the summary -statistics to the peer_summary file. Then, it callse the loop.sh script -to process the loopstats file and append the summary statistics to the -loop_summary file. Finally, it calls the clock.sh script to process the -clockstats file and append the summary statistics to the clock_summary -file. +script is called from a cron job once per day. This script processes the +daily loopstats, peerstats and clockstats files produced by the daemon, +updates the loop_summary, peer_summary and clock_summary archive files, +and deletes the daily files. -Each of the three shell scripts peer.sh, loop.sh and clock.sh invoke -one or more awk scripts to actually produce the data. This may result -in multiple scans of the same input file. The input file is deleted after -processing. In fact, the shell scripts will process all input files -found of the correct type in chronological order, deleting each one as -it is scanned, except the current day file. +In the case of the Austron 2201A GPS receiver, the clockstats file +contains a wealth of additional monitoring data. These data are summarized +and writted to the clock_summary file, then a series of special files are +constructed for later processing by the S utility. + +The summary.sh script invokes a number of awk scripts to actually produce +the data. This may result in multiple scans of the same input file. +The input file is deleted after processing. In fact, the shell scripts will +process all input files found of the correct type in chronological order, +deleting each one as it is scanned, except the current day file. + +The summary.sh script can produce input files for the S utility, if it +is found on the search path. This utility makes PostScript graphs of the +loopstats data for each day, as well as various statistics produced by +the Austorn 220aA GPS receiver. The S utility is automatically run +as a background job. Its control files have the .S extension. The psummary.awk script can be used to scan the peer_summary file and construct an historical reprise of the daily summaries. @@ -29,4 +36,4 @@ David L. Mills University of Delaware mills@udel.edu 1 November 1993 - +Revised 12 April 1994 diff --git a/usr.sbin/xntpd/scripts/stats/dupe.awk b/usr.sbin/xntpd/scripts/stats/dupe.awk index 3ddc1b6f9754..317c2a4faf84 100644 --- a/usr.sbin/xntpd/scripts/stats/dupe.awk +++ b/usr.sbin/xntpd/scripts/stats/dupe.awk @@ -1,4 +1,5 @@ -# program to delete duplicate lines in a file +# +# delete duplicate lines # { if (old != $0) diff --git a/usr.sbin/xntpd/scripts/stats/ensemble.S b/usr.sbin/xntpd/scripts/stats/ensemble.S new file mode 100644 index 000000000000..32a4dbabb820 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/ensemble.S @@ -0,0 +1,5 @@ +ensemble <- scan(file1, list(day=0, sec=0, gps=0, gpsw=0, loran=0, loranw=0, ensemble=0, std=0)) +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck = 0.03, mar = c(2, 2, 1, 1)) +plot(ensemble$sec, ensemble$ensemble, type="l", xlab=paste("MJD", ensemble$day, "Time (s)"), ylab="Ensemble Offset (ns)", ylim=c(-400, 400)) diff --git a/usr.sbin/xntpd/scripts/stats/etf.S b/usr.sbin/xntpd/scripts/stats/etf.S new file mode 100644 index 000000000000..9b9c68b937b5 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/etf.S @@ -0,0 +1,15 @@ +options(digits=4) +file2 <- "etf_summary" +etf <- scan(file1, list(day=0, sec=0, offset=0, stab=0)) +r <- lsfit(etf$sec, etf$offset) +count<-length(etf$sec) +mean<-r$coef[[1]] +std<-sqrt(var(r$residuals)) +slope<-r$coef[[2]] * 1000 +cat("\n", file=file2 , append=TRUE, fill=FALSE, sep="") +cat(file1, "\n", file=file2, append=TRUE, fill=FALSE, sep="") +cat("etf1 ", count, ", T ", mean, " ns, R ", slope, " ps/s, std ", std, " us\n", file=file2, append=TRUE, fill=FALSE, sep="") +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(etf$sec, etf$offset, type="l", xlab=paste("MJD", etf$day, "Time (s)"), ylab="External Offset (ns)", ylim=c(-400, 400)) diff --git a/usr.sbin/xntpd/scripts/stats/itf.S b/usr.sbin/xntpd/scripts/stats/itf.S new file mode 100644 index 000000000000..56c8c8d0cc7a --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/itf.S @@ -0,0 +1,5 @@ +itf <- scan(file1, list(day=0, sec=0, offset=0, stab=0)) +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(itf$sec, itf$offset, type="l", xlab=paste("MJD", itf$day, "Time (s)"), ylab="Internal Offset (ns)", ylim=c(-400, 400)) diff --git a/usr.sbin/xntpd/scripts/stats/loop.S b/usr.sbin/xntpd/scripts/stats/loop.S new file mode 100644 index 000000000000..8e564b67eb67 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/loop.S @@ -0,0 +1,7 @@ +options(digits=4) +loop <- scan(file1, list(day=0, sec=0, offset=0, freq=0, tc=0)) +loop$offset <- loop$offset * 1e6 +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(loop$sec, loop$offset, type="l", xlab=paste("MJD", loop$day, "Time (s)"), ylab="PLL Offset (us)", ylim=c(-400, 400)) diff --git a/usr.sbin/xntpd/scripts/stats/loop.awk b/usr.sbin/xntpd/scripts/stats/loop.awk index 25d0bdb97d53..470b27c8bef5 100644 --- a/usr.sbin/xntpd/scripts/stats/loop.awk +++ b/usr.sbin/xntpd/scripts/stats/loop.awk @@ -35,15 +35,7 @@ BEGIN { loop_time_rms = sqrt(loop_time_rms / loop_count - loop_time * loop_time) loop_freq /= loop_count loop_freq_rms = sqrt(loop_freq_rms / loop_count - loop_freq * loop_freq) - loop_tmax = loop_tmax - loop_time - loop_tmin = loop_time - loop_tmin - if (loop_tmin > loop_tmax) - loop_tmax = loop_tmin - loop_fmax = loop_fmax - loop_freq - loop_fmin = loop_time - loop_fmin - if (loop_fmin > loop_fmax) - loop_fmax = loop_fmin - printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, rms %.3f\n", loop_count, loop_time * 1e6, loop_tmax * 1e6, loop_time_rms * 1e6, loop_freq, loop_fmax, loop_freq_rms + printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, var %.3f\n", loop_count, (loop_tmax + loop_tmin) / 2 * 1e6, (loop_tmax - loop_tmin) / 2 * 1e6, loop_time_rms * 1e6, (loop_fmax + loop_fmin) / 2, (loop_fmax - loop_fmin) / 2, loop_freq_rms } } diff --git a/usr.sbin/xntpd/scripts/stats/psummary.awk b/usr.sbin/xntpd/scripts/stats/psummary.awk index b7f0e922a7d6..5ef8d8eb5280 100644 --- a/usr.sbin/xntpd/scripts/stats/psummary.awk +++ b/usr.sbin/xntpd/scripts/stats/psummary.awk @@ -1,5 +1,7 @@ # program to scan peer_summary file and produce summary of daily summaries # +# usage: awk -f psummary.awk peer_summary +# { if (NF < 8 || $1 == "ident") continue diff --git a/usr.sbin/xntpd/scripts/stats/rms.awk b/usr.sbin/xntpd/scripts/stats/rms.awk new file mode 100644 index 000000000000..34d612ab3582 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/rms.awk @@ -0,0 +1,41 @@ +# program to scan peer_summary file +# +{ + if (NF < 8 || $1 == "ident") + continue + i = n + for (j = 0; j < n; j++) { + if ($1 == peer_ident[j]) + i = j + } + if (i == n) { + peer_ident[i] = $1 + n++ + } + peer_count[i]++ + if (($7 - $6 / 2) < 400) { + peer_count[i]++ + peer_mean[i] += $3 + peer_var[i] += $4 * $4 + if ($5 > peer_max[i]) + peer_max[i] = $5 + if ($5 > 1) + peer_1[i]++ + if ($5 > 5) + peer_2[i]++ + if ($5 > 10) + peer_3[i]++ + if ($5 > 50) + peer_4[i]++ + } +} END { + printf " host cnt mean sd max >1 >5 >10 >50\n" + printf "=================================================================\n" + for (i = 0; i < n; i++) { + if (peer_count[i] <= 0) + continue + peer_mean[i] /= peer_count[i] + peer_var[i] = sqrt(peer_var[i] / peer_count[i]) + printf "%15s%4d%10.3f%10.3f%10.3f%4d%4d%4d%4d\n", peer_ident[i], peer_count[i], peer_mean[i], peer_var[i], peer_max[i], peer_1[i], peer_2[i], peer_3[i], peer_4[i] + } +} diff --git a/usr.sbin/xntpd/scripts/stats/summary.sh b/usr.sbin/xntpd/scripts/stats/summary.sh index ab99f4d8e8d5..caac2b0c3bec 100755 --- a/usr.sbin/xntpd/scripts/stats/summary.sh +++ b/usr.sbin/xntpd/scripts/stats/summary.sh @@ -1,17 +1,88 @@ -#!/bin/csh +#!/bin/sh # # Script to summarize ipeerstats, loopstats and clockstats files # # This script can be run from a cron job once per day, week or month. It # runs the file-specific summary script and appends the summary data to -# designated files, which must be created first. +# designated files. # -if ( -e peer_summary ) then - peer.sh >>peer_summary -endif -if ( -e loop_summary ) then - loop.sh >>loop_summary -endif -if ( -e clock_summary ) then - clock.sh >>clock_summary -endif +DATE=`date +19%y%m%d` +SIN=S.in +SOUT=S.out +LOOP=loop_summary +PEER=peer_summary +CLOCK=clock_summary + +rm -f $SIN $SOUT +S=0 +if [ -f `which S | cut -f1 -d" "` ]; then + S=1 +fi +# +# Summarize loopstats files +# +for f in loopstats.????????; do + d=`echo $f | cut -f2 -d.` + if [ $DATE != $d ]; then + echo " " >>$LOOP + echo $f >>$LOOP + awk -f loop.awk $f >>$LOOP + if [ $S ]; then + echo "file1<-"\"${f}\" >>$SIN + echo "source("\""loop.S"\"")" >>$SIN + fi + rm -f $f + fi +done + +# +# Summarize peerstats files +# +for f in peerstats.????????; do + d=`echo $f | cut -f2 -d.` + if [ $DATE != $d ]; then + echo " " >>$PEER + echo $f >>$PEER + awk -f peer.awk $f >>$PEER + rm -f $f + fi +done + +# +# Summarize clockstats files +# +for f in clockstats.????????; do + d=`echo $f | cut -f2 -d.` + if [ $DATE != $d ]; then + echo " " >>$CLOCK + echo $f >>$CLOCK + awk -f clock.awk $f >>$CLOCK + if [ -f /dev/gps* ]; then + awk -f itf.awk $f >itf.$d + awk -f etf.awk $f >etf.$d + awk -f ensemble.awk $f >ensemble.$d + awk -f tdata.awk $f >tdata.$d + fi + rm -f $f + fi +done + +# +# Process clockstat files with S and generate PostScript plots +# +for f in itf etf ensemble tdata; do + for d in ${f}.????????; do + if [ -f $d ]; then + if [ $S ]; then + echo "file1<-"\"${d}\" >>$SIN + echo "source("\"${f}.S\"")" >>$SIN + echo "unix("\""rm ${d}"\"")" >>$SIN + else + rm -f $d + fi + fi + done +done +if [ -f $SIN ]; then + S BATCH $SIN $SOUT +fi diff --git a/usr.sbin/xntpd/scripts/stats/tdata.S b/usr.sbin/xntpd/scripts/stats/tdata.S new file mode 100644 index 000000000000..f360a248c06a --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/tdata.S @@ -0,0 +1,5 @@ +tdata <- scan(file1, list(day=0, sec=0, m=0, w=0, x=0, y=0, z=0)) +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(tdata$sec, tdata$m, type="l", xlab=paste("MJD", tdata$day, "Time (s)"), ylab="LORAN-M SNR (dB)") diff --git a/usr.sbin/xntpd/util/ntptime.c b/usr.sbin/xntpd/util/ntptime.c index dc60d6fa1022..858fe7cba481 100644 --- a/usr.sbin/xntpd/util/ntptime.c +++ b/usr.sbin/xntpd/util/ntptime.c @@ -72,36 +72,36 @@ main(argc, argv) cost++; break; case 'e': - ntx.mode |= ADJ_ESTERROR; + ntx.modes |= MOD_ESTERROR; ntx.esterror = atoi(ntp_optarg); break; case 'f': - ntx.mode |= ADJ_FREQUENCY; - ntx.frequency = (int) (atof(ntp_optarg) - * (1 << SHIFT_USEC)); - if (ntx.frequency < (-100 << SHIFT_USEC) - || ntx.frequency > ( 100 << SHIFT_USEC)) errflg++; + ntx.modes |= MOD_FREQUENCY; + ntx.freq = (int) (atof(ntp_optarg) * + (1 << SHIFT_USEC)); + if (ntx.freq < (-100 << SHIFT_USEC) + || ntx.freq > ( 100 << SHIFT_USEC)) errflg++; break; case 'm': - ntx.mode |= ADJ_MAXERROR; + ntx.modes |= MOD_MAXERROR; ntx.maxerror = atoi(ntp_optarg); break; case 'o': - ntx.mode |= ADJ_OFFSET; + ntx.modes |= MOD_OFFSET; ntx.offset = atoi(ntp_optarg); break; case 'r': rawtime++; break; case 's': - ntx.mode |= ADJ_STATUS; + ntx.modes |= MOD_STATUS; ntx.status = atoi(ntp_optarg); if (ntx.status < 0 || ntx.status > 4) errflg++; break; case 't': - ntx.mode |= ADJ_TIMECONST; - ntx.time_constant = atoi(ntp_optarg); - if (ntx.time_constant < 0 || ntx.time_constant > MAXTC) + ntx.modes |= MOD_TIMECONST; + ntx.constant = atoi(ntp_optarg); + if (ntx.constant < 0 || ntx.constant > MAXTC) errflg++; break; default: @@ -117,7 +117,7 @@ main(argc, argv) -m maxerror max possible error (us)\n\ -o offset current offset (ms)\n\ -r print the unix and NTP time raw\n\ - -s status Set the status (0 .. 4)\n\ + -l leap Set the leap bits\n\ -t timeconstant log2 of PLL time constant (0 .. %d)\n", progname, optargs, MAXTC); exit(2); @@ -153,13 +153,13 @@ main(argc, argv) times[c] = ntv.time.tv_usec; } if (pll_control >= 0) { - printf("[ usec %06d:", times[0]); + printf("[ us %06d:", times[0]); for (c=1; c< sizeof times / sizeof times[0]; c++) printf(" %d", times[c] - times[c-1]); printf(" ]\n"); } } (void)ntp_gettime(&ntv); - _ntx.mode = 0; /* Ensure nothing is set */ + _ntx.modes = 0; /* Ensure nothing is set */ (void)ntp_adjtime(&_ntx); if (pll_control < 0) { printf("NTP user interface routines are not configured in this kernel.\n"); @@ -177,9 +177,9 @@ main(argc, argv) ts.l_uf += TS_ROUNDBIT; /* guaranteed not to overflow */ ts.l_ui += JAN_1970; ts.l_uf &= TS_MASK; - printf(" time: %s, (.%06d)\n", + printf(" time %s, (.%06d),\n", prettydate(&ts), ntv.time.tv_usec); - printf(" confidence interval: %ld usec, estimated error: %ld usec\n", + printf(" maximum error %ld us, estimated error %ld us.\n", ntv.maxerror, ntv.esterror); if (rawtime) printf(" ntptime=%x.%x unixtime=%x.%06d %s", ts.l_ui, ts.l_uf, @@ -191,25 +191,26 @@ main(argc, argv) ">> ntp_adjtime() call fails"); else { printf("ntp_adjtime() returns code %d\n", status); - ftemp = ntx.frequency; + ftemp = ntx.freq; ftemp /= (1 << SHIFT_USEC); - printf(" mode: %02x, offset: %ld usec, frequency:%8.3f ppm,\n", - ntx.mode, ntx.offset, ftemp); - printf(" confidence interval: %ld usec, estimated error: %ld usec,\n", + printf(" modes %04x, offset %ld us, frequency %.3f ppm, interval %d s,\n", + ntx.modes, ntx.offset, ftemp, 1 << ntx.shift); + printf(" maximum error %ld us, estimated error %ld us,\n", ntx.maxerror, ntx.esterror); ftemp = ntx.tolerance; ftemp /= (1 << SHIFT_USEC); - printf(" status: %d, time constant: %ld, precision: %ld usec, tolerance:%4.0f ppm\n", - ntx.status, ntx.time_constant, ntx.precision, ftemp); + printf(" status %04x, time constant %ld, precision %ld us, tolerance %.0f ppm,\n", + ntx.status, ntx.constant, ntx.precision, ftemp); if (ntx.shift == 0) return; - ftemp = ntx.ybar; + ftemp = ntx.ppsfreq; ftemp /= (1 << SHIFT_USEC); - gtemp = ntx.disp; + gtemp = ntx.stabil; gtemp /= (1 << SHIFT_USEC); - printf(" pps frequency%8.3f ppm, pps dispersion:%8.3f ppm, interval:%4d sec,\n intervals:%5ld, jitter exceeded:%4ld, dispersion exceeded:%4ld\n", - ftemp, gtemp, 1 << ntx.shift, ntx.calcnt, ntx.jitcnt, - ntx.discnt); + printf(" pps frequency %.3f ppm, stability %.3f ppm, jitter %ld us,\n", + ftemp, gtemp, ntx.jitter); + printf(" intervals %ld, jitter exceeded %ld, stability exceeded %ld, errors %ld.\n", + ntx.calcnt, ntx.jitcnt, ntx.stbcnt, ntx.errcnt); } /* diff --git a/usr.sbin/xntpd/xntpd/minpoll b/usr.sbin/xntpd/xntpd/minpoll new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/usr.sbin/xntpd/xntpd/ntp_config.c b/usr.sbin/xntpd/xntpd/ntp_config.c index cfa47a8ec9d2..8f356ac8c2e7 100644 --- a/usr.sbin/xntpd/xntpd/ntp_config.c +++ b/usr.sbin/xntpd/xntpd/ntp_config.c @@ -45,8 +45,9 @@ * peer 128.100.1.1 [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] * server 128.100.2.2 [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] * precision -7 - * broadcast 128.100.224.255 [ version 3 ] [ key 0 ] - * broadcastclient yes|no + * broadcast 128.100.224.255 [ version 3 ] [ key 0 ] [ ttl 1 ] + * broadcastclient + * multicastclient [224.0.1.1] * broadcastdelay 0.0102 * authenticate yes|no * monitor yes|no @@ -58,7 +59,16 @@ * statsdir /var/NTP/ * filegen peerstats [ file peerstats ] [ type day ] [ link ] * resolver /path/progname - * netlimit integer + * clientlimit [ n ] + * clientperiod [ 3600 ] + * trustedkey [ key ] + * requestkey [ key] + * controlkey [ key ] + * trap [ address ] + * fudge [ ... ] + * pidfile [ ] + * logfile [ ] + * setvar [ ] * * And then some. See the manual page. */ @@ -85,24 +95,24 @@ #define CONFIG_CONTROLKEY 15 #define CONFIG_TRAP 16 #define CONFIG_FUDGE 17 -#define CONFIG_MAXSKEW 18 -#define CONFIG_RESOLVER 19 -#define CONFIG_SELECT 20 -#define CONFIG_STATSDIR 21 -#define CONFIG_FILEGEN 22 -#define CONFIG_STATISTICS 23 -#define CONFIG_PPS 24 -#define CONFIG_PIDFILE 25 -#define CONFIG_LOGFILE 26 -#define CONFIG_SETVAR 27 -#define CONFIG_CLIENTLIMIT 28 -#define CONFIG_CLIENTPERIOD 29 +#define CONFIG_RESOLVER 18 +#define CONFIG_STATSDIR 19 +#define CONFIG_FILEGEN 20 +#define CONFIG_STATISTICS 21 +#define CONFIG_PPS 22 +#define CONFIG_PIDFILE 23 +#define CONFIG_LOGFILE 24 +#define CONFIG_SETVAR 25 +#define CONFIG_CLIENTLIMIT 26 +#define CONFIG_CLIENTPERIOD 27 +#define CONFIG_MULTICASTCLIENT 28 #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_TTL 6 #define CONF_PPS_DELAY 1 #define CONF_PPS_BAUD 2 @@ -162,6 +172,7 @@ static struct keyword keywords[] = { { "driftfile", CONFIG_DRIFTFILE }, { "broadcast", CONFIG_BROADCAST }, { "broadcastclient", CONFIG_BROADCASTCLIENT }, + { "multicastclient", CONFIG_MULTICASTCLIENT }, { "authenticate", CONFIG_AUTHENTICATE }, { "keys", CONFIG_KEYS }, { "monitor", CONFIG_MONITOR }, @@ -174,9 +185,7 @@ static struct keyword keywords[] = { { "controlkey", CONFIG_CONTROLKEY }, { "trap", CONFIG_TRAP }, { "fudge", CONFIG_FUDGE }, - { "maxskew", CONFIG_MAXSKEW }, { "resolver", CONFIG_RESOLVER }, - { "select", CONFIG_SELECT }, { "statsdir", CONFIG_STATSDIR }, { "filegen", CONFIG_FILEGEN }, { "statistics", CONFIG_STATISTICS }, @@ -197,6 +206,7 @@ static struct keyword mod_keywords[] = { { "minpoll", CONF_MOD_MINPOLL }, { "maxpoll", CONF_MOD_MAXPOLL }, { "prefer", CONF_MOD_PREFER }, + { "ttl", CONF_MOD_TTL }, { "", CONFIG_UNKNOWN } }; @@ -325,12 +335,12 @@ extern int debug; #endif extern char *FindConfig(); char *progname; -static char *xntp_options = "abc:de:f:k:l:p:r:s:t:v:V:"; +static char *xntp_options = "abc:de:f:k:l:mp:r:s:t:v:V:"; static int gettokens P((FILE *, char *, char **, int *)); static int matchkey P((char *, struct keyword *)); static int getnetnum P((char *, struct sockaddr_in *, int)); -static void save_resolve P((char *, int, int, int, int, int, U_LONG)); +static void save_resolve P((char *, int, int, int, int, int, int, U_LONG)); static void do_resolve P((char *, U_LONG, char *)); #ifdef RESOLVE_INTERNAL static void do_resolve_internal P((void)); @@ -417,6 +427,7 @@ getconfig(argc, argv) int peerversion; int minpoll; int maxpoll; + int ttl; U_LONG peerkey; int peerflags; int hmode; @@ -473,12 +484,15 @@ getconfig(argc, argv) case 'a': proto_config(PROTO_AUTHENTICATE, (LONG)1); break; + case 'b': proto_config(PROTO_BROADCLIENT, (LONG)1); break; + case 'c': config_file = ntp_optarg; break; + case 'd': #ifdef DEBUG debug++; @@ -523,6 +537,10 @@ getconfig(argc, argv) } break; + case 'm': + proto_config(PROTO_MULTICAST_ADD, INADDR_NTP); + break; + case 'p': stats_config(STATS_PID_FILE, ntp_optarg); break; @@ -631,6 +649,7 @@ getconfig(argc, argv) maxpoll = NTP_MAXPOLL; peerkey = 0; peerflags = 0; + ttl = 1; for (i = 2; i < ntokens; i++) switch (matchkey(tokens[i], mod_keywords)) { case CONF_MOD_VERSION: @@ -696,6 +715,16 @@ getconfig(argc, argv) peerflags |= FLAG_PREFER; break; + case CONF_MOD_TTL: + if (i >= ntokens-1) { + syslog(LOG_ERR, + "ttl: argument required"); + errflg = 1; + break; + } + ttl = atoi(tokens[++i]); + break; + case CONFIG_UNKNOWN: errflg = 1; break; @@ -707,14 +736,15 @@ getconfig(argc, argv) if (errflg == 0) { if (peer_config(&peeraddr, (struct interface *)0, hmode, peerversion, - minpoll, maxpoll, peerkey, peerflags) == 0) { + minpoll, maxpoll, peerflags, ttl, peerkey) + == 0) { syslog(LOG_ERR, "configuration of %s failed", ntoa(&peeraddr)); } } else if (errflg == -1) { save_resolve(tokens[1], hmode, peerversion, - minpoll, maxpoll, peerflags, peerkey); + minpoll, maxpoll, peerflags, ttl, peerkey); } break; @@ -771,23 +801,20 @@ getconfig(argc, argv) } break; case CONFIG_BROADCASTCLIENT: - errflg = 0; - if (ntokens >= 2) { - if (STREQ(tokens[1], "yes")) - proto_config(PROTO_BROADCLIENT, (LONG)1); - else if (STREQ(tokens[1], "no")) - proto_config(PROTO_BROADCLIENT, (LONG)0); - else - errflg++; - } else { - errflg++; - } - - if (errflg) - syslog(LOG_ERR, - "should be `broadcastclient yes|no'"); + proto_config(PROTO_BROADCLIENT, (U_LONG)1); break; + case CONFIG_MULTICASTCLIENT: + if (ntokens > 1) { + for (i = 1; i < ntokens; i++) { + if (getnetnum(tokens[i], &peeraddr, 1)); + proto_config(PROTO_MULTICAST_ADD, + peeraddr.sin_addr.s_addr); + } + } else + proto_config(PROTO_MULTICAST_ADD, INADDR_NTP); + break; + case CONFIG_AUTHENTICATE: errflg = 0; if (ntokens >= 2) { @@ -1263,26 +1290,6 @@ getconfig(argc, argv) #endif break; - case CONFIG_MAXSKEW: - if (ntokens >= 2) { - l_fp tmp; - u_fp utmp; - - if (!atolfp(tokens[1], &tmp)) { - syslog(LOG_ERR, - "maxskew value %s undecodable", - tokens[1]); - } else if (tmp.l_ui != 0) { - syslog(LOG_ERR, - "maxskew value %s is unlikely", - tokens[1]); - } else { - utmp = LFPTOFP(&tmp); - proto_config(PROTO_MAXSKEW, (LONG)utmp); - } - } - break; - case CONFIG_RESOLVER: if (ntokens >= 2) { if (strlen(tokens[1]) >= (size_t)MAXFILENAME) { @@ -1299,18 +1306,6 @@ getconfig(argc, argv) } break; - case CONFIG_SELECT: - if (ntokens >= 2) { - i = atoi(tokens[1]); - if (i < SELECT_1 || i > SELECT_5) - syslog(LOG_ERR, - "invalid selection algorithm %s, line ignored", - tokens[1]); - else - proto_config(PROTO_SELECT, (LONG)i); - } - break; - case CONFIG_STATSDIR: if (ntokens >= 2) { stats_config(STATS_STATSDIR,tokens[1]); @@ -1708,13 +1703,14 @@ int sig; * save_resolve - save configuration info into a file for later name resolution */ static void -save_resolve(name, mode, version, minpoll, maxpoll, flags, keyid) +save_resolve(name, mode, version, minpoll, maxpoll, flags, ttl, keyid) char *name; int mode; int version; int minpoll; int maxpoll; int flags; + int ttl; U_LONG keyid; { if (res_fp == NULL) { @@ -1733,8 +1729,8 @@ save_resolve(name, mode, version, minpoll, maxpoll, flags, keyid) } #endif - (void) fprintf(res_fp, "%s %d %d %d %d %d %lu\n", name, mode, - version, minpoll, maxpoll, flags, keyid); + (void) fprintf(res_fp, "%s %d %d %d %d %d %d %lu\n", name, mode, + version, minpoll, maxpoll, flags, ttl, keyid); } diff --git a/usr.sbin/xntpd/xntpd/ntp_intres.c b/usr.sbin/xntpd/xntpd/ntp_intres.c index 20561e91b82d..5ff4af4d8242 100644 --- a/usr.sbin/xntpd/xntpd/ntp_intres.c +++ b/usr.sbin/xntpd/xntpd/ntp_intres.c @@ -48,6 +48,7 @@ struct conf_entry { #define ce_minpoll ce_config.minpoll #define ce_maxpoll ce_config.maxpoll #define ce_flags ce_config.flags +#define ce_ttl ce_config.ttl #define ce_keyid ce_config.keyid /* @@ -102,8 +103,9 @@ static int resolve_value; /* next value of resolve timer */ #define TOK_MINPOLL 3 #define TOK_MAXPOLL 4 #define TOK_FLAGS 5 -#define TOK_KEYID 6 -#define NUMTOK 7 +#define TOK_TTL 6 +#define TOK_KEYID 7 +#define NUMTOK 8 #define MAXLINESIZE 512 @@ -128,7 +130,7 @@ extern int errno; 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, U_LONG)); +static void addentry P((char *, int, int, int, int, int, int, U_LONG)); static int findhostaddr P((struct conf_entry *)); static void openntp P((void)); static int request P((struct conf_peer *)); @@ -279,13 +281,14 @@ removeentry(entry) * addentry - add an entry to the configuration list */ static void -addentry(name, mode, version, minpoll, maxpoll, flags, keyid) +addentry(name, mode, version, minpoll, maxpoll, flags, ttl, keyid) char *name; int mode; int version; int minpoll; int maxpoll; int flags; + int ttl; U_LONG keyid; { register char *cp; @@ -304,6 +307,7 @@ addentry(name, mode, version, minpoll, maxpoll, flags, keyid) ce->ce_minpoll = (u_char)minpoll; ce->ce_maxpoll = (u_char)maxpoll; ce->ce_flags = (u_char)flags; + ce->ce_ttl = (u_char)ttl; ce->ce_keyid = htonl(keyid); ce->ce_next = NULL; @@ -751,7 +755,8 @@ readconf(fp, name) */ addentry(token[TOK_HOSTNAME], (int)intval[TOK_HMODE], (int)intval[TOK_VERSION], (int)intval[TOK_MINPOLL], - (int)intval[TOK_MAXPOLL], flags, intval[TOK_KEYID]); + (int)intval[TOK_MAXPOLL], flags, (int)intval[TOK_TTL], + intval[TOK_KEYID]); } } diff --git a/usr.sbin/xntpd/xntpd/ntp_io.c b/usr.sbin/xntpd/xntpd/ntp_io.c index 614d5c52bde9..551df510dc37 100644 --- a/usr.sbin/xntpd/xntpd/ntp_io.c +++ b/usr.sbin/xntpd/xntpd/ntp_io.c @@ -10,6 +10,10 @@ #include #include +#ifdef MCAST +#include "ntp_in.h" +#endif /* MCAST */ + #include "ntpd.h" #include "ntp_select.h" #include "ntp_io.h" @@ -53,7 +57,6 @@ /* * Block the interrupt, for critical sections. */ - #if defined(HAVE_SIGNALED_IO) #define BLOCKIO() ((void) block_sigio()) #define UNBLOCKIO() ((void) unblock_sigio()) @@ -228,6 +231,9 @@ create_sockets(port) inter_list[0].sent = 0; inter_list[0].notsent = 0; inter_list[0].flags = INT_BROADCAST; +#ifdef MCAST + inter_list[0].flags |= INT_MULTICAST; +#endif /* MCAST */ #ifdef USE_STREAMS_DEVICE_FOR_IF_CONFIG if ((vs = open("/dev/ip", O_RDONLY)) < 0) { @@ -394,7 +400,7 @@ create_sockets(port) maxactivefd = 0; FD_ZERO(&activefds); - + for (i = 0; i < ninterfaces; i++) { inter_list[i].fd = open_socket(&inter_list[i].sin, inter_list[i].flags & INT_BROADCAST); @@ -458,23 +464,72 @@ io_setbclient() } +#ifdef MCAST +/* + * io_multicast_add() - add multicast group address + */ +void +io_multicast_add(addr) + U_LONG addr; +{ + int fd = inter_list[0].fd; + struct ip_mreq mreq; + + if (!IN_CLASSD(addr)) + return; + /* + * enable reception of multicast packets + */ + mreq.imr_multiaddr.s_addr = addr; + mreq.imr_interface.s_addr = INADDR_ANY; + if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (char *)&mreq, sizeof(mreq)) == -1) + syslog(LOG_ERR, "setsockopt IP_ADD_MEMBERSHIP fails: %m"); +} +#endif /* MCAST */ + + /* * io_unsetbclient - close the broadcast client sockets */ void io_unsetbclient() { - int i; + int i; for (i = 1; i < ninterfaces; i++) { if (!(inter_list[i].flags & INT_BCASTOPEN)) continue; close_socket(inter_list[i].bfd); inter_list[i].flags &= ~INT_BCASTOPEN; - } + } } +#ifdef MCAST +/* + * io_multicast_del() - delete multicast group address + */ +void +io_multicast_del(addr) + U_LONG addr; +{ + int fd = inter_list[0].fd; + struct ip_mreq mreq; + + if (!IN_CLASSD(addr)) + return; + /* + * disable reception of multicast packets + */ + mreq.imr_multiaddr.s_addr = addr; + mreq.imr_interface.s_addr = INADDR_ANY; + if (setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, + (char *)&mreq, sizeof(mreq)) == -1) + syslog(LOG_ERR, "setsockopt IP_DROP_MEMBERSHIP fails: %m"); +} +#endif /* MCAST */ + /* * open_socket - open a socket, returning the file descriptor @@ -510,7 +565,8 @@ open_socket(addr, bcast) */ if (bind(fd, (struct sockaddr *)addr, sizeof(*addr)) < 0) { char buff[160]; - sprintf(buff, "bind() fd %d, family %d, port %d, addr %08x, bcast=%d fails: %%m", + sprintf(buff, + "bind() fd %d, family %d, port %d, addr %08x, bcast=%d fails: %%m", fd, addr->sin_family, addr->sin_port, @@ -557,6 +613,19 @@ Need non blocking I/O syslog(LOG_ERR, "setsockopt SO_REUSEADDR off fails: %m"); } +#ifdef MCAST + /* for the moment we use the bcast option to set multicast ttl */ + + if (bcast) { + unsigned char mttl = 127; + + /* set the multicast ttl for outgoing packets */ + if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, + &mttl, sizeof(mttl)) == -1) { + syslog(LOG_ERR, "setsockopt IP_MULTICAST_TTL fails: %m"); + } + } +#endif /* MCAST */ #ifdef SO_BROADCAST /* if this interface can support broadcast, set SO_BROADCAST */ @@ -566,7 +635,7 @@ Need non blocking I/O syslog(LOG_ERR, "setsockopt(SO_BROADCAST): %m"); } } -#endif +#endif /* SO_BROADCAST */ #ifdef DEBUG if (debug > 1) @@ -608,7 +677,7 @@ struct interface * findbcastinter(addr) struct sockaddr_in *addr; { -#ifdef SIOCGIFCONF +#ifdef SIOCGIFCONF register int i; register U_LONG netnum; @@ -622,7 +691,7 @@ findbcastinter(addr) == (netnum & NSRCADR(&inter_list[i].mask))) return &inter_list[i]; } -#endif +#endif /* SIOCGIFCONF */ return any_interface; } @@ -744,7 +813,7 @@ sendpkt(dest, inter, pkt, len) #ifdef DEBUG if (debug) - printf("sendpkt(%s, %s, %d)\n", ntoa(dest), + printf("sendpkt(fd=%d %s, %s, %d)\n", inter->fd, ntoa(dest), ntoa(&inter->sin), len); #endif @@ -902,11 +971,16 @@ again: } if (FD_ISSET(fd, &fds)) { 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 packet. */ + + if (!(free_recvbufs && i == 0 && + inter_list[i].flags & INT_MULTICAST)) { + #ifdef UDP_WILDCARD_DELIVERY /* * these guys manage to put properly addressed packets into the wildcard queue @@ -932,6 +1006,7 @@ again: packets_dropped++; continue; } + } rb = freelist; freelist = rb->next; @@ -958,7 +1033,7 @@ again: if (debug) printf("input_handler: fd=%d length %d\n", fd, rb->recv_length); #endif - + /* * Got one. Mark how and when it got here, * put it on the full list and do bookkeeping. diff --git a/usr.sbin/xntpd/xntpd/ntp_loopfilter.c b/usr.sbin/xntpd/xntpd/ntp_loopfilter.c index e0411faca20c..61332b9b6384 100644 --- a/usr.sbin/xntpd/xntpd/ntp_loopfilter.c +++ b/usr.sbin/xntpd/xntpd/ntp_loopfilter.c @@ -92,17 +92,14 @@ #define RSH_DRIFT_TO_FRAC (CLOCK_DSCALE - 16) #define RSH_DRIFT_TO_ADJ (RSH_DRIFT_TO_FRAC - CLOCK_ADJ) #define RSH_FRAC_TO_FREQ (CLOCK_FREQ + CLOCK_ADJ - RSH_DRIFT_TO_FRAC) +#define PPS_MAXAGE 120 /* pps signal timeout (s) */ +#define PPS_MAXUPDATE 600 /* pps update timeout (s) */ /* - * Imported from the ntp_proto module + * Program variables */ -extern u_char sys_stratum; -extern s_fp sys_rootdelay; -extern u_fp sys_rootdispersion; -extern s_char sys_precision; - l_fp last_offset; /* last adjustment done */ -static LONG clock_adjust; /* clock adjust register (fraction only) */ +static LONG clock_adjust; /* clock adjust (fraction only) */ s_fp drift_comp; /* drift compensation register */ static s_fp max_comp; /* drift limit imposed by max host clock slew */ @@ -111,11 +108,15 @@ static s_fp max_comp; /* drift limit imposed by max host clock slew */ static U_LONG tcadj_time; /* last time-constant adjust time */ U_LONG watchdog_timer; /* watchdog timer, in seconds */ -static int first_adjustment; /* set to 1 if waiting for first adjustment */ +static int first_adjustment; /* 1 if waiting for first adjustment */ static int tc_counter; /* time-constant hold counter */ - int pll_control; /* set nonzero if pll implemented in kernel */ - int pps_control; /* set nonzero if pps signal valid */ +static l_fp pps_offset; /* filtered pps offset */ +static u_fp pps_dispersion; /* pps dispersion */ +static U_LONG pps_time; /* last pps sample time */ + + int pps_control; /* true if working pps signal */ + int pll_control; /* true if working kernel pll */ static l_fp pps_delay; /* pps tuning offset */ U_LONG pps_update; /* last pps update time */ int fdpps = -1; /* pps file descriptor */ @@ -151,8 +152,7 @@ static l_fp pps_delay; /* pps tuning offset */ ( i == 300 ? B300 : 0 )))))))) #define PPS_BAUD B38400 /* default serial port speed */ -#define PPS_MAXAGE 120 /* seconds after which we disbelieve pps */ -#define PPS_MAXUPDATE 600 /* seconds after which we disbelieve timecode */ +timecode */ #define PPS_DEV "/dev/pps" /* pps port */ #define PPS_FAC 3 /* pps shift (log2 trimmed samples) */ #define PPS_TRIM 6 /* samples trimmed from median filter */ @@ -163,18 +163,24 @@ static l_fp pps_delay; /* pps tuning offset */ static struct refclockio io; /* given to the I/O handler */ static int pps_baud; /* baud rate of PPS line */ #endif /* PPSCLK */ -static l_fp pps_offset; /* filtered pps offset */ -static u_fp pps_maxd; /* pps dispersion */ -static U_LONG pps_time; /* last pps sample time */ static U_LONG nsamples; /* number of pps samples collected */ static LONG samples[NPPS]; /* median filter for pps samples */ + +#endif /* PPS || PPSCLK || PPSPPS */ + +/* + * Imported from the ntp_proto module + */ +extern u_char sys_stratum; +extern s_fp sys_rootdelay; +extern u_fp sys_rootdispersion; +extern s_char sys_precision; + /* * Imported from ntp_io.c */ extern struct interface *loopback_interface; -#endif /* PPS || PPSCLK || PPSPPS */ - /* * Imported from ntpd module */ @@ -189,9 +195,15 @@ extern U_LONG current_time; /* like it says, in seconds */ * sys_poll and sys_refskew are set here */ extern u_char sys_poll; /* log2 of system poll interval */ +extern u_char sys_leap; /* system leap bits */ extern l_fp sys_refskew; /* accumulated skew since last update */ extern u_fp sys_maxd; /* max dispersion of survivor list */ +/* + * Imported from leap module + */ +extern u_char leapbits; /* sanitized leap bits */ + /* * Function prototypes */ @@ -203,10 +215,13 @@ static void pps_receive P((struct recvbuf *)); #endif /* PPS || PPSCLK || PPSPPS */ #if defined(KERNEL_PLL) +#define MOD_BITS (MOD_OFFSET | MOD_MAXERROR | MOD_ESTERROR | \ + MOD_STATUS | MOD_TIMECONST) extern int sigvec P((int, struct sigvec *, struct sigvec *)); extern int syscall P((int, void *, ...)); void pll_trap P((void)); +static int pll_status; /* status bits for kernel pll */ static struct sigvec sigsys; /* current sigvec status */ static struct sigvec newsigsys; /* new sigvec status */ #endif /* KERNEL_PLL */ @@ -398,7 +413,7 @@ local_clock(fp_offset, peer) #ifdef DEBUG if (debug > 1) - printf("local_clock(%s, %s)\n", lfptoa(fp_offset, 9), + printf("local_clock(%s, %s)\n", lfptoa(fp_offset, 6), ntoa(&peer->srcadr)); #endif @@ -431,33 +446,26 @@ local_clock(fp_offset, peer) last_offset = *fp_offset; /* - * If the magnitude of the offset is greater than CLOCK.MAX, step - * the time and reset the registers. + * If the magnitude of the offset is greater than CLOCK.MAX, + * step the time and reset the registers. */ if (tmp_ui > CLOCK_MAX_I || (tmp_ui == CLOCK_MAX_I && (U_LONG)tmp_uf >= (U_LONG)CLOCK_MAX_F)) { if (watchdog_timer < CLOCK_MINSTEP) { /* Mustn't step yet, pretend we adjusted. */ -#ifdef SLEWALWAYS syslog(LOG_INFO, - "adjust: SLEW dropped (%s offset %s)\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); -#else - syslog(LOG_INFO, - "adjust: STEP dropped (%s offset %s)\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); -#endif + "clock correction %s too large (ignored)\n", + lfptoa(fp_offset, 6)); return (0); } + syslog(LOG_NOTICE, "clock reset (%s) %s\n", #ifdef SLEWALWAYS - syslog(LOG_NOTICE, " ** adjust: SLEW %s offset %s **\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); + "slew", #else - syslog(LOG_NOTICE, " ** adjust: STEP %s offset %s **\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); + "step", #endif + lfptoa(fp_offset, 6)); step_systime(fp_offset); - clock_adjust = 0; watchdog_timer = 0; first_adjustment = 1; @@ -479,21 +487,24 @@ local_clock(fp_offset, peer) * The time constant update goes after adjust and skew updates, * as in appendix G. */ -#if defined(PPS) || defined(PPSCLK) || defined(PPSPPS) /* * If pps samples are valid, update offset, root delay and - * root dispersion. This may be a dramatic surprise to high- - * stratum clients, since all of a sudden this server looks - * like a stratum-1 clock. + * root dispersion. Also, set the system stratum to 1, even if + * the source of approximate time runs at a higher stratum. This + * may be a dramatic surprise to high-stratum clients, since all + * of a sudden this server looks like a stratum-1 clock. */ if (pps_control) { last_offset = pps_offset; - sys_maxd = pps_maxd; + sys_maxd = pps_dispersion; sys_stratum = 1; sys_rootdelay = 0; - sys_rootdispersion = pps_maxd; + offset = LFPTOFP(&pps_offset); + if (offset < 0) + offset = -offset; + sys_rootdispersion = offset + pps_dispersion; } -#endif /* PPS || PPSCLK || PPSPPS */ + offset = last_offset.l_f; /* * The pll_control is active when the phase-lock code is @@ -504,42 +515,56 @@ local_clock(fp_offset, peer) * know the scaling of the frequency variable (s_fp) is the * same as the kernel variable (1 << SHIFT_USEC = 16). * + * For kernels with the PPS discipline, the current offset and + * dispersion are set from kernel variables to maintain + * beauteous displays, but don't do much of anything. + * * In the case of stock kernels the phase-lock loop is * implemented the hard way and the clock_adjust and drift_comp * computed as required. */ - offset = last_offset.l_f; if (pll_control) { #if defined(KERNEL_PLL) - ntv.mode = ADJ_OFFSET | ADJ_TIMECONST | ADJ_MAXERROR | - ADJ_ESTERROR; + memset((char *)&ntv, 0, sizeof ntv); + ntv.modes = MOD_BITS; if (offset >= 0) { TSFTOTVU(offset, ntv.offset); } else { TSFTOTVU(-offset, ntv.offset); ntv.offset = -ntv.offset; } - ntv.maxerror = sys_rootdispersion + sys_rootdelay / 2; - ntv.esterror = sys_rootdispersion; - ntv.time_constant = time_constant; - ntv.shift = 0; + TSFTOTVU(sys_rootdispersion + sys_rootdelay / 2, ntv.maxerror); + TSFTOTVU(sys_rootdispersion, ntv.esterror); + ntv.status = pll_status; + if (pps_update) + ntv.status |= STA_PPSTIME; + if (sys_leap & LEAP_ADDSECOND && + sys_leap & LEAP_DELSECOND) + ntv.status |= STA_UNSYNC; + else if (sys_leap & LEAP_ADDSECOND) + ntv.status |= STA_INS; + else if (sys_leap & LEAP_DELSECOND) + ntv.status |= STA_DEL; + ntv.constant = time_constant; (void)ntp_adjtime(&ntv); - drift_comp = ntv.frequency; - if (ntv.shift != 0) { - char buf[128]; - (void) sprintf(buf, "pps_freq=%s", fptoa(ntv.ybar, 3)); - set_sys_var(buf, strlen(buf)+1, RO|DEF); - (void) sprintf(buf, "pps_disp=%s", fptoa(ntv.disp, 3)); - set_sys_var(buf, strlen(buf)+1, RO|DEF); - (void) sprintf(buf, "pps_interval=%ld",1 << ntv.shift); - set_sys_var(buf, strlen(buf)+1, RO); - (void) sprintf(buf, "pps_intervals=%ld", ntv.calcnt); - set_sys_var(buf, strlen(buf)+1, RO); - (void) sprintf(buf, "pps_jitterexceeded=%ld", ntv.jitcnt); - set_sys_var(buf, strlen(buf)+1, RO); - (void) sprintf(buf, "pps_dispersionexceeded=%ld", ntv.discnt); - set_sys_var(buf, strlen(buf)+1, RO); - } + drift_comp = ntv.freq; + if (ntv.status & STA_PPSTIME && ntv.status & STA_PPSSIGNAL + && ntv.shift) { + if (ntv.offset >= 0) { + TVUTOTSF(ntv.offset, offset); + } else { + TVUTOTSF(-ntv.offset, offset); + offset = -offset; + } + pps_offset.l_i = pps_offset.l_f = 0; + M_ADDF(pps_offset.l_i, pps_offset.l_f, offset); + TVUTOTSF(ntv.jitter, tmp); + pps_dispersion = (tmp >> 16) & 0xffff; + pps_time = current_time; + record_peer_stats(&loopback_interface->sin, + ctlsysstatus(), &pps_offset, 0, pps_dispersion); + } else + pps_time = 0; #endif /* KERNEL_PLL */ } else { if (offset < 0) { @@ -549,21 +574,14 @@ local_clock(fp_offset, peer) } /* - * Calculate the new frequency error. The factor given in the - * spec gives the adjustment per 2**CLOCK_ADJ seconds, but we - * want it as a (scaled) pure ratio, so we include that factor - * now and remove it later. + * Calculate the new frequency error. The factor given + * in the spec gives the adjustment per 2**CLOCK_ADJ + * seconds, but we want it as a (scaled) pure ratio, so + * we include that factor now and remove it later. */ if (first_adjustment) { first_adjustment = 0; } else { - /* - * Clamp the integration interval to maxpoll. - * The bitcounting in Section 5 gives (n+1)-6 for 2**n, - * but has a factor 2**6 missing from CLOCK_FREQ. - * We make 2**n give n instead. If watchdog_timer is - * zero, pretend it's one. - */ tmp = peer->maxpoll; tmp_uf = watchdog_timer; if (tmp_uf == 0) @@ -574,10 +592,11 @@ local_clock(fp_offset, peer) } /* - * We apply the frequency scaling at the same time as - * the sample interval; this ensures a safe right-shift. - * (as long as it keeps below 31 bits, which current - * parameters should ensure. + * We apply the frequency scaling at the same + * time as the sample interval; this ensures a + * safe right-shift. (as long as it keeps below + * 31 bits, which current parameters should + * ensure. */ tmp = (RSH_FRAC_TO_FREQ - tmp) + time_constant + time_constant; @@ -597,7 +616,9 @@ local_clock(fp_offset, peer) /* * Determine when to adjust the time constant and poll interval. */ - if (current_time - tcadj_time >= (1 << sys_poll)) { + if (pps_control) + time_constant = 0; + else if (current_time - tcadj_time >= (1 << sys_poll) && !pps_control) { tcadj_time = current_time; tmp = offset; if (tmp < 0) @@ -623,8 +644,8 @@ local_clock(fp_offset, peer) #ifdef DEBUG if (debug > 1) printf("adj %s, drft %s, tau %3i\n", - mfptoa((clock_adjust<0?-1:0), clock_adjust, 9), - fptoa(drift_comp, 9), time_constant); + mfptoa((clock_adjust<0?-1:0), clock_adjust, 6), + fptoa(drift_comp, 6), time_constant); #endif /* DEBUG */ (void) record_loop_stats(&last_offset, &drift_comp, time_constant); @@ -678,20 +699,20 @@ adj_host_clock() } } #endif /* PPSPPS */ - if (pps_time != 0 && current_time - pps_time > PPS_MAXAGE) - pps_time = 0; - if (pps_update != 0 && current_time - pps_update > PPS_MAXUPDATE) - pps_update = 0; - if (pps_time != 0 && pps_update != 0) { +#endif /* PPS || PPSCLK || PPSPPS */ + if (pps_time && current_time - pps_time > PPS_MAXAGE) + pps_time = 0; + if (pps_update && current_time - pps_update > PPS_MAXUPDATE) + pps_update = 0; + if (pps_time && pps_update) { if (!pps_control) - syslog(LOG_INFO, "pps synch"); + syslog(LOG_INFO, "PPS synch"); pps_control = 1; } else { if (pps_control) - syslog(LOG_INFO, "pps synch lost"); + syslog(LOG_INFO, "PPS synch lost"); pps_control = 0; } -#endif /* PPS || PPSCLK || PPSPPS */ /* * Resist the following code if the phase-lock loop has been @@ -738,24 +759,27 @@ loop_config(item, lfp_value, int_value) tmp = LFPTOFP(lfp_value); if (tmp >= max_comp || tmp <= -max_comp) { syslog(LOG_ERR, - "loop_config: skew compensation %s too large", + "loop_config: frequency offset %s in ntp.conf file is too large", fptoa(tmp, 5)); } else { - char var[40]; - drift_comp = tmp; #if defined(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. + * 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. */ pll_control = 1; - ntv.mode = ADJ_FREQUENCY | ADJ_STATUS | ADJ_TIMECONST; - ntv.status = TIME_BAD; - ntv.time_constant = time_constant; - ntv.frequency = drift_comp; + pll_status = STA_PLL | STA_PPSFREQ; + ntv.modes = MOD_BITS | MOD_FREQUENCY; + ntv.offset = 0; + ntv.freq = drift_comp; + ntv.maxerror = NTP_MAXDISPERSE; + ntv.esterror = NTP_MAXDISPERSE; + ntv.status = pll_status | STA_UNSYNC; + ntv.constant = time_constant; newsigsys.sv_handler = pll_trap; newsigsys.sv_mask = 0; newsigsys.sv_flags = 0; @@ -766,17 +790,13 @@ loop_config(item, lfp_value, int_value) if ((sigvec(SIGSYS, &sigsys, (struct sigvec *)NULL))) syslog(LOG_ERR, "sigvec() fails to restore SIGSYS trap: %m\n"); - syslog(LOG_NOTICE, - "%susing kernel phase-lock loop", - (pll_control) ? "" : "Not "); - (void)sprintf(var, "kernel_pll=%s", pll_control ? "true" : "false"); - - set_sys_var(var, strlen(var)+1, RO); - -#if DEBUG - if (debug) - printf("pll_control %d\n", pll_control); -#endif + if (pll_control) + syslog(LOG_NOTICE, + "using kernel phase-lock loop %04x", + ntv.status); + else + syslog(LOG_NOTICE, + "using xntpd phase-lock loop"); #endif /* KERNEL_PLL */ } @@ -834,7 +854,7 @@ loop_config(item, lfp_value, int_value) * _trap - trap processor for undefined syscalls * * This nugget is called by the kernel when the SYS_ntp_adjtime() - * syscall bombs because the silly thing has not been implemented int + * syscall bombs because the silly thing has not been implemented in * the kernel. In this case the phase-lock loop is emulated by * the stock adjtime() syscall and a lot of indelicate abuse. */ @@ -900,8 +920,9 @@ int pps_sample(tsr) /* * Note the seconds offset is already in the low-order timestamp - * doubleword, so all we have to do is sign-extend and invert it. - * The resulting offset is believed only if within CLOCK_MAX. + * doubleword, so all we have to do is sign-extend and invert + * it. The resulting offset is believed only if within + * CLOCK_MAX. */ ts = *tsr; lftemp.l_i = lftemp.l_f = 0; @@ -957,21 +978,14 @@ int pps_sample(tsr) } lftemp.l_i = 0; lftemp.l_f = sort[NPPS-1-PPS_TRIM] - sort[PPS_TRIM]; - pps_maxd = LFPTOFP(&lftemp); - lftemp.l_i = 0; - lftemp.l_f = sort[NPPS-1] - sort[0]; - utemp = LFPTOFP(&lftemp); + pps_dispersion = LFPTOFP(&lftemp); #ifdef DEBUG if (debug) printf("pps_filter: %s %s %s\n", lfptoa(&pps_delay, 6), lfptoa(&pps_offset, 6), lfptoa(&lftemp, 5)); #endif /* DEBUG */ - /* - * Note the peerstats file will contain the gross dispersion in - * the delay field. Temporaty hack. - */ record_peer_stats(&loopback_interface->sin, ctlsysstatus(), - &pps_offset, utemp, pps_maxd); + &pps_offset, 0, pps_dispersion); return (0); } #endif /* PPS || PPSCLK || PPSPPS */ diff --git a/usr.sbin/xntpd/xntpd/ntp_peer.c b/usr.sbin/xntpd/xntpd/ntp_peer.c index cadd415346a9..9d8ec35dee78 100644 --- a/usr.sbin/xntpd/xntpd/ntp_peer.c +++ b/usr.sbin/xntpd/xntpd/ntp_peer.c @@ -340,22 +340,24 @@ unpeer(peer_to_remove) * peer_config - configure a new peer */ struct peer * -peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) +peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, flags, ttl, key) struct sockaddr_in *srcadr; struct interface *dstadr; int hmode; int version; int minpoll; int maxpoll; - U_LONG key; int flags; + int ttl; + U_LONG key; { register struct peer *peer; #ifdef DEBUG if (debug) - printf("peer_config: addr %s mode %d version %d minpoll %d maxpoll %d key %u\n", - ntoa(srcadr), hmode, version, minpoll, maxpoll, key); + printf("peer_config: addr %s mode %d version %d minpoll %d maxpoll %d flags %d ttl %d key %u\n", + ntoa(srcadr), hmode, version, minpoll, maxpoll, flags, + ttl, key); #endif /* * See if we have this guy in the tables already. If @@ -387,6 +389,7 @@ peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) peer->ppoll = peer->minpoll; peer->flags = ((u_char)(flags|FLAG_CONFIG)) |(peer->flags & (FLAG_REFCLOCK|FLAG_DEFBDELAY)); + peer->ttl = (u_char)ttl; peer->keyid = key; return peer; } @@ -395,7 +398,8 @@ peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) * If we're here this guy is unknown to us. Make a new peer * structure for him. */ - peer = newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, key); + peer = newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, + ttl, key); if (peer != 0) peer->flags |= (u_char)(flags|FLAG_CONFIG); return peer; @@ -406,13 +410,14 @@ peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) * newpeer - initialize a new peer association */ struct peer * -newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, key) +newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, ttl, key) struct sockaddr_in *srcadr; struct interface *dstadr; int hmode; int version; int minpoll; int maxpoll; + int ttl; U_LONG key; { register struct peer *peer; @@ -454,13 +459,10 @@ newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, key) peer->maxpoll = (u_char)maxpoll; peer->hpoll = peer->minpoll; peer->ppoll = peer->minpoll; + peer->ttl = ttl; peer->keyid = key; - - if (hmode == MODE_BCLIENT) { - peer->estbdelay = sys_bdelay; - peer->flags |= FLAG_DEFBDELAY; - } - + peer->estbdelay = sys_bdelay; + peer->flags |= FLAG_DEFBDELAY; peer->leap = LEAP_NOTINSYNC; peer->precision = DEFPRECISION; peer->dispersion = NTP_MAXDISPERSE; diff --git a/usr.sbin/xntpd/xntpd/ntp_proto.c b/usr.sbin/xntpd/xntpd/ntp_proto.c index d71550da24d4..a3f744eae881 100644 --- a/usr.sbin/xntpd/xntpd/ntp_proto.c +++ b/usr.sbin/xntpd/xntpd/ntp_proto.c @@ -48,8 +48,7 @@ U_LONG sys_unknownversion; /* don't know version packets */ U_LONG sys_badlength; /* packets with bad length */ U_LONG sys_processed; /* packets processed */ U_LONG sys_badauth; /* packets dropped because of authorization */ -U_LONG sys_wanderhold; /* sys_peer held to prevent wandering */ -U_LONG sys_limitrejected; /* pkts rejected due toclient count per net */ +U_LONG sys_limitrejected; /* pkts rejected due toclient count per net */ /* * Imported from ntp_timer.c @@ -91,7 +90,8 @@ transmit(peer) struct pkt xpkt; /* packet to send */ U_LONG peer_timer; - if (peer->hmode != MODE_BCLIENT) { + if ((peer->hmode != MODE_BROADCAST && peer->hmode != MODE_BCLIENT) || + (peer->hmode == MODE_BROADCAST && sys_leap != LEAP_NOTINSYNC)) { U_LONG xkeyid; /* @@ -240,17 +240,14 @@ transmit(peer) /* * Finally, adjust the hpoll variable for special conditions. */ - if (peer->flags & FLAG_SYSPEER && peer->hpoll > sys_poll) { - /* clamp it */ + if (peer->hmode == MODE_BCLIENT) + peer->hpoll = peer->ppoll; + else if (peer->flags & FLAG_SYSPEER && + peer->hpoll > sys_poll) peer->hpoll = max(peer->minpoll, sys_poll); - } - if (peer->hmode == MODE_BROADCAST || peer->hmode == MODE_BCLIENT) { - /* clamp it */ - peer->hpoll = peer->minpoll; - } /* - * Arrange for our next time out. hpoll will be less than + * Arrange for our next timeout. hpoll will be less than * maxpoll for sure. */ if (peer->event_timer.next != 0) @@ -263,37 +260,6 @@ transmit(peer) TIMER_ENQUEUE(timerqueue, &peer->event_timer); } -#if 0 -static void -ct_die(after) -{ - syslog(LOG_ERR, "timers garbled (%s)", after?"after":"before"); - abort(); -} - -void -check_timers(after) -{ - register int i; - register struct event *p, *q; - - for (i = 0; i < TIMER_NSLOTS; i++) { - p = &timerqueue[i]; - if (p->event_time != 0) - ct_die(after); - do { - q = p; - if ((p = p->next) == 0) - ct_die(after); - if (p->prev != q) - ct_die(after); - } while (p->event_time != 0); - if (p != &timerqueue[i]) - ct_die(after); - } -} -#endif - /* * receive - Receive Procedure. See section 3.4.2 in the specification. */ @@ -533,6 +499,9 @@ receive(rbufp) break; case MODE_PASSIVE: +#ifdef MCAST + /* process the packet to determine the rt-delay */ +#endif /* MCAST */ case MODE_SERVER: /* * These are obvious errors. Ignore. @@ -550,8 +519,10 @@ receive(rbufp) /* * Sort of a repeat of the above... */ +/* if ((restrict & RES_NOPEER) || !sys_bclient) return; +*/ mymode = MODE_BCLIENT; break; } @@ -562,7 +533,7 @@ receive(rbufp) */ peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr, mymode, PKT_VERSION(pkt->li_vn_mode), NTP_MINDPOLL, - NTP_MAXPOLL, hiskeyid); + NTP_MAXPOLL, 0, hiskeyid); if (peer == 0) { /* * The only way this can happen is if the @@ -722,12 +693,11 @@ receive(rbufp) * out to be bad. */ peer2 = newpeer(&rbufp->recv_srcadr, - rbufp->dstadr, MODE_PASSIVE, - PKT_VERSION(pkt->li_vn_mode), - NTP_MINDPOLL, NTP_MAXPOLL, - hiskeyid); + rbufp->dstadr, MODE_PASSIVE, + PKT_VERSION(pkt->li_vn_mode), + NTP_MINDPOLL, NTP_MAXPOLL, 0, hiskeyid); if (process_packet(peer2, pkt, &rbufp->recv_time, - has_mac, trustable) == 0) { + has_mac, trustable) == 0) { /* * Strange situation. We've been receiving * broadcasts from him which we liked, but @@ -785,20 +755,21 @@ process_packet(peer, pkt, recv_ts, has_mac, trustable) sys_processed++; peer->processed++; - - peer->rec = *recv_ts; p_dist = NTOHS_FP(pkt->rootdelay); p_disp = NTOHS_FP(pkt->rootdispersion); NTOHL_FP(&pkt->rec, &p_rec); NTOHL_FP(&pkt->xmt, &p_xmt); - NTOHL_FP(&pkt->org, &p_org); + if (PKT_MODE(pkt->li_vn_mode) != MODE_BROADCAST) + NTOHL_FP(&pkt->org, &p_org); + else + p_org = peer->rec; + peer->rec = *recv_ts; peer->flash = 0; randomize = POLL_RANDOMCHANGE; /* * Test for old or duplicate packets (tests 1 through 3). */ - if (L_ISHIS(&peer->org, &p_xmt)) /* count old packets */ peer->oldpkt++; if (L_ISEQU(&peer->org, &p_xmt)) /* test 1 */ @@ -812,6 +783,9 @@ process_packet(peer, pkt, recv_ts, has_mac, trustable) if ((p_rec.l_ui == 0 && p_rec.l_uf == 0) || (p_org.l_ui == 0 && p_org.l_uf == 0)) peer->flash |= TEST3; /* unsynchronized */ + } else { + if (p_org.l_ui == 0 && p_org.l_uf == 0) + peer->flash |= TEST3; /* unsynchronized */ } peer->org = p_xmt; /* reuse byte-swapped pkt->xmt */ peer->ppoll = pkt->ppoll; @@ -917,39 +891,23 @@ process_packet(peer, pkt, recv_ts, has_mac, trustable) ci.l_ui = t10_ui; ci.l_uf = t10_uf; ei = (FP_SECOND >> (-(int)sys_precision)); - if (peer->hmode == MODE_BCLIENT) { -#ifdef notdef - if (PKT_MODE(pkt->li_vn_mode) == MODE_CLIENT) { - /* - * A client mode packet, used for delay computation. - * Give the data to the filter. - */ - bdelay_filter(peer, t23_ui, t23_uf, t10_ui, t10_uf); - } -#endif - M_ADDUF(ci.l_ui, ci.l_uf, peer->estbdelay>>1); + + /* + * If broadcast mode, time of last reception has been fiddled + * to p_org, rather than originate timestamp. We use this to + * augment dispersion and previously calcuated estbdelay as + * the delay. We know NTP_SKEWFACTOR == 16, which accounts for + * the simplified ei calculation. + */ + if (PKT_MODE(pkt->li_vn_mode) == MODE_BROADCAST) { + M_ADDUF(ci.l_ui, ci.l_uf, peer->estbdelay >> 1); di = MFPTOFP(0, peer->estbdelay); + ei += peer->rec.l_ui - p_org.l_ui; } else { M_ADD(ci.l_ui, ci.l_uf, t23_ui, t23_uf); M_RSHIFT(ci.l_i, ci.l_uf); - - /* - * Calculate di in t23 in full precision, then truncate - * to an s_fp. - */ M_SUB(t23_ui, t23_uf, t10_ui, t10_uf); di = MFPTOFP(t23_ui, t23_uf); - /* - * Calculate (t3 - t0) in t23 in full precision, convert - * to single, shift down by MAXSKEW and add to ei. - * We know NTP_SKEWFACTOR == 16 - */ -#if 0 - t23_ui = peer->rec.l_ui; /* peer->rec == t0 */ - t23_uf = peer->rec.l_uf; - M_SUB(t23_ui, t23_uf, p_org.l_ui, p_org.l_uf); /*pkt->org==t3*/ - ei += (MFPTOFP(t23_ui, t23_uf) >> NTP_SKEWFACTOR); -#endif ei += peer->rec.l_ui - p_org.l_ui; } #ifdef DEBUG @@ -1073,9 +1031,7 @@ clock_update(peer) if (d < 0) d = -d; sys_rootdelay = peer->rootdelay + d; - sys_maxd = peer->dispersion; - if (peer->flags & FLAG_PREFER) - sys_maxd += peer->selectdisp; + sys_maxd = peer->dispersion + peer->selectdisp; d = peer->soffset; if (d < 0) d = -d; @@ -1171,7 +1127,7 @@ poll_update(peer, new_hpoll, randomize) * Catch reference clocks here. The polling interval for a * reference clock is fixed and needn't be maintained by us. */ - if (peer->flags & FLAG_REFCLOCK) + if (peer->flags & FLAG_REFCLOCK || peer->hmode == MODE_BROADCAST) return; /* @@ -1193,7 +1149,9 @@ poll_update(peer, new_hpoll, randomize) * less that peer.timer, update peer.timer. */ oldpoll = peer->hpoll; - if ((peer->flags & FLAG_SYSPEER) && new_hpoll > sys_poll) + if (peer->hmode == MODE_BCLIENT) + peer->hpoll = peer->ppoll; + else if ((peer->flags & FLAG_SYSPEER) && new_hpoll > sys_poll) peer->hpoll = max(peer->minpoll, sys_poll); else { if (new_hpoll > peer->maxpoll) @@ -1208,10 +1166,10 @@ poll_update(peer, new_hpoll, randomize) newpoll = max((u_char)min(peer->ppoll, peer->hpoll), peer->minpoll); if (randomize == POLL_MAKERANDOM || (randomize == POLL_RANDOMCHANGE && newpoll != oldpoll)) - new_timer = (1<<(newpoll - 1)) + new_timer = (1 << (newpoll - 1)) + ranp2(newpoll - 1) + current_time; else - new_timer = (1<event_timer); if (evp->next == 0 || evp->event_time > new_timer) { TIMER_DEQUEUE(evp); @@ -1358,26 +1316,10 @@ clock_filter(peer, sample_offset, sample_delay, sample_error) /* * Find where he goes in, then shift everyone else down */ - if (peer->hmode == MODE_BCLIENT) { - register s_fp *soffsetp; - /* - * Sort by offset. The most positive offset - * should correspond to the minimum delay. - */ - soffsetp = peer->filter_soffset; - for (i = 0; i < NTP_SHIFT-1; i++) - if (errorp[ord[i]] >= NTP_MAXDISPERSE - || sample_soffset >= soffsetp[ord[i]]) - break; - } else { - /* - * Sort by distance. - */ - for (i = 0; i < NTP_SHIFT-1; i++) - if (errorp[ord[i]] >= NTP_MAXDISPERSE - || sample_distance <= distance[ord[i]]) - break; - } + for (i = 0; i < NTP_SHIFT-1; i++) + if (errorp[ord[i]] >= NTP_MAXDISPERSE + || sample_distance <= distance[ord[i]]) + break; for (j = NTP_SHIFT-1; j > i; j--) ord[j] = ord[j-1]; @@ -1692,7 +1634,7 @@ clock_select() if (d < 0) d = -d; sdisp += d; - sdisp = ((sdisp>>1) + sdisp) >> 1; + sdisp = ((sdisp >> 1) + sdisp) >> 1; } peer_list[i]->selectdisp = sdisp; if (sdisp > maxd) { @@ -1745,9 +1687,7 @@ clock_select() for (i = 1; i < nlist; i++) if (peer_list[i] == sys_peer) break; - if (i < nlist) - sys_wanderhold++; - else + if (i >= nlist) sys_peer = peer_list[0]; } @@ -2080,7 +2020,6 @@ init_proto() sys_unknownversion = 0; sys_processed = 0; sys_badauth = 0; - sys_wanderhold = 0; syslog(LOG_NOTICE, "default precision is initialized to 2**%d", sys_precision); } @@ -2092,7 +2031,7 @@ init_proto() void proto_config(item, value) int item; - LONG value; + U_LONG value; { /* * Figure out what he wants to change, then do it @@ -2103,11 +2042,33 @@ proto_config(item, value) * Turn on/off facility to listen to broadcasts */ sys_bclient = (int)value; - if (sys_bclient) + if (value) io_setbclient(); else io_unsetbclient(); break; + + case PROTO_MULTICAST_ADD: + /* + * Add multicast group address + */ + if (!sys_bclient) { + sys_bclient = 1; + io_setbclient(); + } +#ifdef MCAST + io_multicast_add(value); +#endif /* MCAST */ + break; + + case PROTO_MULTICAST_DEL: + /* + * Delete multicast group address + */ +#ifdef MCAST + io_multicast_del(value); +#endif /* MCAST */ + break; case PROTO_PRECISION: /* @@ -2120,7 +2081,7 @@ proto_config(item, value) /* * Set default broadcast delay */ - sys_bdelay = (((U_LONG)value) + 0x00000800) & 0xfffff000; + sys_bdelay = ((value) + 0x00000800) & 0xfffff000; break; case PROTO_AUTHENTICATE: @@ -2136,23 +2097,7 @@ proto_config(item, value) * Provide an authentication delay value. Round it to * the microsecond. This is crude. */ - sys_authdelay = (((U_LONG)value) + 0x00000800) & 0xfffff000; - break; - - case PROTO_MAXSKEW: - /* - * Set the maximum skew value - */ - syslog(LOG_ERR, - "proto_config: attempt to set maxskew (obsolete)"); - break; - - case PROTO_SELECT: - /* - * Set the selection algorithm. - */ - syslog(LOG_ERR, - "proto_config: attempt to set selection algorithm (obsolete)"); + sys_authdelay = ((value) + 0x00000800) & 0xfffff000; break; default: @@ -2179,7 +2124,6 @@ proto_clr_stats() sys_badlength = 0; sys_processed = 0; sys_badauth = 0; - sys_wanderhold = 0; sys_stattime = current_time; sys_limitrejected = 0; } diff --git a/usr.sbin/xntpd/xntpd/ntp_refclock.c b/usr.sbin/xntpd/xntpd/ntp_refclock.c index 5199a1acbd26..2cb7cc29d9a4 100644 --- a/usr.sbin/xntpd/xntpd/ntp_refclock.c +++ b/usr.sbin/xntpd/xntpd/ntp_refclock.c @@ -93,17 +93,6 @@ refclock_newpeer(peer) peer->stratum = STRATUM_REFCLOCK; peer->ppoll = peer->minpoll; peer->hpoll = peer->minpoll; - peer->maxpoll = peer->minpoll; - - /* - * Check the flags. If the peer is configured in client mode - * but prefers the broadcast client filter algorithm, change - * him over. - */ - if (peer->hmode == MODE_CLIENT - && refclock_conf[clktype]->clock_flags & REF_FLAG_BCLIENT) - peer->hmode = MODE_BCLIENT; - peer->event_timer.peer = peer; peer->event_timer.event_handler = refclock_transmit; @@ -201,20 +190,14 @@ refclock_transmit(peer) l_fp off; - if (peer->valid > 0) peer->valid--; - if (peer->hpoll > peer->minpoll) peer->hpoll--; + if (peer->valid > 0) + peer->valid--; off.l_ui = off.l_uf = 0; clock_filter(peer, &off, 0, NTP_MAXDISPERSE); if (peer->flags & FLAG_SYSPEER) - clock_select(); - } else { - if (peer->valid < NTP_SHIFT) { - peer->valid++; - } else { - if (peer->hpoll < peer->maxpoll) - peer->hpoll++; - } - } + clock_select(); + } else if (peer->valid < NTP_SHIFT) + peer->valid++; /* * If he wants to be polled, do it. @@ -313,9 +296,6 @@ refclock_receive(peer, offset, delay, dispersion, reftime, rectime, leap) case MODE_CLIENT: peer->pmode = MODE_SERVER; break; - case MODE_BCLIENT: - peer->pmode = MODE_BROADCAST; - break; default: syslog(LOG_ERR, "refclock_receive: internal error, mode = %d", peer->hmode); diff --git a/usr.sbin/xntpd/xntpd/ntp_request.c b/usr.sbin/xntpd/xntpd/ntp_request.c index c87fdef1a475..a77669875bea 100644 --- a/usr.sbin/xntpd/xntpd/ntp_request.c +++ b/usr.sbin/xntpd/xntpd/ntp_request.c @@ -16,6 +16,12 @@ #include "ntp_if.h" #include "ntp_stdlib.h" +#ifdef KERNEL_PLL +#include +#define ntp_gettime(t) syscall(SYS_ntp_gettime, (t)) +#define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) +#endif /* KERNEL_PLL */ + /* * Structure to hold request procedure information */ @@ -56,7 +62,7 @@ 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 *, int)); +static void setclr_flags P((struct sockaddr_in *, struct interface *, struct req_pkt *, U_LONG)); static void do_monitor P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void do_nomonitor P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void list_restrict P((struct sockaddr_in *, struct interface *, struct req_pkt *)); @@ -83,13 +89,14 @@ static void set_request_keyid P((struct sockaddr_in *, struct interface *, struc 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 get_leap_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +#ifdef KERNEL_PLL +static void get_kernel_info P((struct sockaddr_in *, 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 *)); #endif /* REFCLOCK */ -static void set_maxskew P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void set_precision P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void set_select_code P((struct sockaddr_in *, struct interface *, struct req_pkt *)); #ifdef REFCLOCK static void get_clkbug_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); #endif /* REFCLOCK */ @@ -134,9 +141,10 @@ static struct req_proc xntp_codes[] = { { REQ_CONTROL_KEY, AUTH, sizeof(U_LONG), set_control_keyid }, { REQ_GET_CTLSTATS, NOAUTH, 0, get_ctl_stats }, { REQ_GET_LEAPINFO, NOAUTH, 0, get_leap_info }, - { REQ_SET_MAXSKEW, AUTH, sizeof(u_fp), set_maxskew }, { REQ_SET_PRECISION, AUTH, sizeof(LONG), set_precision }, - { REQ_SET_SELECT_CODE, AUTH, sizeof(U_LONG), set_select_code }, +#ifdef KERNEL_PLL + { REQ_GET_KERNEL, NOAUTH, 0, get_kernel_info }, +#endif /* KERNEL_PLL */ #ifdef REFCLOCK { REQ_GET_CLOCKINFO, NOAUTH, sizeof(U_LONG), get_clock_info }, { REQ_SET_CLKFUDGE, AUTH, sizeof(struct conf_fudge), set_clock_fudge }, @@ -162,6 +170,10 @@ U_LONG numresppkts; /* number of resp packets sent with data */ U_LONG errorcounter[INFO_ERR_AUTH+1]; /* lazy way to count errors, indexed */ /* by the error code */ +#ifdef KERNEL_PLL +extern int syscall P((int, void *, ...)); +#endif /* KERNEL_PLL */ + /* * Imported from the I/O module */ @@ -177,6 +189,11 @@ extern int debug; */ extern U_LONG current_time; +/* + * Imported from ntp_loopfilter.c + */ +extern int pll_control; + /* * A hack. To keep the authentication module clear of xntp-ism's, we * include a time reset variable for its stats here. @@ -657,6 +674,7 @@ peer_list_sum(srcadr, inter, inpkt) ips->delay = HTONS_FP(pp->delay); HTONL_FP(&pp->offset, &ips->offset); ips->dispersion = HTONS_FP(pp->dispersion); + pp = pp->next; ips = (struct info_peer_summary *)more_pkt(); } @@ -724,7 +742,9 @@ peer_info (srcadr, inter, inpkt) ip->valid = pp->valid; ip->reach = pp->reach; ip->unreach = pp->unreach; - ip->trust = 0; + ip->flash = pp->flash; + ip->estbdelay = htonl(pp->estbdelay); + ip->ttl = pp->ttl; ip->associd = htons(pp->associd); ip->rootdelay = HTONS_FP(pp->rootdelay); ip->rootdispersion = HTONS_FP(pp->rootdispersion); @@ -745,12 +765,10 @@ peer_info (srcadr, inter, inpkt) if (ip->order[i] >= NTP_SHIFT) ip->order[i] -= NTP_SHIFT; } - ip->delay = HTONS_FP(pp->delay); HTONL_FP(&pp->offset, &ip->offset); + ip->delay = HTONS_FP(pp->delay); ip->dispersion = HTONS_FP(pp->dispersion); - for (i = 0; i < NTP_SHIFT; i++) - ip->bdelay[i] = 0; - ip->estbdelay = htonl(pp->estbdelay); + ip->selectdisp = HTONS_FP(pp->selectdisp); ip = (struct info_peer *)more_pkt(); } flush_pkt(); @@ -882,12 +900,8 @@ sys_info(srcadr, inter, inpkt) is->flags |= INFO_FLAG_BCLIENT; if (sys_authenticate) is->flags |= INFO_FLAG_AUTHENABLE; - is->selection = 0; /* Obsolete */ - HTONL_UF(sys_bdelay, &is->bdelay); HTONL_UF(sys_authdelay, &is->authdelay); - is->maxskew = 0; - (void) more_pkt(); flush_pkt(); } @@ -915,7 +929,6 @@ sys_stats(srcadr, inter, inpkt) extern U_LONG sys_badlength; extern U_LONG sys_processed; extern U_LONG sys_badauth; - extern U_LONG sys_wanderhold; extern U_LONG sys_limitrejected; ss = (struct info_sys_stats *)prepare_pkt(srcadr, inter, inpkt, @@ -930,7 +943,6 @@ sys_stats(srcadr, inter, inpkt) ss->badlength = htonl(sys_badlength); ss->processed = htonl(sys_processed); ss->badauth = htonl(sys_badauth); - ss->wanderhold = htonl(sys_wanderhold); ss->limitrejected = htonl(sys_limitrejected); (void) more_pkt(); flush_pkt(); @@ -1168,7 +1180,7 @@ do_conf(srcadr, inter, inpkt) /* XXX W2DO? minpoll/maxpoll arguments ??? */ if (peer_config(&peeraddr, (struct interface *)0, cp->hmode, cp->version, cp->minpoll, cp->maxpoll, - cp->keyid, fl) == 0) { + fl, cp->ttl, cp->keyid) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } @@ -1253,7 +1265,7 @@ set_sys_flag(srcadr, inter, inpkt) struct interface *inter; struct req_pkt *inpkt; { - setclr_flags(srcadr, inter, inpkt, 1); + setclr_flags(srcadr, inter, inpkt, (U_LONG)1); } @@ -1266,7 +1278,7 @@ clr_sys_flag(srcadr, inter, inpkt) struct interface *inter; struct req_pkt *inpkt; { - setclr_flags(srcadr, inter, inpkt, 0); + setclr_flags(srcadr, inter, inpkt, (U_LONG)0); } @@ -1278,7 +1290,7 @@ setclr_flags(srcadr, inter, inpkt, set) struct sockaddr_in *srcadr; struct interface *inter; struct req_pkt *inpkt; - int set; + U_LONG set; { register U_LONG flags; @@ -1290,15 +1302,20 @@ setclr_flags(srcadr, inter, inpkt, set) flags = ((struct conf_sys_flags *)inpkt->data)->flags; if (flags - & ~(SYS_FLAG_BCLIENT|SYS_FLAG_AUTHENTICATE)) { + & ~(SYS_FLAG_BCLIENT | SYS_FLAG_MCLIENT | SYS_FLAG_AUTHENTICATE)) { req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } if (flags & SYS_FLAG_BCLIENT) - proto_config(PROTO_BROADCLIENT, (LONG)set); + proto_config(PROTO_BROADCLIENT, set); + if (flags & SYS_FLAG_MCLIENT) + if (set) + proto_config(PROTO_MULTICAST_ADD, INADDR_NTP); + else + proto_config(PROTO_MULTICAST_DEL, INADDR_NTP); if (flags & SYS_FLAG_AUTHENTICATE) - proto_config(PROTO_AUTHENTICATE, (LONG)set); + proto_config(PROTO_AUTHENTICATE, set); req_ack(srcadr, inter, inpkt, INFO_OKAY); } @@ -2084,6 +2101,57 @@ get_leap_info(srcadr, inter, inpkt) } +#ifdef KERNEL_PLL +/* + * get_kernel_info - get kernel pll/pps information + */ +static void +get_kernel_info(srcadr, inter, inpkt) + struct sockaddr_in *srcadr; + struct interface *inter; + struct req_pkt *inpkt; +{ + register struct info_kernel *ik; + struct timex ntx; + + if (!pll_control) + return; + memset((char *)&ntx, 0, sizeof(ntx)); + (void)ntp_adjtime(&ntx); + + ik = (struct info_kernel *)prepare_pkt(srcadr, inter, inpkt, + sizeof(struct info_kernel)); + + /* + * pll variables + */ + ik->offset = htonl(ntx.offset); + ik->freq = htonl(ntx.freq); + ik->maxerror = htonl(ntx.maxerror); + ik->esterror = htonl(ntx.esterror); + ik->status = htons(ntx.status); + ik->constant = htonl(ntx.constant); + ik->precision = htonl(ntx.precision); + ik->tolerance = htonl(ntx.tolerance); + + /* + * pps variables + */ + ik->ppsfreq = htonl(ntx.ppsfreq); + ik->jitter = htonl(ntx.jitter); + ik->shift = htons(ntx.shift); + ik->stabil = htonl(ntx.stabil); + ik->jitcnt = htonl(ntx.jitcnt); + ik->calcnt = htonl(ntx.calcnt); + ik->errcnt = htonl(ntx.errcnt); + ik->stbcnt = htonl(ntx.stbcnt); + + (void) more_pkt(); + flush_pkt(); +} +#endif /* KERNEL_PLL */ + + #ifdef REFCLOCK /* * get_clock_info - get info about a clock @@ -2208,29 +2276,6 @@ set_clock_fudge(srcadr, inter, inpkt) } #endif -/* - * set_maxskew - set the system maxskew parameter - */ -static void -set_maxskew(srcadr, inter, inpkt) - struct sockaddr_in *srcadr; - struct interface *inter; - struct req_pkt *inpkt; -{ - register u_fp maxskew; - - if (INFO_NITEMS(inpkt->err_nitems) > 1) { - req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); - return; - } - - maxskew = NTOHS_FP(*(u_fp *)(inpkt->data)); - - proto_config(PROTO_MAXSKEW, (LONG)maxskew); - req_ack(srcadr, inter, inpkt, INFO_OKAY); -} - - /* * set_precision - set the system precision */ @@ -2254,31 +2299,6 @@ set_precision(srcadr, inter, inpkt) req_ack(srcadr, inter, inpkt, INFO_OKAY); } - -/* - * set_select_code - set a select code to use - */ -static void -set_select_code(srcadr, inter, inpkt) - struct sockaddr_in *srcadr; - struct interface *inter; - struct req_pkt *inpkt; -{ - register U_LONG select_code; - - select_code = ntohl(*(U_LONG *)(inpkt->data)); - - if (INFO_NITEMS(inpkt->err_nitems) > 1 || - select_code < SELECT_1 || select_code > SELECT_5) { - req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); - return; - } - - proto_config(PROTO_SELECT, (LONG)select_code); - req_ack(srcadr, inter, inpkt, INFO_OKAY); -} - - #ifdef REFCLOCK /* * get_clkbug_info - get debugging info about a clock diff --git a/usr.sbin/xntpd/xntpd/ntp_unixclock.c b/usr.sbin/xntpd/xntpd/ntp_unixclock.c index 815e09cb7369..1950d8c06fb3 100644 --- a/usr.sbin/xntpd/xntpd/ntp_unixclock.c +++ b/usr.sbin/xntpd/xntpd/ntp_unixclock.c @@ -251,10 +251,23 @@ clock_parms(tickadj, tick) * Note that this version grovels about in /dev/kmem to determine * these values. This probably should be elsewhere. */ - -/* Define the following to be what the tick and tickadj variables are - * called in your kernel. +#if defined(SYS_UNIXWARE1) +/* + * clock_parms - return the local clock tickadj and tick parameters + * + * The values set here were determined experimentally on a 486 system + * I'm not confident in them. - RAS + * */ +static void +clock_parms(tickadj, tick) + U_LONG *tickadj; + U_LONG *tick; +{ + *tick = 10000; /* microseconds */ + *tickadj = 80; /* microseconds */ +} +#else /* SYS_UNIXWARE1 */ #if defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SYS_SVR4) || defined(SYS_PTX) #define K_TICKADJ_NAME "tickadj" @@ -373,6 +386,7 @@ clock_parms(tickadj, tick) #undef K_TICK_NAME #undef N_NAME } +#endif /* SYS_UNIXWARE1 */ #endif /* HAVE_READKMEM */ #if defined(SOLARIS)&&defined(ADJTIME_IS_ACCURATE) @@ -421,7 +435,6 @@ clock_parms(tickadj, tick) } #endif /* sgi */ - #ifdef NOKMEM #ifndef HZ diff --git a/usr.sbin/xntpd/xntpd/ntpd.c b/usr.sbin/xntpd/xntpd/ntpd.c index 6c9d640f3160..9ed43c5c4a81 100644 --- a/usr.sbin/xntpd/xntpd/ntpd.c +++ b/usr.sbin/xntpd/xntpd/ntpd.c @@ -14,7 +14,7 @@ #include #endif -#if defined(SYS_SVR4) +#if defined(SYS_SVR4) || defined (SYS_UNIXWARE1) #include #endif diff --git a/usr.sbin/xntpd/xntpd/refclock_chu.c b/usr.sbin/xntpd/xntpd/refclock_chu.c index e73229e8a383..4596db22e2f5 100644 --- a/usr.sbin/xntpd/xntpd/refclock_chu.c +++ b/usr.sbin/xntpd/xntpd/refclock_chu.c @@ -603,7 +603,7 @@ chu_receive(rbufp) * we want. */ -#ifndef NO_CHU_DEBUG +#ifdef CHU_DEBUG syslog(LOG_DEBUG, "CHU %s packet:", (chuc->chutype == CHU_YEAR)? "year":"time"); for (i=0; i < NCHUCHARS; i++) { diff --git a/usr.sbin/xntpd/xntpd/refclock_irig.c b/usr.sbin/xntpd/xntpd/refclock_irig.c index d3c2f120f52c..6167af2784ee 100644 --- a/usr.sbin/xntpd/xntpd/refclock_irig.c +++ b/usr.sbin/xntpd/xntpd/refclock_irig.c @@ -418,7 +418,9 @@ struct peer *peer; irig->hour = MULBY10(cp[4] - '0') + cp[5] - '0'; irig->minute = MULBY10(cp[7] - '0') + cp[8] - '0'; irig->second = MULBY10(cp[10] - '0') + cp[11] - '0'; - if (cp[12] != ' ') + if (cp[12] = ' ') + irig->leap = 0; + else irig->leap = LEAP_NOTINSYNC; if (irig->day < 1 || irig->day > 366) { irig->baddata++; diff --git a/usr.sbin/xntpd/xntpd/refclock_msfees.c b/usr.sbin/xntpd/xntpd/refclock_msfees.c index b301bc2ebb23..c2a882abb919 100644 --- a/usr.sbin/xntpd/xntpd/refclock_msfees.c +++ b/usr.sbin/xntpd/xntpd/refclock_msfees.c @@ -139,7 +139,7 @@ #define INH_DELAY_PPS BITS_TO_L_FP( 0, 9600) #ifndef STREAM_PP1 -#define STREAM_PP1 "ppsclockd\0<-- patch space for module name1 -->" +#define STREAM_PP1 "ppsclocd\0<-- patch space for module name1 -->" #endif #ifndef STREAM_PP2 #define STREAM_PP2 "ppsclock\0<-- patch space for module name2 -->" diff --git a/usr.sbin/xntpd/xntpd/refclock_parse.c b/usr.sbin/xntpd/xntpd/refclock_parse.c index f6ad067529ac..0d95d18908a5 100644 --- a/usr.sbin/xntpd/xntpd/refclock_parse.c +++ b/usr.sbin/xntpd/xntpd/refclock_parse.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp * - * refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp + * refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp * * generic reference clock driver for receivers * @@ -30,6 +30,8 @@ * PPS - supply loopfilter with PPS samples (if configured) * PPSPPS - notify loopfilter of PPS file descriptor * + * FREEBSD_CONRAD - Make very cheap "Conrad DCF77 RS-232" gadget work + * with FreeBSD. * TTY defines: * HAVE_BSD_TTYS - currently unsupported * HAVE_SYSV_TTYS - will use termio.h @@ -82,6 +84,9 @@ #include #include +#ifdef FREEBSD_CONRAD +#include +#endif extern int errno; #if !defined(STREAM) && !defined(HAVE_SYSV_TTYS) && !defined(HAVE_BSD_TTYS) && !defined(HAVE_TERMIOS) @@ -129,7 +134,7 @@ CURRENTLY NO BSD TTY SUPPORT #include "parse.h" #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) -static char rcsid[]="refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp"; +static char rcsid[]="refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp"; #endif /**=========================================================================== @@ -440,7 +445,12 @@ static poll_info_t wsdcf_pollinfo = { WS_POLLRATE, WS_POLLCMD, WS_CMDSIZE }; #define RAWDCF_ROOTDELAY 0x00000364 /* 13 ms */ #define RAWDCF_FORMAT "RAW DCF77 Timecode" #define RAWDCF_MAXUNSYNC (0) /* sorry - its a true receiver - no signal - no time */ + +#ifdef FREEBSD_CONRAD +#define RAWDCF_CFLAG (CS8|CREAD|CLOCAL) +#else #define RAWDCF_CFLAG (B50|CS8|CREAD|CLOCAL) +#endif #define RAWDCF_IFLAG 0 #define RAWDCF_OFLAG 0 #define RAWDCF_LFLAG 0 @@ -1482,11 +1492,22 @@ local_receive(rbufp) struct parseunit *parse = (struct parseunit *)rbufp->recv_srcclock; register int count; register char *s; +#ifdef FREEBSD_CONRAD + struct timeval foo; +#endif + /* * eat all characters, parsing then and feeding complete samples */ count = rbufp->recv_length; s = rbufp->recv_buffer; +#ifdef FREEBSD_CONRAD + ioctl(parse->fd,TIOCTIMESTAMP,&foo); + TVTOTS(&foo, &rbufp->recv_time); + rbufp->recv_time.l_uf += TS_ROUNDBIT; + rbufp->recv_time.l_ui += JAN_1970; + rbufp->recv_time.l_uf &= TS_MASK; +#endif while (count--) { @@ -2271,7 +2292,10 @@ parse_start(sysunit, peer) tm.c_iflag = clockinfo[type].cl_iflag; tm.c_oflag = clockinfo[type].cl_oflag; tm.c_lflag = clockinfo[type].cl_lflag; - +#ifdef FREEBSD_CONRAD + tm.c_ispeed = 50; + tm.c_ospeed = 50; +#endif if (TTY_SETATTR(fd232, &tm) == -1) { syslog(LOG_ERR, "PARSE receiver #%d: parse_start: tcsetattr(%d, &tm): %m", unit, fd232); @@ -2314,6 +2338,21 @@ parse_start(sysunit, peer) return 0; /* well, ok - special initialisation broke */ } +#ifdef FREEBSD_CONRAD + { + int i,j; + struct timeval tv; + ioctl(parse->fd,TIOCTIMESTAMP,&tv); + j = TIOCM_RTS; + i = ioctl(fd232, TIOCMBIC, &j); + if (i < 0) { + syslog(LOG_ERR, + "PARSE receiver #%d: lowrts_poll: failed to lower RTS: %m", + CL_UNIT(parse->unit)); + } + } +#endif + strcpy(tmp_ctl.parseformat.parse_buffer, parse->parse_type->cl_format); tmp_ctl.parseformat.parse_count = strlen(tmp_ctl.parseformat.parse_buffer); @@ -2824,7 +2863,7 @@ parse_control(unit, in, out) sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); tt = add_var(&out->kv_list, 128, RO); - sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp\""); + sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp\""); out->lencode = strlen(outstatus); out->lastcode = outstatus; @@ -3103,7 +3142,11 @@ parse_process(parse, parsetime) L_ADD(&off, &offset); rectime = off; /* this makes org time and xmt time somewhat artificial */ - if (parse->flags & PARSE_STAT_FILTER) + L_SUB(&off, &parsetime->parse_stime.fp); + + if ((parse->flags & PARSE_STAT_FILTER) && + (off.l_i > -60) && + (off.l_i < 60)) /* take usec error only if within +- 60 secs */ { struct timeval usecerror; /* @@ -3115,10 +3158,6 @@ parse_process(parse, parsetime) sTVTOTS(&usecerror, &off); L_ADD(&off, &offset); } - else - { - L_SUB(&off, &parsetime->parse_stime.fp); - } } if (PARSE_PPS(parsetime->parse_state) && CL_PPS(parse->unit)) @@ -3409,6 +3448,12 @@ trimble_init(parse) * History: * * refclock_parse.c,v + * Revision 3.53 1994/03/25 13:07:39 kardel + * fixed offset calculation for large (>4 Min) offsets + * + * Revision 3.52 1994/03/03 09:58:00 kardel + * stick -kv in cvs is no fun + * * Revision 3.49 1994/02/20 13:26:00 kardel * rcs id cleanup * diff --git a/usr.sbin/xntpd/xntpdc/ntpdc_ops.c b/usr.sbin/xntpd/xntpdc/ntpdc_ops.c index d708d4b7d1fa..4fa9324784cc 100644 --- a/usr.sbin/xntpd/xntpdc/ntpdc_ops.c +++ b/usr.sbin/xntpd/xntpdc/ntpdc_ops.c @@ -66,10 +66,9 @@ static void ctlstats P((struct parse *, FILE *)); static void leapinfo P((struct parse *, FILE *)); static void clockstat P((struct parse *, FILE *)); static void fudge P((struct parse *, FILE *)); -static void maxskew P((struct parse *, FILE *)); static void clkbug P((struct parse *, FILE *)); static void setprecision P((struct parse *, FILE *)); -static void setselect P((struct parse *, FILE *)); +static void kerninfo P((struct parse *, FILE *)); /* * Commands we understand. Ntpdc imports this. @@ -77,37 +76,37 @@ static void setselect P((struct parse *, FILE *)); struct xcmd opcmds[] = { { "listpeers", peerlist, { NO, NO, NO, NO }, { "", "", "", "" }, - "print list of peers the server knows about" }, + "display list of peers the server knows about" }, { "peers", peers, { NO, NO, NO, NO }, { "", "", "", "" }, - "print peer summary information" }, + "display peer summary information" }, { "dmpeers", dmpeers, { NO, NO, NO, NO }, { "", "", "", "" }, - "print peer summary info the way Dave Mills likes it" }, + "display peer summary info the way Dave Mills likes it" }, { "showpeer", showpeer, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, - "print detailed information for one or more peers" }, + "display detailed information for one or more peers" }, { "pstats", peerstats, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, - "print statistical information for one or more peers" }, + "display statistical information for one or more peers" }, { "loopinfo", loopinfo, { OPT|STR, NO, NO, NO }, { "oneline|multiline", "", "", "" }, - "print loop filter information" }, + "display loop filter information" }, { "sysinfo", sysinfo, { NO, NO, NO, NO }, { "", "", "", "" }, - "print local server information" }, + "display local server information" }, { "sysstats", sysstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print local server statistics" }, + "display local server statistics" }, { "memstats", memstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print peer memory usage statistics" }, + "display peer memory usage statistics" }, { "iostats", iostats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print I/O subsystem statistics" }, + "display I/O subsystem statistics" }, { "timerstats", timerstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print event timer subsystem statistics" }, + "display event timer subsystem statistics" }, { "addpeer", addpeer, { ADD, OPT|UINT, OPT|UINT, OPT|STR }, { "addr", "keyid", "version", "minpoll|prefer" }, "configure a new peer association" }, @@ -121,14 +120,14 @@ struct xcmd opcmds[] = { { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "unconfigure existing peer assocations" }, { "set", set, { STR, OPT|STR, OPT|STR, OPT|STR }, - { "bclient|auth", "...", "...", "..." }, - "set a system flag (bclient, authenticate)" }, + { "bclient|mclient|auth", "...", "...", "..." }, + "set a system flag (bclient, mclient, auth)" }, { "clear", sys_clear, { STR, OPT|STR, OPT|STR, OPT|STR }, - { "bclient|auth", "...", "...", "..." }, - "clear a system flag (bclient, authenticate)" }, + { "bclient|mclient|auth", "...", "...", "..." }, + "clear a system flag (bclient, mclient, auth)" }, { "reslist", reslist, { NO, NO, NO, NO }, { "", "", "", "" }, - "print the server's restrict list" }, + "display the server's restrict list" }, { "restrict", restrict, { ADD, ADD, STR, OPT|STR }, { "address", "mask", "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer", @@ -144,7 +143,7 @@ struct xcmd opcmds[] = { "delete a restrict entry" }, { "monlist", monlist, { NO, NO, NO, NO }, { "", "", "", "" }, - "print data the server's monitor routines have collected" }, + "display data the server's monitor routines have collected" }, { "monitor", monitor, { STR, NO, NO, NO }, { "on|off", "", "", "" }, "turn the server's monitoring facility on or off" }, @@ -171,10 +170,10 @@ struct xcmd opcmds[] = { "remove one or more key ID's from the trusted list" }, { "authinfo", authinfo, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain information concerning the state of the authentication code" }, + "display the state of the authentication code" }, { "traps", traps, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain information about traps set in server" }, + "display the traps set in the server" }, { "addtrap", addtrap, { ADD, OPT|UINT, OPT|ADD, NO }, { "address", "port", "interface", "" }, "configure a trap in the server" }, @@ -189,28 +188,26 @@ struct xcmd opcmds[] = { "change the keyid the server uses to authenticate control messages" }, { "ctlstats", ctlstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain packet count statistics from the control module" }, + "display packet count statistics from the control module" }, { "leapinfo", leapinfo, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain information about the current leap second state" }, + "display the current leap second state" }, { "clockstat", clockstat, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "address", "address", "address", "address" }, - "obtain status information about the specified clock" }, + "display clock status information" }, { "fudge", fudge, { ADD, STR, STR, NO }, { "address", "time1|time2|val1|val2|flags", "value", "" }, "set/change one of a clock's fudge factors" }, - { "maxskew", maxskew, { STR, NO, NO, NO }, - { "maximum_skew", "", "", "" }, - "set the server's maximum skew parameter" }, { "clkbug", clkbug, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "address", "address", "address", "address" }, - "obtain debugging information from the specified clock" }, + "display clock debugging information" }, { "setprecision", setprecision, { INT, NO, NO, NO }, { "sys_precision", "", "", "" }, "set the server's advertised precision" }, - { "setselect", setselect, { UINT, NO, NO, NO }, - { "select_algorithm_number", "", "", "" }, - "change the selection weighting algorithm used by the server" }, + { "kerninfo", kerninfo, { NO, NO, NO, NO }, + { "", "", "", "" }, + "display the kernel pll/pps variables" }, + { 0, 0, { NO, NO, NO, NO }, { "", "", "", "" }, "" } }; @@ -374,9 +371,9 @@ dopeers(pcmd, fp, dmstyle) return; (void) fprintf(fp, - " remote local st poll reach delay offset disp\n"); + " remote local st poll reach delay offset disp\n"); (void) fprintf(fp, - "======================================================================\n"); + "=======================================================================\n"); while (items > 0) { if (!dmstyle) { if (plist->flags & INFO_FLAG_SYSPEER) @@ -407,13 +404,14 @@ dopeers(pcmd, fp, dmstyle) 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 %6.6s\n", + "%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), 4), + fptoa(NTOHS_FP(plist->delay), 5), lfptoa(&tempts, 6), - ufptoa(NTOHS_FP(plist->dispersion), 4)); + ufptoa(NTOHS_FP(plist->dispersion), 5)); + plist++; items--; } @@ -451,16 +449,19 @@ printpeer(pp, fp) "leap %c%c, refid [%s], rootdistance %s, rootdispersion %s\n", pp->leap & 0x2 ? '1' : '0', pp->leap & 0x1 ? '1' : '0', - str, ufptoa(HTONS_FP(pp->rootdelay), 4), - ufptoa(HTONS_FP(pp->rootdispersion), 4)); + str, ufptoa(HTONS_FP(pp->rootdelay), 5), + ufptoa(HTONS_FP(pp->rootdispersion), 5)); (void) fprintf(fp, "ppoll %d, hpoll %d, keyid %u, version %d, association %u\n", pp->ppoll, pp->hpoll, pp->keyid, pp->version, ntohs(pp->associd)); (void) fprintf(fp, - "valid %d, reach %03o, unreach %d, trust %03o\n", - pp->valid, pp->reach, pp->unreach, pp->trust); + "valid %d, reach %03o, unreach %d, flash %03o, ", + pp->valid, pp->reach, pp->unreach, pp->flash); + + (void) fprintf(fp, "estbdelay %s, ttl %d\n", + mfptoa(0, ntohl(pp->estbdelay), 5), pp->ttl); (void) fprintf(fp, "timer %ds, flags", ntohl(pp->timer)); if (pp->flags == 0) { @@ -508,7 +509,8 @@ printpeer(pp, fp) (void) fprintf(fp, "filter delay: "); for (i = 0; i < NTP_SHIFT; i++) { - (void) fprintf(fp, " %-8.8s", fptoa(HTONS_FP(pp->filtdelay[i]),4)); + (void) fprintf(fp, " %-8.8s", + fptoa(HTONS_FP(pp->filtdelay[i]), 5)); if (i == (NTP_SHIFT>>1)-1) (void) fprintf(fp, "\n "); } @@ -517,7 +519,7 @@ printpeer(pp, fp) (void) fprintf(fp, "filter offset:"); for (i = 0; i < NTP_SHIFT; i++) { HTONL_FP(&pp->filtoffset[i], &tempts); - (void) fprintf(fp, " %-8.8s", lfptoa(&tempts, 5)); + (void) fprintf(fp, " %-8.8s", lfptoa(&tempts, 6)); if (i == (NTP_SHIFT>>1)-1) (void) fprintf(fp, "\n "); } @@ -531,23 +533,13 @@ printpeer(pp, fp) } (void) fprintf(fp, "\n"); - (void) fprintf(fp, "bdelay filter:"); - for (i = 0; i < NTP_SHIFT; i++) { - (void) fprintf(fp, " %-8.8s", - mfptoa(0, ntohl(pp->bdelay[i]), 5)); - if (i == (NTP_SHIFT>>1)-1) - (void) fprintf(fp, "\n "); - } - (void) fprintf(fp, "\n"); - - (void) fprintf(fp, "delay %s, estbdelay %s\n", - fptoa(HTONS_FP(pp->delay), 4), - mfptoa(0, ntohl(pp->estbdelay), 4)); HTONL_FP(&pp->offset, &tempts); - (void) fprintf(fp, "offset %s, dispersion %s\n", - lfptoa(&tempts, 6), - ufptoa(HTONS_FP(pp->dispersion), 4)); + (void) fprintf(fp, + "offset %s, delay %s, dispersion %s, selectdisp %s\n", + lfptoa(&tempts, 6), fptoa(HTONS_FP(pp->delay), 5), + ufptoa(HTONS_FP(pp->dispersion), 5), + ufptoa(HTONS_FP(pp->selectdisp), 5)); } @@ -781,11 +773,10 @@ sysinfo(pcmd, fp) is->leap & 0x1 ? '1' : '0'); (void) fprintf(fp, "stratum: %d\n", (int)is->stratum); (void) fprintf(fp, "precision: %d\n", (int)is->precision); - (void) fprintf(fp, "select algorithm: %d\n", (int)is->selection); (void) fprintf(fp, "sync distance: %s\n", - fptoa(NTOHS_FP(is->rootdelay), 4)); + fptoa(NTOHS_FP(is->rootdelay), 5)); (void) fprintf(fp, "sync dispersion: %s\n", - ufptoa(NTOHS_FP(is->rootdispersion), 4)); + ufptoa(NTOHS_FP(is->rootdispersion), 5)); if (is->stratum <= 1) { junk[4] = 0; memmove(junk, (char *)&is->refid, 4); @@ -799,7 +790,8 @@ sysinfo(pcmd, fp) (void) fprintf(fp, "reference time: %s\n", prettydate(&tempts)); (void) fprintf(fp, "system flags: "); - if ((is->flags & (INFO_FLAG_BCLIENT|INFO_FLAG_AUTHENABLE)) == 0) { + if ((is->flags & (INFO_FLAG_BCLIENT | INFO_FLAG_MCLIENT | + INFO_FLAG_AUTHENABLE)) == 0) { (void) fprintf(fp, "none\n"); } else { res = 0; @@ -807,6 +799,10 @@ sysinfo(pcmd, fp) (void) fprintf(fp, "bclient"); res = 1; } + if (is->flags & INFO_FLAG_MCLIENT) { + (void) fprintf(fp, "mclient"); + res = 1; + } if (is->flags & INFO_FLAG_AUTHENABLE) (void) fprintf(fp, "%sauthenticate", res ? ", " : ""); @@ -818,8 +814,6 @@ sysinfo(pcmd, fp) HTONL_FP(&is->authdelay, &tempts); (void) fprintf(fp, "encryption delay: %s\n", lfptoa(&tempts, 7)); - (void) fprintf(fp, "maximum skew: %s\n", - ufptoa(NTOHS_FP(is->maxskew), 4)); } @@ -871,8 +865,6 @@ sysstats(pcmd, fp) ntohl(ss->processed)); (void) fprintf(fp, "bad authentication: %d\n", ntohl(ss->badauth)); - (void) fprintf(fp, "wander hold downs: %d\n", - ntohl(ss->wanderhold)); if (itemsize != sizeof(struct info_sys_stats)) return; @@ -1214,6 +1206,8 @@ doset(pcmd, fp, req) for (items = 0; items < pcmd->nargs; items++) { if (STREQ(pcmd->argval[items].string, "bclient")) sys.flags |= SYS_FLAG_BCLIENT; + else if (STREQ(pcmd->argval[items].string, "mclient")) + sys.flags |= SYS_FLAG_MCLIENT; else if (STREQ(pcmd->argval[items].string, "auth")) sys.flags |= SYS_FLAG_AUTHENTICATE; else { @@ -2284,39 +2278,6 @@ fudge(pcmd, fp) return; } - - -/* - * maxskew - set the server's maximum skew parameter - */ -static void -maxskew(pcmd, fp) - struct parse *pcmd; - FILE *fp; -{ - u_fp Xmaxskew; - l_fp tmp; - int items; - int itemsize; - char *dummy; - int res; - - if (!atolfp(pcmd->argval[0].string, &tmp)) { - (void) fprintf(stderr, "What the heck does %s mean?\n", - pcmd->argval[0].string); - return; - } - Xmaxskew = HTONS_FP(LFPTOFP(&tmp)); - - res = doquery(IMPL_XNTPD, REQ_SET_MAXSKEW, 1, 1, sizeof(u_fp), - (char *)&Xmaxskew, &items, &itemsize, &dummy); - - if (res == 0) - (void) fprintf(fp, "done!\n"); -} - - - /* * clkbug - get and print clock debugging information */ @@ -2432,27 +2393,72 @@ setprecision(pcmd, fp) } - /* - * setselect - change the server's selection algorithm + * kerninfo - display the kernel pll/pps variables */ static void -setselect(pcmd, fp) +kerninfo(pcmd, fp) struct parse *pcmd; FILE *fp; { - U_LONG select_code; + struct info_kernel *ik; int items; int itemsize; - char *dummy; int res; - select_code = htonl(pcmd->argval[0].uval); + res = doquery(IMPL_XNTPD, REQ_GET_KERNEL, 0, 0, 0, (char *)NULL, + &items, &itemsize, (char **)&ik); + if (res != 0 && items == 0) + return; + if (!check1item(items, fp)) + return; + if (!checkitemsize(itemsize, sizeof(struct info_kernel))) + return; - res = doquery(IMPL_XNTPD, REQ_SET_SELECT_CODE, 1, 1, sizeof(U_LONG), - (char *)&select_code, &items, &itemsize, &dummy); - - if (res == 0) - (void) fprintf(fp, "done!\n"); - return; + /* + * pll variables + */ + (void)fprintf(fp, "pll offset: %d us\n", + ntohl(ik->offset)); + (void)fprintf(fp, "pll frequency: %s ppm\n", + fptoa((s_fp)ntohl(ik->freq), 3)); + (void)fprintf(fp, "maximum error: %d us\n", + ntohl(ik->maxerror)); + (void)fprintf(fp, "estimated error: %d us\n", + ntohl(ik->esterror)); + (void)fprintf(fp, "status: %04x\n", + ntohs(ik->status & 0xffff)); + (void)fprintf(fp, "pll time constant: %d\n", + ntohl(ik->constant)); + (void)fprintf(fp, "precision: %d us\n", + ntohl(ik->precision)); + (void)fprintf(fp, "frequency tolerance: %s ppm\n", + fptoa((s_fp)ntohl(ik->tolerance), 0)); + + /* + * For backwards compatibility (ugh), we find the pps variables + * only if the shift member is nonzero. + */ + if (!ik->shift) + return; + + /* + * pps variables + */ + (void)fprintf(fp, "pps frequency: %s ppm\n", + fptoa((s_fp)ntohl(ik->ppsfreq), 3)); + (void)fprintf(fp, "pps stability: %s ppm\n", + fptoa((s_fp)ntohl(ik->stabil), 3)); + (void)fprintf(fp, "pps jitter: %d us\n", + ntohl(ik->jitter)); + (void)fprintf(fp, "calibration interval: %d s\n", + 1 << ntohs(ik->shift)); + (void)fprintf(fp, "calibration cycles: %d\n", + ntohl(ik->calcnt)); + (void)fprintf(fp, "jitter exceeded: %d\n", + ntohl(ik->jitcnt)); + (void)fprintf(fp, "stability exceeded: %d\n", + ntohl(ik->stbcnt)); + (void)fprintf(fp, "calibration errors: %d\n", + ntohl(ik->errcnt)); } diff --git a/usr.sbin/xntpd/xntpres/xntpres.c b/usr.sbin/xntpd/xntpres/xntpres.c index ee88b1f3be98..47c6eda7dc12 100644 --- a/usr.sbin/xntpd/xntpres/xntpres.c +++ b/usr.sbin/xntpd/xntpres/xntpres.c @@ -46,6 +46,7 @@ struct conf_entry { #define ce_minpoll ce_config.minpoll #define ce_maxpoll ce_config.maxpoll #define ce_flags ce_config.flags +#define ce_ttl ce_config.ttl #define ce_keyid ce_config.keyid /* @@ -100,8 +101,9 @@ int resolve_value; /* next value of resolve timer */ #define TOK_MINPOLL 3 #define TOK_MAXPOLL 4 #define TOK_FLAGS 5 -#define TOK_KEYID 6 -#define NUMTOK 7 +#define TOK_TTL 6 +#define TOK_KEYID 7 +#define NUMTOK 8 #define MAXLINESIZE 512 @@ -128,7 +130,7 @@ extern int errno; 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, U_LONG)); +static void addentry P((char *, int, int, int, int, int, int, U_LONG)); static int findhostaddr P((struct conf_entry *)); static void openntp P((void)); static int request P((struct conf_peer *)); @@ -338,13 +340,14 @@ removeentry(entry) * addentry - add an entry to the configuration list */ static void -addentry(name, mode, version, minpoll, maxpoll, flags, keyid) +addentry(name, mode, version, minpoll, maxpoll, flags, ttl, keyid) char *name; int mode; int version; int minpoll; int maxpoll; int flags; + int ttl; U_LONG keyid; { register char *cp; @@ -363,6 +366,7 @@ addentry(name, mode, version, minpoll, maxpoll, flags, keyid) ce->ce_minpoll = (u_char)minpoll; ce->ce_maxpoll = (u_char)maxpoll; ce->ce_flags = (u_char)flags; + ce->ce_ttl = (u_char)ttl; ce->ce_keyid = htonl(keyid); ce->ce_next = NULL; @@ -802,9 +806,9 @@ readconf(fp, name) * This is as good as we can check it. Add it in. */ addentry(token[TOK_HOSTNAME], (int)intval[TOK_HMODE], - (int)intval[TOK_VERSION], - (int)intval[TOK_MINPOLL], (int)intval[TOK_MAXPOLL], - flags, intval[TOK_KEYID]); + (int)intval[TOK_VERSION], (int)intval[TOK_MINPOLL], + (int)intval[TOK_MAXPOLL], flags, (int)intval[TOK_TTL], + intval[TOK_KEYID]); } }