client: print reference ID in hexadecimal
This is an incompatible change in the output of the tracking command, which may break some scripts, but it's necessary to avoid confusion with IPv4 addresses when synchronised to an IPv6 server or reference clock.
This commit is contained in:
parent
1045adaa88
commit
5fb1107cc7
4 changed files with 20 additions and 14 deletions
5
client.c
5
client.c
|
@ -1789,10 +1789,9 @@ print_report(const char *format, ...)
|
|||
else
|
||||
print_freq_ppm(dbl);
|
||||
break;
|
||||
case 'R': /* reference ID in quad-dotted notation */
|
||||
case 'R': /* reference ID in hexdecimal */
|
||||
long_uinteger = va_arg(ap, unsigned long);
|
||||
printf("%lu.%lu.%lu.%lu", long_uinteger >> 24, (long_uinteger >> 16) & 0xff,
|
||||
(long_uinteger >> 8) & 0xff, long_uinteger & 0xff);
|
||||
printf("%lX", long_uinteger);
|
||||
break;
|
||||
case 'S': /* offset with unit */
|
||||
dbl = va_arg(ap, double);
|
||||
|
|
|
@ -127,7 +127,7 @@ The *tracking* command displays parameters about the system's clock
|
|||
performance. An example of the output is shown below.
|
||||
+
|
||||
----
|
||||
Reference ID : 203.0.113.15 (foo.example.net)
|
||||
Reference ID : CB00710F (foo.example.net)
|
||||
Stratum : 3
|
||||
Ref time (UTC) : Fri Feb 3 15:00:29 2012
|
||||
System time : 0.000001501 seconds slow of NTP time
|
||||
|
@ -150,10 +150,14 @@ computer is currently synchronised. For IPv4 addresses, the reference ID is
|
|||
equal to the address and for IPv6 addresses it is the first 32 bits of the MD5
|
||||
sum of the address.
|
||||
+
|
||||
If it is _127.127.1.1_ it means the computer is not synchronised to any
|
||||
external source and that you have the _local_ mode operating (via the
|
||||
<<local,*local*>> command in *chronyc*, or the
|
||||
If the reference ID is _7F7F0101_ and there is no name or IP address, it means
|
||||
the computer is not synchronised to any external source and that you have the
|
||||
_local_ mode operating (via the <<local,*local*>> command in *chronyc*, or the
|
||||
<<chrony.conf.adoc#local,*local*>> directive in the configuration file).
|
||||
+
|
||||
The reference ID is printed as a hexadecimal number. Note that in older
|
||||
versions it used to be printed in quad-dotted notation and could be confused
|
||||
with an IPv4 address.
|
||||
*Stratum*:::
|
||||
The stratum indicates how many hops away from a computer with an attached
|
||||
reference clock we are. Such a computer is a stratum-1 computer, so the
|
||||
|
|
15
doc/faq.adoc
15
doc/faq.adoc
|
@ -287,12 +287,15 @@ authentication (`commandkey` directive).
|
|||
|
||||
=== Why does `chronyc tracking` always print an IPv4 address as reference ID?
|
||||
|
||||
The reference ID is a 32-bit value and is always printed in quad-dotted
|
||||
notation, even if the reference source doesn't have an IPv4 address. For IPv4
|
||||
addresses, the reference ID is equal to the address, but for IPv6 addresses it
|
||||
is the first 32 bits of the MD5 sum of the address. For reference clocks, the
|
||||
reference ID is the value specified with the `refid` option in the `refclock`
|
||||
directive.
|
||||
The reference ID is a 32-bit value and in versions before 3.0 it was printed in
|
||||
quad-dotted notation, even if the reference source did not actually have an
|
||||
IPv4 address. For IPv4 addresses, the reference ID is equal to the address, but
|
||||
for IPv6 addresses it is the first 32 bits of the MD5 sum of the address. For
|
||||
reference clocks, the reference ID is the value specified with the `refid`
|
||||
option in the `refclock` directive.
|
||||
|
||||
Since version 3.0, the reference ID is printed as a hexadecimal number to avoid
|
||||
confusion with IPv4 addresses.
|
||||
|
||||
If you need to get the IP address of the current reference source, use the `-n`
|
||||
option to disable resolving of IP addresses and read the second field (printed
|
||||
|
|
|
@ -11,7 +11,7 @@ sourcestats"
|
|||
run_test || test_fail
|
||||
check_chronyd_exit || test_fail
|
||||
|
||||
check_chronyc_output "^Reference ID : 192\.168\.123\.1 \(192\.168\.123\.1\)
|
||||
check_chronyc_output "^Reference ID : C0A87B01 \(192\.168\.123\.1\)
|
||||
Stratum : 2
|
||||
Ref time \(UTC\) : Fri Jan 01 00:1.:.. 2010
|
||||
System time : 0\.0000..... seconds (slow|fast) of NTP time
|
||||
|
|
Loading…
Reference in a new issue