Compare commits

...

16 Commits

Author SHA1 Message Date
Richard P. Curnow
5331e1a146 Update NEWS for 1.23 2007-12-02 14:53:09 +00:00
Richard P. Curnow
eeac7b7ca0 Define io_linux.h constants for x86_64
Based on thread from chrony-users, October 2007.
2007-12-02 14:39:50 +00:00
Richard P. Curnow
efcf3f7c6b git archive's --prefix arg needs a trailing / 2007-06-27 23:57:03 +01:00
Richard P. Curnow
eb4c9d908c Use git-archive instead of the obsolete git-tar-tree in make_release 2007-06-27 23:54:43 +01:00
Richard P. Curnow
b6e40dbde7 Merge branch 'bu' 2007-06-26 23:51:18 +01:00
Richard P. Curnow
4ba843f8f4 Fix formatting from last patch 2007-06-26 23:50:53 +01:00
Bill Unruh
75a7af9edc Fix handling of stratum zero.
Further to the discussion with John Hasler, here are new diffs which
handles the incoming stratum 0 claim of a remote server by redefining the
incoming stratum as one bigger than the Max if it is zero, as per the NTP
version 4 documentation.

If the incoming stratum is zero it sets it to NTP_MAX_STRATUM+1 . If our
current stratum is larger than the NTP_MAX_STRATUM, the outgoing stratum is
also set to zero as per the suggestions in the NTP docs.
Introduces the new NTP_INVALID_STRATUM of 0 for doing these tests or
setting the outgoing stratum.

It is unclear whether chrony wants to follow NTP in setting the outgoing
stratum to zero if it is unknown or invalid, rather than a number larger
than the max stratum. Setting it to zero seems silly, since zero is already
used to define the stratum of a hardware clock (GPS, atomic, etc). This
seems ripe for confusion. But the fact that the ntp docs state to do this,
and that ntp servers (eg ntp.ubc.ca) are already doing this (using 0 to
mean invalid) means that chrony has to handle it on the incoming packets
from the servers.
2007-06-26 23:46:33 +01:00
Bill Unruh
8022874a47 Handle fluctuations in peer distance better. 2007-06-26 23:45:04 +01:00
Richard P. Curnow
ca1195a0e6 Fix whitespace issue with last patch 2007-06-26 23:43:28 +01:00
Bill Unruh
ce4e0a3c2f Fix problems with rtc_linux.
2) Changes to rtc_linux.c which a) do a double read of /dev/rtc when the
PPM interupt is turned on after the wait time expires. The current read
does not block to the second, as it should, thus two reads are needed.

