"Wait until synchronised in specified limits\0"
"\0\0"
"Time sources:\0\0"
- "sources [-v]\0Display information about current sources\0"
- "sourcestats [-v]\0Display statistics about collected measurements\0"
+ "sources [-a] [-v]\0Display information about current sources\0"
+ "sourcestats [-a] [-v]\0Display statistics about collected measurements\0"
"reselect\0Force reselecting synchronisation source\0"
"reselectdist <dist>\0Modify reselection distance\0"
"\0\0"
};
const char *add_options[] = { "peer", "pool", "server", NULL };
const char *manual_options[] = { "on", "off", "delete", "list", "reset", NULL };
- const char *sources_options[] = { "-v", NULL };
- const char *sourcestats_options[] = { "-v", NULL };
+ const char *sources_options[] = { "-a", "-v", NULL };
+ const char *sourcestats_options[] = { "-a", "-v", NULL };
static int list_index, len;
names[TAB_COMPLETE_BASE_CMDS] = base_commands;
/* ================================================== */
-static int
-check_for_verbose_flag(char *line)
+static void
+parse_sources_options(char *line, int *all, int *verbose)
{
- if (!csv_mode && !strcmp(line, "-v"))
- return 1;
- return 0;
+ char *opt;
+
+ *all = *verbose = 0;
+
+ while (*line) {
+ opt = line;
+ line = CPS_SplitWord(line);
+ if (!strcmp(opt, "-a"))
+ *all = 1;
+ else if (!strcmp(opt, "-v"))
+ *verbose = !csv_mode;
+ }
}
/* ================================================== */
IPAddr ip_addr;
uint32_t i, mode, n_sources;
char name[256], mode_ch, state_ch;
- int verbose;
+ int all, verbose;
- /* Check whether to output verbose headers */
- verbose = check_for_verbose_flag(line);
+ parse_sources_options(line, &all, &verbose);
request.command = htons(REQ_N_SOURCES);
if (!request_reply(&request, &reply, RPY_N_SOURCES, 0))
return 0;
n_sources = ntohl(reply.data.n_sources.n_sources);
- print_info_field("210 Number of sources = %lu\n", (unsigned long)n_sources);
if (verbose) {
printf("\n");
mode = ntohs(reply.data.source_data.mode);
UTI_IPNetworkToHost(&reply.data.source_data.ip_addr, &ip_addr);
+ if (!all && ip_addr.family == IPADDR_ID)
+ continue;
+
format_name(name, sizeof (name), 25,
mode == RPY_SD_MD_REF && ip_addr.family == IPADDR_INET4,
ip_addr.addr.in4, 1, &ip_addr);
CMD_Request request;
CMD_Reply reply;
uint32_t i, n_sources;
- int verbose = 0;
+ int all, verbose;
char name[256];
IPAddr ip_addr;
- verbose = check_for_verbose_flag(line);
+ parse_sources_options(line, &all, &verbose);
request.command = htons(REQ_N_SOURCES);
if (!request_reply(&request, &reply, RPY_N_SOURCES, 0))
return 0;
n_sources = ntohl(reply.data.n_sources.n_sources);
- print_info_field("210 Number of sources = %lu\n", (unsigned long)n_sources);
if (verbose) {
printf(" .- Number of sample points in measurement set.\n");
return 0;
UTI_IPNetworkToHost(&reply.data.sourcestats.ip_addr, &ip_addr);
+ if (!all && ip_addr.family == IPADDR_ID)
+ continue;
+
format_name(name, sizeof (name), 25, ip_addr.family == IPADDR_UNSPEC,
ntohl(reply.data.sourcestats.ref_id), 1, &ip_addr);
continue;
UTI_IPNetworkToHost(&reply.data.source_data.ip_addr, &remote_addr);
+ if (!UTI_IsIPReal(&remote_addr))
+ continue;
}
request.command = htons(REQ_NTP_DATA);
=== Time sources
-[[sources]]*sources* [*-v*]::
+[[sources]]*sources* [*-a*] [*-v*]::
This command displays information about the current time sources that *chronyd*
is accessing.
+
-The optional argument *-v* can be specified, meaning _verbose_. In this case,
+If the *-a* option is specified, all sources are displayed, including those that
+do not have a known address yet. Such sources have an identifier in the format
+_ID#XXXXXXXXXX_, which can be used in other commands expecting a source address.
++
+The *-v* option enables a verbose output. In this case,
extra caption lines are shown as a reminder of the meanings of the columns.
+
----
-210 Number of sources = 3
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#* GPS0 0 4 377 11 -479ns[ -621ns] +/- 134ns
the measurement. Positive offsets indicate that the local clock is ahead of
the source.
-[[sourcestats]]*sourcestats* [*-v*]::
+[[sourcestats]]*sourcestats* [*-a*] [*-v*]::
The *sourcestats* command displays information about the drift rate and offset
estimation process for each of the sources currently being examined by
*chronyd*.
+
-The optional argument *-v* can be specified, meaning _verbose_. In this case,
+If the *-a* option is specified, all sources are displayed, including those that
+do not have a known address yet. Such sources have an identifier in the format
+_ID#XXXXXXXXXX_, which can be used in other commands expecting a source address.
++
+The *-v* option enables a verbose output. In this case,
extra caption lines are shown as a reminder of the meanings of the columns.
+
An example report is:
+
----
-210 Number of sources = 1
Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
===============================================================================
foo.example.net 11 5 46m -0.001 0.045 1us 25us
[[ntpdata]]*ntpdata* [_address_]::
The *ntpdata* command displays the last valid measurement and other
-NTP-specific information about the specified NTP source, or all NTP sources if
-no address was specified. An example of the output is shown below.
+NTP-specific information about the specified NTP source, or all NTP sources
+(with a known address) if no address was specified. An example of the output is
+shown below.
+
----
Remote address : 203.0.113.15 (CB00710F)
Root dispersion : 0\.000...... seconds
Update interval : [0-9]+\.. seconds
Leap status : Normal
-210 Number of sources = 2
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#\? SHM0 0 4 377 [0-9]+ [0-9 +-]+[un]s\[[0-9 +-]+[un]s\] \+/-[ 0-9]+[un]s
\^\* 192\.168\.123\.1 1 [67] 377 [0-9]+ [0-9 +-]+[un]s\[[0-9 +-]+[un]s\] \+/-[ 0-9]+[un]s
-210 Number of sources = 2
Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
==============================================================================
SHM0 [0-9 ]+ [0-9 ]+ [0-9 ]+ [ +-][01]\.... [0-9 ]+\.... [0-9 +-]+[un]s [0-9 ]+[un]s
"cmddeny all 1.2.3.0/24" \
"cyclelogs" \
"delete 10.0.0.0" \
+ "delete ID#0000000001" \
"deny 1.2.3.4" \
"deny all 1.2.3.0/24" \
"dfreq 1.0e-3" \
"maxupdateskew 1.2.3.4 10.0" \
"minpoll 1.2.3.4 3" \
"minstratum 1.2.3.4 1" \
+ "minstratum ID#0000000001 1" \
"ntpdata 1.2.3.4" \
"offline" \
"offline 255.255.255.0/1.2.3.0" \