@code{minpoll} and @code{maxpoll}. A higher target makes @code{chronyd} prefer
shorter polling intervals. The default is 6 and a useful range is 6 to 60.
+@item version
+This option sets the NTP version number used in packets sent to the server.
+This can be useful when the server runs an old NTP implementation that doesn't
+respond to newer versions. The default version number is 4.
+
@item prefer
Prefer this source over sources without prefer option.
break;
}
+ if (data.params.version != NTP_VERSION) {
+ fprintf(stderr, "Option version not supported\n");
+ break;
+ }
+
msg->data.ntp_source.port = htonl((unsigned long) data.port);
UTI_IPHostToNetwork(&ip_addr, &msg->data.ntp_source.ip_addr);
msg->data.ntp_source.minpoll = htonl(data.params.minpoll);
case CPS_BadPolltarget:
fprintf(stderr, "Unreadable polltarget value\n");
break;
+ case CPS_BadVersion:
+ fprintf(stderr, "Unreadable version value\n");
+ break;
}
return result;
#include "cmdparse.h"
#include "memory.h"
#include "nameserv.h"
+#include "ntp.h"
#include "util.h"
/* ================================================== */
src->params.iburst = 0;
src->params.min_stratum = SRC_DEFAULT_MINSTRATUM;
src->params.poll_target = SRC_DEFAULT_POLLTARGET;
+ src->params.version = NTP_VERSION;
src->params.sel_option = SRC_SelectNormal;
result = CPS_Success;
} else if (!strcasecmp(cmd, "prefer")) {
src->params.sel_option = SRC_SelectPrefer;
+ } else if (!strcasecmp(cmd, "version")) {
+ if (sscanf(line, "%d%n", &src->params.version, &n) != 1) {
+ result = CPS_BadVersion;
+ done = 1;
+ } else {
+ line += n;
+ }
+
} else {
result = CPS_BadOption;
done = 1;
int poll_target; /* Target number of sourcestats samples */
+ int version; /* Version set in packets for server/peer */
+
double poll_score; /* Score of current local poll */
double max_delay; /* Maximum round-trip delay to the
result->auto_offline = params->auto_offline;
result->poll_target = params->poll_target;
+ result->version = params->version;
+ if (result->version < NTP_MIN_COMPAT_VERSION)
+ result->version = NTP_MIN_COMPAT_VERSION;
+ else if (result->version > NTP_VERSION)
+ result->version = NTP_VERSION;
+
if (params->authkey == INACTIVE_AUTHKEY) {
result->do_auth = 0;
result->auth_key_id = 0;
/* Send a client packet, don't store the local tx values
as the reply will be ignored */
- transmit_packet(MODE_CLIENT, inst->local_poll, NTP_VERSION, 0, 0,
+ transmit_packet(MODE_CLIENT, inst->local_poll, inst->version, 0, 0,
&inst->remote_orig, &inst->local_rx, NULL, NULL,
&inst->remote_addr, &inst->local_addr);
inst->presend_done = 0; /* Reset for next time */
sent = transmit_packet(inst->mode, inst->local_poll,
- NTP_VERSION,
+ inst->version,
inst->do_auth, inst->auth_key_id,
&inst->remote_orig,
&inst->local_rx, &inst->local_tx, &inst->local_ntp_tx,