]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
client: print reference ID in hexadecimal
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 25 Nov 2016 08:57:14 +0000 (09:57 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 25 Nov 2016 16:33:43 +0000 (17:33 +0100)
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.

client.c
doc/chronyc.adoc
doc/faq.adoc
test/simulation/110-chronyc

index bd6b5350ba6630692548f396a5e3ff17700b863b..e686f51dcc0c23222a6b90d6c9f895fd38c181ac 100644 (file)
--- a/client.c
+++ b/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);
index 3dfac95d28f1677a20221f8bffb5155046e178b0..a3807b3b735c170092be43dd78376aa99559dc18 100644 (file)
@@ -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
index da9a94f9a149741b05f9b9278e67d303fbd99ad9..0a1ac7177744cf2aea067d138a430a4d9c6bed86 100644 (file)
@@ -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
index 34ee28324a3af2bcd472c27542c3169e8bc9accc..690026e02ca9d1eeb37066ea185fe48c29e84c05 100755 (executable)
@@ -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