[Git][NTPsec/ntpsec][master] 3 commits: In ntpq, don't assume the magic-clock-address convention...
Eric S. Raymond
gitlab at mg.gitlab.com
Fri Jun 24 14:18:03 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
9cc960fd by Eric S. Raymond at 2016-06-24T08:54:29-04:00
In ntpq, don't assume the magic-clock-address convention...
...when reporting refids. This affects the rv report.
- - - - -
d9375015 by Eric S. Raymond at 2016-06-24T09:06:12-04:00
In ntpq, cooked version of the refid variable no longer...
...assumes the magic-refclock-address convention.
- - - - -
29c93f9a by Eric S. Raymond at 2016-06-24T10:14:49-04:00
In mode 6 responses, the type of the refclock-associated var 'type'...
...has changed. It is now a string, the short name of the driver type,
rather than an integer index into the driver type table.
- - - - -
8 changed files:
- docs/includes/ntpq-body.txt
- include/ntp_refclock.h
- ntpd/ntp_control.c
- ntpd/ntp_refclock.c
- ntpd/refclock_neoclock4x.c
- ntpd/refclock_parse.c
- ntpq/ntpq-subs.c
- ntpq/ntpq.c
Changes:
=====================================
docs/includes/ntpq-body.txt
=====================================
--- a/docs/includes/ntpq-body.txt
+++ b/docs/includes/ntpq-body.txt
@@ -541,4 +541,15 @@ some configurations.
|+flags+ |driver flags
|==========================================
+== Compatibility ==
+
+When listing refids, addresses of the form 127.127.x.x are no
+longer automatically interpreted as local refclocks as in older
+versons of +ntpq+.
+
+In some older versions, the 'type' variable associated with a
+reference clock was a numeric type index rather than an ASCII
+shortname for the driver type. You may still see such numeric
+responses when querying legacy +ntpd+ implementations.
+
// end
=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -66,7 +66,6 @@ extern struct clktype clktypes[];
* Structure for returning clock status
*/
struct refclockstat {
- uint8_t type; /* clock type */
uint8_t flags; /* clock flags */
uint8_t haveflags; /* bit array of valid flags */
u_short lencode; /* length of last timecode */
@@ -76,6 +75,7 @@ struct refclockstat {
uint32_t badformat; /* bad format timecode received */
uint32_t baddata; /* invalid data timecode received */
uint32_t timereset; /* driver resets */
+ const char *clockname; /* refclockname */
const char *clockdesc; /* ASCII description */
double fudgetime1; /* configure fudge time1 */
double fudgetime2; /* configure fudge time2 */
@@ -152,7 +152,6 @@ struct refclockproc {
uint8_t leap; /* leap/synchronization code */
uint8_t currentstatus; /* clock status */
uint8_t lastevent; /* last exception event */
- uint8_t type; /* clock type */
const char *clockname; /* clock name (tag for logging) */
const char *clockdesc; /* clock description */
u_long nextaction; /* local activity timeout */
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -2337,9 +2337,15 @@ ctl_putclock(
switch (id) {
case CC_TYPE:
- if (mustput || pcs->clockdesc == NULL
- || *(pcs->clockdesc) == '\0') {
- ctl_putuint(clock_var[id].text, pcs->type);
+ if (pcs->clockname == NULL ||
+ *(pcs->clockname) == '\0') {
+ if (mustput)
+ ctl_putstr(clock_var[id].text,
+ "", 0);
+ } else {
+ ctl_putstr(clock_var[id].text,
+ pcs->clockname,
+ strlen(pcs->clockname));
}
break;
case CC_TIMECODE:
=====================================
ntpd/ntp_refclock.c
=====================================
--- a/ntpd/ntp_refclock.c
+++ b/ntpd/ntp_refclock.c
@@ -207,7 +207,6 @@ refclock_newpeer(
peer->leap = LEAP_NOTINSYNC;
peer->stratum = STRATUM_REFCLOCK;
peer->ppoll = peer->maxpoll;
- pp->type = clktype;
pp->conf = refclock_conf[clktype];
pp->timestarted = current_time;
pp->io.fd = -1;
@@ -1026,7 +1025,7 @@ refclock_control(
out->lastevent = pp->lastevent;
out->currentstatus = pp->currentstatus;
- out->type = pp->type;
+ out->clockname = pp->clockname;
out->clockdesc = pp->clockdesc;
out->lencode = (u_short)pp->lencode;
out->p_lastcode = pp->a_lastcode;
=====================================
ntpd/refclock_neoclock4x.c
=====================================
--- a/ntpd/refclock_neoclock4x.c
+++ b/ntpd/refclock_neoclock4x.c
@@ -657,7 +657,6 @@ neoclock4x_control(int unit,
char tmpbuf[80];
out->kv_list = (struct ctl_var *)0;
- out->type = REFCLK_NEOCLOCK4X;
snprintf(tmpbuf, sizeof(tmpbuf)-1,
"%04d-%02d-%02d %02d:%02d:%02d.%03d",
=====================================
ntpd/refclock_parse.c
=====================================
--- a/ntpd/refclock_parse.c
+++ b/ntpd/refclock_parse.c
@@ -3017,8 +3017,6 @@ parse_control(
outstatus[0] = '\0';
- out->type = REFCLK_PARSE;
-
/*
* keep fudgetime2 in sync with TRUSTTIME/MAXUNSYNC flag1
*/
=====================================
ntpq/ntpq-subs.c
=====================================
--- a/ntpq/ntpq-subs.c
+++ b/ntpq/ntpq-subs.c
@@ -1658,9 +1658,6 @@ doprintpeers(
} else if (decodenetnum(value, &refidadr)) {
if (SOCK_UNSPEC(&refidadr))
dstadr_refid = "0.0.0.0";
- else if (ISREFCLOCKADR(&refidadr))
- dstadr_refid =
- refnumtoa(&refidadr);
else
dstadr_refid =
stoa(&refidadr);
@@ -1680,9 +1677,6 @@ doprintpeers(
} else if (decodenetnum(value, &refidadr)) {
if (SOCK_UNSPEC(&refidadr))
dstadr_refid = "0.0.0.0";
- else if (ISREFCLOCKADR(&refidadr))
- dstadr_refid =
- refnumtoa(&refidadr);
else {
char *buf = emalloc(10);
int i = ntohl(refidadr.sa4.sin_addr.s_addr);
=====================================
ntpq/ntpq.c
=====================================
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -3268,11 +3268,7 @@ cookedprint(
case RF:
if (decodenetnum(value, &hval)) {
- if (ISREFCLOCKADR(&hval))
- output(fp, name,
- refnumtoa(&hval));
- else
- output(fp, name, stoa(&hval));
+ output(fp, name, stoa(&hval));
} else if (strlen(value) <= 4) {
output(fp, name, value);
} else {
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/0e8642ccb73731ec894582381cea4c592d816c74...29c93f9a8edaaf65731657562fdfd10d30cd5e8c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160624/d5ca352d/attachment.html>
More information about the vc
mailing list