Also, changes so that at startup the system properly ignores the last
system time from the initial burst mode for setting the system time since
it can be way off. At present this last system time is included in the
regression, which throws it off until finally that sample is dropped.
2007-06-26 23:42:11 +01:00
Stefan Lucke
215d988286 Fix sign v zero extension error in handling IP address
I switch to the git version of chrony. Accidently this version did not
talk to by lokal server at 192.168.192.4. Instead it continuosly tried
255.255.192.4 :-( .

Tracked that down to "char", "unsigned char" issue in nameserv.c:
2007-06-26 23:02:33 +01:00
Richard P. Curnow
084efe606f Merge branch 'vm' 2007-06-26 22:13:40 +01:00
Richard P. Curnow
38efaf10a8 configure: fix indentation from previous patch 2007-06-26 22:11:19 +01:00
Vladimir Michl
93f6664378 Allow RTC support to be excluded at compile time.
Add a new option to configure script, allowing
to disable (and exclude) RTC module. It saves same memory.
2007-06-26 22:08:49 +01:00
Vladimir Michl
8a94298b7e Add support for Linux/arm 2007-06-26 22:06:39 +01:00
Richard P. Curnow
242c520912 Fix format of "could not send to" message 2006-04-15 23:57:42 +01:00
10 changed files with 71 additions and 16 deletions

22
NEWS
View File

@@ -1,3 +1,25 @@
New in version 1.23
===================
* Support for MIPS, x86_64, sparc, alpha, arm, FreeBSD
* Fix serious sign-extension error in handling IP addresses
* RTC support can be excluded at compile time
* Make sources gcc-4 compatible
* Fix various compiler warnings
* Handle fluctuations in peer distance better.
* Fixed handling of stratum zero.
* Fix various problems for 64-bit systems
* Flush chronyc output streams after each command, to allow it to be driven
through pipes
* Manpage improvements
Version 1.22
============
This release number was claimed by a release that Mandriva made to patch
important bugs in 1.21. The official numbering has jumped to 1.23 as a
consequence.
New in version 1.21
===================

11
configure vendored
View File

@@ -133,6 +133,7 @@ For better control, use the options below.
--readline-inc-dir=DIR Specify where readline include directory is
--readline-lib-dir=DIR Specify where readline lib directory is
--with-ncurses-library=DIR Specify where ncurses lib directory is
--disable-rtc Don't include RTC even on Linux
Fine tuning of the installation directories:
--infodir=DIR info documentation [PREFIX/info]
@@ -172,6 +173,7 @@ SYSDEFS=""
# Support for readline (on by default)
feat_readline=1
feat_rtc=1
readline_lib=""
readline_inc=""
ncurses_lib=""
@@ -206,6 +208,9 @@ do
--mandir=* )
SETMANDIR=`echo $option | sed -e 's/^.*=//;'`
;;
--disable-rtc)
feat_rtc=0
;;
--help | -h )
usage
exit 0
@@ -238,7 +243,11 @@ case $SYSTEM in
esac
;;
Linux* )
EXTRA_OBJECTS="sys_linux.o wrap_adjtimex.o rtc_linux.o"
EXTRA_OBJECTS="sys_linux.o wrap_adjtimex.o"
if [ $feat_rtc -eq 1 ] ; then
EXTRA_OBJECTS+=" rtc_linux.o"
EXTRA_DEFS+=" -DFEAT_RTC=1"
fi
SYSDEFS="-DLINUX"
echo "Configuring for " $SYSTEM
if [ "${MACHINE}" = "alpha" ]; then

View File

@@ -6,7 +6,7 @@
/* Hmm. These constants vary a bit between systems. */
/* (__sh__ includes both sh and sh64) */
#if defined(__i386__) || defined(__sh__)
#if defined(__i386__) || defined(__sh__) || defined(__arm__)||defined(__x86_64__)
#define CHRONY_IOC_NRBITS 8
#define CHRONY_IOC_TYPEBITS 8
#define CHRONY_IOC_SIZEBITS 14

View File

@@ -19,7 +19,7 @@ if (-d "RELEASES/$subdir") {
system ("rm -rf RELEASES/$subdir");
}
system ("git-tar-tree $version RELEASES/${subdir} | tar xf -");
system ("git-archive --format=tar --prefix=RELEASES/${subdir}/ $version | tar xf -");
die "git-tar-tree failed" if ($? != 0);
chdir "RELEASES";

View File

@@ -39,7 +39,7 @@ unsigned long
DNS_Name2IPAddress(const char *name)
{
struct hostent *host;
char *address0;
unsigned char *address0;
unsigned long result;
host = gethostbyname(name);

View File

@@ -196,6 +196,9 @@ struct NCR_Instance_Record {
/* Maximum allowed stratum */
#define NTP_MAX_STRATUM 15
/* INVALID or Unkown stratum from external server as per the NTP 4 docs */
#define NTP_INVALID_STRATUM 0
/* ================================================== */
static ADF_AuthTable access_auth_table;
@@ -539,7 +542,13 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
/* Generate transmit packet */
message.lvm = ((leap << 6) &0xc0) | ((version << 3) & 0x38) | (my_mode & 0x07);
if (our_stratum <= NTP_MAX_STRATUM) {
message.stratum = our_stratum;
} else {
/* (WGU) to handle NTP "Invalid" stratum as per the NTP V4 documents. */
message.stratum = NTP_INVALID_STRATUM;
}
message.poll = my_poll;
message.precision = LCL_GetSysPrecisionAsLog();
@@ -983,6 +992,12 @@ receive_packet(NTP_Packet *message, struct timeval *now, NCR_Instance inst, int
test6 = 1; /* Succeeded */
}
/* (WGU) Set stratum to greater than any valid if incoming is 0 */
/* as per the NPT v4 documentation*/
if (message->stratum <= NTP_INVALID_STRATUM) {
message->stratum = NTP_MAX_STRATUM + 1;
}
/* Test 7 checks that the stratum in the packet is appropriate */
if ((message->stratum > REF_GetOurStratum()) ||
(message->stratum > NTP_MAX_STRATUM)) {

View File

@@ -244,7 +244,7 @@ NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
if (sendto(sock_fd, (void *) packet, NTP_NORMAL_PACKET_SIZE, 0,
(struct sockaddr *) &remote, sizeof(remote)) < 0) {
LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to :%s%d : %s",
LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s",
UTI_IPToDottedQuad(remote_addr->ip_addr), remote_addr->port, strerror(errno));
}
@@ -267,7 +267,7 @@ NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
if (sendto(sock_fd, (void *) packet, sizeof(NTP_Packet), 0,
(struct sockaddr *) &remote, sizeof(remote)) < 0) {
LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to :%s%d : %s",
LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s",
UTI_IPToDottedQuad(remote_addr->ip_addr), remote_addr->port, strerror(errno));
}

4
rtc.c
View File

@@ -33,7 +33,7 @@
#include "logging.h"
#include "conf.h"
#if defined LINUX
#if defined LINUX && defined FEAT_RTC
#include "rtc_linux.h"
#endif /* defined LINUX */
@@ -53,7 +53,7 @@ static struct {
void (*cycle_logfile)(void);
} driver =
{
#if defined LINUX
#if defined LINUX && defined FEAT_RTC
RTC_Linux_Initialise,
RTC_Linux_Finalise,
RTC_Linux_TimePreInit,

View File

@@ -174,7 +174,7 @@ static double file_ref_offset, file_rate_ppm;
/* ================================================== */
/* Flag to remember whether to assume the RTC is running on UTC */
static int rtc_on_utc = 0;
static int rtc_on_utc = 1;
/* ================================================== */
@@ -226,15 +226,18 @@ accumulate_sample(time_t rtc, struct timeval *sys)
discard_samples(NEW_FIRST_WHEN_FULL);
}
rtc_sec[n_samples] = rtc;
/* Always use most recent sample as reference */
/* use sample only if n_sample is not negative*/
if(n_samples >=0)
{
rtc_ref = rtc;
rtc_sec[n_samples] = rtc;
rtc_trim[n_samples] = 0.0;
system_times[n_samples] = *sys;
++n_samples;
++n_samples_since_regression;
}
++n_samples;
return;
}
@@ -742,7 +745,11 @@ handle_initial_trim(void)
run_regression(1, &coefs_valid, &coef_ref_time, &coef_seconds_fast, &coef_gain_rate);
n_samples_since_regression = 0;
n_samples = 0;
/* Set sample number to -1 so the next sample is not used, as it will not yet be corrected for System Trim*/
n_samples = -1;
read_coefs_from_file();
@@ -866,6 +873,8 @@ read_from_device(void *any)
int error = 0;
status = read(fd, &data, sizeof(data));
if (operating_mode == OM_NORMAL)
status = read(fd, &data, sizeof(data));
if (status < 0) {
/* This looks like a bad error : the file descriptor was indicating it was
* ready to read but we couldn't read anything. Give up. */

View File

@@ -373,9 +373,9 @@ find_best_sample_index(SST_Stats inst, double *times_back)
/* This defines the assumed ratio between the standard deviation of
the samples and the peer distance as measured from the round trip
time. E.g. a value of 4 means that we think the standard deviation
is a quarter of the peer distance */
is four times the fluctuation of the peer distance */
#define SD_TO_DIST_RATIO 8.0
#define SD_TO_DIST_RATIO 1.0
/* ================================================== */
/* This function runs the linear regression operation on the data. It